Name | dtreg JSON |
Version |
1.1.1
JSON |
| download |
home_page | None |
Summary | Interact with Data Type Registries and Create Machine Actionable Data |
upload_time | 2025-02-15 11:35:39 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | MIT |
keywords |
data type registry
schema
json-ld
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# dtreg
<!-- badges: start -->
[](https://badge.fury.io/py/dtreg)
[](https://coveralls.io/github/OlgaLezhnina/dtreg_py?branch=master)

<!-- badges: end -->
The goal of dtreg is to help users interact with various data type registries (DTRs) and create machine-readable data.
Currently, we support the [ePIC](https://fc4e-t4-3.github.io/) and [ORKG](https://orkg.org/) DTRs.
* First, load a DTR schema (an ePIC datatype or an ORKG template) as a Python object.
* Then, create a new instance of the schema by filling in the relevant fields.
* Finally, write the instance as a machine-readable JSON-LD file.
## Installation
```sh
## install from PyPi:
pip install dtreg
```
## Example
This example shows you how to work with a DTR schema.
You need to know the schema identifier; see the [help page](https://reborn.orkg.org/pages/help).
```python
## import functions from the dtreg
from dtreg.load_datatype import load_datatype
from dtreg.to_jsonld import to_jsonld
## import pandas for a dataframe
import pandas as pd
## load the schema with the known identifier
dt = load_datatype("https://doi.org/21.T11969/aff130c76e68ead3862e")
## look at the schemata you might need to use
dt.__dict__.keys()
## check available fields for your schema
dt.data_item.prop_list
## create your instance by filling the fields of your choice
## see the help page to know more about the fields
my_label = "my results"
my_df = pd.DataFrame({'A': [1], 'B': [2]})
my_df.name = "dataframe_name"
url_1 = dt.url(label = "URL_1")
url_2 = dt.url(label = "URL_2")
my_inst = dt.data_item(label=my_label,
has_expression=[url_1, url_2],
source_table=my_df)
## write the instance in JSON-LD format as a string
my_json = to_jsonld(my_inst)
## the result can be saved as a JSON file
with open('my_file.json', 'w') as f:
f.write(my_json)
```
For more information, please see the [help page](https://reborn.orkg.org/pages/help).
Raw data
{
"_id": null,
"home_page": null,
"name": "dtreg",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "Olga Lezhnina <olga.lezhnina@tib.eu>",
"keywords": "data type registry, schema, JSON-LD",
"author": null,
"author_email": "Olga Lezhnina <olga.lezhnina@tib.eu>, Manuel Prinz <manuel.prinz@tib.eu>, Markus Stocker <markus.stocker@tib.eu>",
"download_url": "https://files.pythonhosted.org/packages/5f/84/140c1646987813dc0e4f8aa61fceae40ab816514b1835ac71b5b74c062fe/dtreg-1.1.1.tar.gz",
"platform": null,
"description": "# dtreg\n<!-- badges: start -->\n[](https://badge.fury.io/py/dtreg)\n[](https://coveralls.io/github/OlgaLezhnina/dtreg_py?branch=master)\n\n\n<!-- badges: end -->\n\nThe goal of dtreg is to help users interact with various data type registries (DTRs) and create machine-readable data. \nCurrently, we support the [ePIC](https://fc4e-t4-3.github.io/) and [ORKG](https://orkg.org/) DTRs.\n* First, load a DTR schema (an ePIC datatype or an ORKG template) as a Python object.\n* Then, create a new instance of the schema by filling in the relevant fields.\n* Finally, write the instance as a machine-readable JSON-LD file. \n## Installation\n\n```sh\n## install from PyPi:\npip install dtreg\n```\n\n## Example\n\nThis example shows you how to work with a DTR schema.\nYou need to know the schema identifier; see the [help page](https://reborn.orkg.org/pages/help).\n\n```python\n## import functions from the dtreg\nfrom dtreg.load_datatype import load_datatype\nfrom dtreg.to_jsonld import to_jsonld\n## import pandas for a dataframe\nimport pandas as pd\n## load the schema with the known identifier\ndt = load_datatype(\"https://doi.org/21.T11969/aff130c76e68ead3862e\")\n## look at the schemata you might need to use\ndt.__dict__.keys() \n## check available fields for your schema\ndt.data_item.prop_list \n## create your instance by filling the fields of your choice\n## see the help page to know more about the fields\nmy_label = \"my results\"\nmy_df = pd.DataFrame({'A': [1], 'B': [2]})\nmy_df.name = \"dataframe_name\"\nurl_1 = dt.url(label = \"URL_1\")\nurl_2 = dt.url(label = \"URL_2\")\nmy_inst = dt.data_item(label=my_label,\n has_expression=[url_1, url_2],\n source_table=my_df)\n## write the instance in JSON-LD format as a string\nmy_json = to_jsonld(my_inst) \n\n## the result can be saved as a JSON file\nwith open('my_file.json', 'w') as f:\n f.write(my_json)\n\n```\nFor more information, please see the [help page](https://reborn.orkg.org/pages/help).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Interact with Data Type Registries and Create Machine Actionable Data",
"version": "1.1.1",
"project_urls": {
"Changelog": "https://gitlab.com/TIBHannover/orkg/dtreg-python/-/blob/master/CHANGELOG.md",
"Repository": "https://gitlab.com/TIBHannover/orkg/dtreg-python"
},
"split_keywords": [
"data type registry",
" schema",
" json-ld"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "ee4971b6d9fe0cc56d52172ac0727f3cae68afcb10823af2933727428995a70b",
"md5": "a4683e5cc25a219f9ae90278dc818fea",
"sha256": "c41fe14febd805e217eb6bb98d7e6c407948da04a0044351b11fff9be9a9ccf2"
},
"downloads": -1,
"filename": "dtreg-1.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a4683e5cc25a219f9ae90278dc818fea",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 32673,
"upload_time": "2025-02-15T11:35:37",
"upload_time_iso_8601": "2025-02-15T11:35:37.392557Z",
"url": "https://files.pythonhosted.org/packages/ee/49/71b6d9fe0cc56d52172ac0727f3cae68afcb10823af2933727428995a70b/dtreg-1.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "5f84140c1646987813dc0e4f8aa61fceae40ab816514b1835ac71b5b74c062fe",
"md5": "0360d9a0709d942a4a8e656dc917f4d8",
"sha256": "ba7e90f139cd66a637c1a0ff3463f238f0b1879254188ec7fc383ef4810a75cb"
},
"downloads": -1,
"filename": "dtreg-1.1.1.tar.gz",
"has_sig": false,
"md5_digest": "0360d9a0709d942a4a8e656dc917f4d8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 19307,
"upload_time": "2025-02-15T11:35:39",
"upload_time_iso_8601": "2025-02-15T11:35:39.656850Z",
"url": "https://files.pythonhosted.org/packages/5f/84/140c1646987813dc0e4f8aa61fceae40ab816514b1835ac71b5b74c062fe/dtreg-1.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-15 11:35:39",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "TIBHannover",
"gitlab_project": "orkg",
"lcname": "dtreg"
}