ontolutils 0.6.0__tar.gz → 0.6.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ontolutils-0.6.0 → ontolutils-0.6.2}/PKG-INFO +3 -2
- {ontolutils-0.6.0 → ontolutils-0.6.2}/README.md +2 -1
- {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/classes/thing.py +9 -10
- {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils.egg-info/PKG-INFO +3 -2
- {ontolutils-0.6.0 → ontolutils-0.6.2}/setup.cfg +1 -1
- {ontolutils-0.6.0 → ontolutils-0.6.2}/tests/test_classes.py +1 -1
- {ontolutils-0.6.0 → ontolutils-0.6.2}/tests/test_namespaces.py +1 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/LICENSE +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/__init__.py +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/_version.py +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/cache.py +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/classes/__init__.py +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/classes/decorator.py +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/classes/query_util.py +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/classes/typing.py +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/classes/utils.py +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/config.py +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/namespacelib/__dev.py +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/namespacelib/__init__.py +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/namespacelib/_iana_utils.py +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/namespacelib/codemeta.py +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/namespacelib/m4i.py +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/namespacelib/obo.py +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/namespacelib/qudt_kind.py +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/namespacelib/qudt_unit.py +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/namespacelib/schema.py +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/utils/__init__.py +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/utils/qudt_units.py +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils.egg-info/SOURCES.txt +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils.egg-info/dependency_links.txt +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils.egg-info/requires.txt +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils.egg-info/top_level.txt +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/pyproject.toml +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/setup.py +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/tests/test_decorator.py +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/tests/test_query.py +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/tests/test_readme.py +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/tests/test_typing.py +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/tests/test_utils.py +0 -0
- {ontolutils-0.6.0 → ontolutils-0.6.2}/tests/test_version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ontolutils
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.2
|
|
4
4
|
Summary: Utility library for the work with ontologies.
|
|
5
5
|
Home-page: https://github.com/matthiasprobst/ontology-utils
|
|
6
6
|
Author: Matthias Probst
|
|
@@ -71,7 +71,8 @@ class Person(Thing):
|
|
|
71
71
|
firstName: str
|
|
72
72
|
last_name: str = Field(default=None, alias="lastName") # you may provide an alias
|
|
73
73
|
mbox: EmailStr = None
|
|
74
|
-
orcidId: HttpUrl = Field(default=None, alias="foaf:orcidId",
|
|
74
|
+
orcidId: HttpUrl = Field(default=None, alias="foaf:orcidId",
|
|
75
|
+
json_schema_extra={'use_as_id': True}) # use this as ID if available
|
|
75
76
|
|
|
76
77
|
|
|
77
78
|
p = Person(id="https://orcid.org/0000-0001-8729-0482",
|
|
@@ -39,7 +39,8 @@ class Person(Thing):
|
|
|
39
39
|
firstName: str
|
|
40
40
|
last_name: str = Field(default=None, alias="lastName") # you may provide an alias
|
|
41
41
|
mbox: EmailStr = None
|
|
42
|
-
orcidId: HttpUrl = Field(default=None, alias="foaf:orcidId",
|
|
42
|
+
orcidId: HttpUrl = Field(default=None, alias="foaf:orcidId",
|
|
43
|
+
json_schema_extra={'use_as_id': True}) # use this as ID if available
|
|
43
44
|
|
|
44
45
|
|
|
45
46
|
p = Person(id="https://orcid.org/0000-0001-8729-0482",
|
|
@@ -291,16 +291,15 @@ class Thing(ThingModel):
|
|
|
291
291
|
"@context": at_context,
|
|
292
292
|
**serialization
|
|
293
293
|
}
|
|
294
|
-
for field_name, field_value in self.__class__.
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
_id = getattr(self, field_name)
|
|
294
|
+
for field_name, field_value in self.__class__.model_json_schema()["properties"].items():
|
|
295
|
+
_use_as_id = field_value.get("use_as_id", None)
|
|
296
|
+
if _use_as_id is not None:
|
|
297
|
+
_id = getattr(self, field_name)
|
|
298
|
+
if _id is not None:
|
|
300
299
|
if str(_id).startswith(("_:", "http")):
|
|
301
300
|
jsonld["@id"] = getattr(self, field_name)
|
|
302
301
|
else:
|
|
303
|
-
raise ValueError(
|
|
302
|
+
raise ValueError(f'The ID must be a valid IRI or blank node but got "{_id}".')
|
|
304
303
|
return jsonld
|
|
305
304
|
|
|
306
305
|
def model_dump_jsonld(self,
|
|
@@ -388,7 +387,7 @@ class Thing(ThingModel):
|
|
|
388
387
|
@classmethod
|
|
389
388
|
def from_jsonld(cls,
|
|
390
389
|
source: Optional[Union[str, pathlib.Path]] = None,
|
|
391
|
-
data: Optional[Dict] = None,
|
|
390
|
+
data: Optional[Union[str, Dict]] = None,
|
|
392
391
|
limit: Optional[int] = None,
|
|
393
392
|
context: Optional[Dict] = None):
|
|
394
393
|
"""Initialize the class from a JSON-LD source
|
|
@@ -401,8 +400,8 @@ class Thing(ThingModel):
|
|
|
401
400
|
----------
|
|
402
401
|
source: Optional[Union[str, pathlib.Path]]=None
|
|
403
402
|
The source of the JSON-LD data (filename). Must be given if data is None.
|
|
404
|
-
data: Optional[str]=None
|
|
405
|
-
The JSON-LD data as a
|
|
403
|
+
data: Optional[Union[str, Dict]]=None
|
|
404
|
+
The JSON-LD data as a str or dictionary. Must be given if source is None.
|
|
406
405
|
limit: Optional[int]=None
|
|
407
406
|
The limit of the number of objects to return. If None, all objects will be returned.
|
|
408
407
|
If limit is 1, then the first object will be returned, else a list of objects.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ontolutils
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.2
|
|
4
4
|
Summary: Utility library for the work with ontologies.
|
|
5
5
|
Home-page: https://github.com/matthiasprobst/ontology-utils
|
|
6
6
|
Author: Matthias Probst
|
|
@@ -71,7 +71,8 @@ class Person(Thing):
|
|
|
71
71
|
firstName: str
|
|
72
72
|
last_name: str = Field(default=None, alias="lastName") # you may provide an alias
|
|
73
73
|
mbox: EmailStr = None
|
|
74
|
-
orcidId: HttpUrl = Field(default=None, alias="foaf:orcidId",
|
|
74
|
+
orcidId: HttpUrl = Field(default=None, alias="foaf:orcidId",
|
|
75
|
+
json_schema_extra={'use_as_id': True}) # use this as ID if available
|
|
75
76
|
|
|
76
77
|
|
|
77
78
|
p = Person(id="https://orcid.org/0000-0001-8729-0482",
|
|
@@ -444,7 +444,7 @@ class TestNamespaces(unittest.TestCase):
|
|
|
444
444
|
firstName: str
|
|
445
445
|
lastName: str = None
|
|
446
446
|
mbox: EmailStr = None
|
|
447
|
-
orcidId: str = Field(default=None, alias="orcid_id", use_as_id
|
|
447
|
+
orcidId: str = Field(default=None, alias="orcid_id", json_schema_extra={'use_as_id': True})
|
|
448
448
|
|
|
449
449
|
p = Person(
|
|
450
450
|
id="local:cde4c79c-21f2-4ab7-b01d-28de6e4aade4",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|