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.
Files changed (40) hide show
  1. {ontolutils-0.6.0 → ontolutils-0.6.2}/PKG-INFO +3 -2
  2. {ontolutils-0.6.0 → ontolutils-0.6.2}/README.md +2 -1
  3. {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/classes/thing.py +9 -10
  4. {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils.egg-info/PKG-INFO +3 -2
  5. {ontolutils-0.6.0 → ontolutils-0.6.2}/setup.cfg +1 -1
  6. {ontolutils-0.6.0 → ontolutils-0.6.2}/tests/test_classes.py +1 -1
  7. {ontolutils-0.6.0 → ontolutils-0.6.2}/tests/test_namespaces.py +1 -0
  8. {ontolutils-0.6.0 → ontolutils-0.6.2}/LICENSE +0 -0
  9. {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/__init__.py +0 -0
  10. {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/_version.py +0 -0
  11. {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/cache.py +0 -0
  12. {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/classes/__init__.py +0 -0
  13. {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/classes/decorator.py +0 -0
  14. {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/classes/query_util.py +0 -0
  15. {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/classes/typing.py +0 -0
  16. {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/classes/utils.py +0 -0
  17. {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/config.py +0 -0
  18. {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/namespacelib/__dev.py +0 -0
  19. {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/namespacelib/__init__.py +0 -0
  20. {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/namespacelib/_iana_utils.py +0 -0
  21. {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/namespacelib/codemeta.py +0 -0
  22. {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/namespacelib/m4i.py +0 -0
  23. {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/namespacelib/obo.py +0 -0
  24. {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/namespacelib/qudt_kind.py +0 -0
  25. {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/namespacelib/qudt_unit.py +0 -0
  26. {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/namespacelib/schema.py +0 -0
  27. {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/utils/__init__.py +0 -0
  28. {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils/utils/qudt_units.py +0 -0
  29. {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils.egg-info/SOURCES.txt +0 -0
  30. {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils.egg-info/dependency_links.txt +0 -0
  31. {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils.egg-info/requires.txt +0 -0
  32. {ontolutils-0.6.0 → ontolutils-0.6.2}/ontolutils.egg-info/top_level.txt +0 -0
  33. {ontolutils-0.6.0 → ontolutils-0.6.2}/pyproject.toml +0 -0
  34. {ontolutils-0.6.0 → ontolutils-0.6.2}/setup.py +0 -0
  35. {ontolutils-0.6.0 → ontolutils-0.6.2}/tests/test_decorator.py +0 -0
  36. {ontolutils-0.6.0 → ontolutils-0.6.2}/tests/test_query.py +0 -0
  37. {ontolutils-0.6.0 → ontolutils-0.6.2}/tests/test_readme.py +0 -0
  38. {ontolutils-0.6.0 → ontolutils-0.6.2}/tests/test_typing.py +0 -0
  39. {ontolutils-0.6.0 → ontolutils-0.6.2}/tests/test_utils.py +0 -0
  40. {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.0
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", use_as_id=True) # use this as ID if available
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", use_as_id=True) # use this as ID if available
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__.model_fields.items():
295
- if field_value.json_schema_extra:
296
- use_as_id = field_value.json_schema_extra.get('use_as_id', None)
297
- if use_as_id:
298
- print("USING AS ID: ", field_name)
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("The ID must be a valid IRI or blank node.")
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 string. Must be given if source is None.
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.0
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", use_as_id=True) # use this as ID if available
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",
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = ontolutils
3
- version = 0.6.0
3
+ version = 0.6.2
4
4
  author = Matthias Probst
5
5
  author_email = matthias.probst@kit.edu
6
6
  description = Utility library for the work with ontologies.
@@ -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=True)
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",
@@ -11,6 +11,7 @@ LOG_LEVEL = logging.DEBUG
11
11
 
12
12
 
13
13
  class TestNamespaces(unittest.TestCase):
14
+
14
15
  def setUp(self):
15
16
  logger = logging.getLogger('ontolutils')
16
17
  self.INITIAL_LOG_LEVEL = logger.level
File without changes
File without changes
File without changes