oldaplib 0.3.4__tar.gz → 0.3.6__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 (163) hide show
  1. {oldaplib-0.3.4 → oldaplib-0.3.6}/PKG-INFO +3 -2
  2. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/enums/attributeclass.py +31 -6
  3. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/enums/externalontologyattr.py +1 -1
  4. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/enums/owlpropertytype.py +2 -2
  5. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/enums/propertyclassattr.py +23 -20
  6. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/objectfactory.py +3 -1
  7. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/propertyclass.py +50 -28
  8. oldaplib-0.3.6/oldaplib/src/version.py +1 -0
  9. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_qname.py +1 -1
  10. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/test/test_datamodel.py +4 -4
  11. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/test/test_objectfactory.py +12 -0
  12. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/test/test_propertyclass.py +75 -0
  13. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/testdata/objectfactory_test.trig +80 -0
  14. {oldaplib-0.3.4 → oldaplib-0.3.6}/pyproject.toml +1 -1
  15. oldaplib-0.3.4/oldaplib/src/version.py +0 -1
  16. {oldaplib-0.3.4 → oldaplib-0.3.6}/README.md +0 -0
  17. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/__init__.py +0 -0
  18. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/apps/load_list.py +0 -0
  19. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/ontologies/admin-testing.trig +0 -0
  20. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/ontologies/admin.trig +0 -0
  21. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/ontologies/example.trig +0 -0
  22. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/ontologies/oldap.trig +0 -0
  23. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/ontologies/oldap.ttl +0 -0
  24. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/ontologies/shared.trig +0 -0
  25. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/ontologies/standard/.gitsave +0 -0
  26. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/__init__.py +0 -0
  27. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/cachesingleton.py +0 -0
  28. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/connection.py +0 -0
  29. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/datamodel.py +0 -0
  30. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/dtypes/__init__.py +0 -0
  31. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/dtypes/bnode.py +0 -0
  32. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/dtypes/languagein.py +0 -0
  33. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/dtypes/namespaceiri.py +0 -0
  34. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/dtypes/rdfset.py +0 -0
  35. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/dtypes/xsdset.py +0 -0
  36. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/enums/__init__.py +0 -0
  37. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/enums/action.py +0 -0
  38. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/enums/adminpermissions.py +0 -0
  39. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/enums/datapermissions.py +0 -0
  40. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/enums/haspropertyattr.py +0 -0
  41. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/enums/language.py +0 -0
  42. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/enums/oldaplistattr.py +0 -0
  43. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/enums/oldaplistnodeattr.py +0 -0
  44. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/enums/permissionsetattr.py +0 -0
  45. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/enums/projectattr.py +0 -0
  46. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/enums/resourceclassattr.py +0 -0
  47. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/enums/sparql_result_format.py +0 -0
  48. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/enums/userattr.py +0 -0
  49. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/enums/xsd_datatypes.py +0 -0
  50. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/externalontology.py +0 -0
  51. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/globalconfig.py +0 -0
  52. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/hasproperty.py +0 -0
  53. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/helpers/Notify.py +0 -0
  54. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/helpers/__init__.py +0 -0
  55. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/helpers/attributechange.py +0 -0
  56. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/helpers/context.py +0 -0
  57. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/helpers/convert2datatype.py +0 -0
  58. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/helpers/irincname.py +0 -0
  59. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/helpers/json_encoder.py +0 -0
  60. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/helpers/langstring.py +0 -0
  61. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/helpers/numeric.py +0 -0
  62. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/helpers/observable_dict.py +0 -0
  63. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/helpers/observable_set.py +0 -0
  64. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/helpers/oldaperror.py +0 -0
  65. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/helpers/query_processor.py +0 -0
  66. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/helpers/semantic_version.py +0 -0
  67. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/helpers/serializeableset.py +0 -0
  68. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/helpers/serializer.py +0 -0
  69. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/helpers/singletonmeta.py +0 -0
  70. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/helpers/tools.py +0 -0
  71. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/iconnection.py +0 -0
  72. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/in_project.py +0 -0
  73. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/model.py +0 -0
  74. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/oldaplist.py +0 -0
  75. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/oldaplist_helpers.py +0 -0
  76. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/oldaplistnode.py +0 -0
  77. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/oldaplogging.py +0 -0
  78. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/permissionset.py +0 -0
  79. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/project.py +0 -0
  80. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/resourceclass.py +0 -0
  81. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/user.py +0 -0
  82. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/userdataclass.py +0 -0
  83. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/__init__.py +0 -0
  84. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/floatingpoint.py +0 -0
  85. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/iri.py +0 -0
  86. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd.py +0 -0
  87. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_anyuri.py +0 -0
  88. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_base64binary.py +0 -0
  89. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_boolean.py +0 -0
  90. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_byte.py +0 -0
  91. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_date.py +0 -0
  92. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_datetime.py +0 -0
  93. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_datetimestamp.py +0 -0
  94. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_decimal.py +0 -0
  95. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_double.py +0 -0
  96. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_duration.py +0 -0
  97. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_float.py +0 -0
  98. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_gday.py +0 -0
  99. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_gmonth.py +0 -0
  100. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_gmonthday.py +0 -0
  101. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_gyear.py +0 -0
  102. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_gyearmonth.py +0 -0
  103. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_hexbinary.py +0 -0
  104. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_id.py +0 -0
  105. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_idref.py +0 -0
  106. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_int.py +0 -0
  107. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_integer.py +0 -0
  108. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_language.py +0 -0
  109. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_long.py +0 -0
  110. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_name.py +0 -0
  111. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_ncname.py +0 -0
  112. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_negativeinteger.py +0 -0
  113. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_nmtoken.py +0 -0
  114. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_nonnegativeinteger.py +0 -0
  115. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_nonpositiveinteger.py +0 -0
  116. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_normalizedstring.py +0 -0
  117. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_positiveinteger.py +0 -0
  118. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_short.py +0 -0
  119. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_string.py +0 -0
  120. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_time.py +0 -0
  121. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_token.py +0 -0
  122. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_unsignedbyte.py +0 -0
  123. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_unsignedint.py +0 -0
  124. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_unsignedlong.py +0 -0
  125. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/src/xsd/xsd_unsignedshort.py +0 -0
  126. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/test/__init__.py +0 -0
  127. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/test/test_cache.py +0 -0
  128. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/test/test_connection.py +0 -0
  129. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/test/test_context.py +0 -0
  130. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/test/test_dtypes.py +0 -0
  131. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/test/test_externalontologies.py +0 -0
  132. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/test/test_hasproperty.py +0 -0
  133. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/test/test_in_project.py +0 -0
  134. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/test/test_langstring.py +0 -0
  135. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/test/test_language_in.py +0 -0
  136. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/test/test_observable_dict.py +0 -0
  137. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/test/test_observable_set.py +0 -0
  138. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/test/test_oldaplist.py +0 -0
  139. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/test/test_oldaplist_helpers.py +0 -0
  140. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/test/test_oldaplistnode.py +0 -0
  141. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/test/test_permissionset.py +0 -0
  142. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/test/test_project.py +0 -0
  143. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/test/test_resourceclass.py +0 -0
  144. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/test/test_semantic_version.py +0 -0
  145. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/test/test_user.py +0 -0
  146. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/test/test_xsd_datatypes.py +0 -0
  147. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/testdata/Gender.yaml +0 -0
  148. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/testdata/collections_type.yaml +0 -0
  149. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/testdata/connection_test.trig +0 -0
  150. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/testdata/datamodel_test.trig +0 -0
  151. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/testdata/event_type.yaml +0 -0
  152. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/testdata/hlist_schema.yaml +0 -0
  153. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/testdata/institution_or_building_type.yaml +0 -0
  154. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/testdata/language.yaml +0 -0
  155. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/testdata/location_type.yaml +0 -0
  156. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/testdata/means_of_transportation.yaml +0 -0
  157. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/testdata/playground_list.yaml +0 -0
  158. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/testdata/role.yaml +0 -0
  159. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/testdata/source_type-1.yaml +0 -0
  160. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/testdata/source_type.yaml +0 -0
  161. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/testdata/test_move_left_of_toL.yaml +0 -0
  162. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/testdata/testlist.yaml +0 -0
  163. {oldaplib-0.3.4 → oldaplib-0.3.6}/oldaplib/testit.http +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: oldaplib
3
- Version: 0.3.4
3
+ Version: 0.3.6
4
4
  Summary: Open Media Access Server Library (Linked Open Data middleware/RESTApi)
5
5
  License: GNU Affero General Public License version 3
6
6
  Author: Lukas Rosenthaler
@@ -9,6 +9,7 @@ Requires-Python: >=3.12,<4.0
9
9
  Classifier: License :: Other/Proprietary License
10
10
  Classifier: Programming Language :: Python :: 3
11
11
  Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
12
13
  Requires-Dist: bcrypt (==5.0.0)
13
14
  Requires-Dist: bump2version (>=1.0.1,<2.0.0)
14
15
  Requires-Dist: cloudpickle (>=3.1.1,<4.0.0)
@@ -1,8 +1,13 @@
1
- from enum import Enum
2
- from typing import Type, Self
1
+ from enum import Enum, Flag, auto
2
+ from typing import Type, Self, Any
3
3
 
4
4
  from oldaplib.src.xsd.xsd_qname import Xsd_QName
5
5
 
6
+ class Target(Flag):
7
+ SHACL = auto()
8
+ OWL = auto()
9
+ BOTH = SHACL | OWL # convenience alias
10
+
6
11
 
7
12
  class AttributeClass(Enum):
8
13
  """
@@ -10,7 +15,12 @@ class AttributeClass(Enum):
10
15
  Project, PropertyClass, ResourceClass, User etc.,
11
16
  """
12
17
 
13
- def __new__(cls, value: Xsd_QName | str, mandatory: bool, immutable: bool, datatype: Type):
18
+ def __new__(cls,
19
+ value: Xsd_QName | str,
20
+ mandatory: bool,
21
+ immutable: bool,
22
+ datatype: Type,
23
+ target: Target = Target.BOTH):
14
24
  """
15
25
  :param value: The value of the attribute-enum item. Must have the form of a QName!
16
26
  :param mandatory: True, if this attribute is mandatory, False otherwise.
@@ -23,6 +33,7 @@ class AttributeClass(Enum):
23
33
  member._mandatory = mandatory
24
34
  member._immutable = immutable
25
35
  member._datatype = datatype
36
+ member._target = target
26
37
  return member
27
38
 
28
39
  def __str__(self) -> str:
@@ -48,6 +59,23 @@ class AttributeClass(Enum):
48
59
  def immutable(self) -> bool:
49
60
  return self._immutable
50
61
 
62
+ @property
63
+ def target(self) -> Target:
64
+ """Where this attribute should be emitted/used (SHACL, OWL, BOTH)."""
65
+ return self._target
66
+
67
+ @property
68
+ def in_shacl(self) -> bool:
69
+ return bool(self._target & Target.SHACL)
70
+
71
+ @property
72
+ def in_owl(self) -> bool:
73
+ return bool(self._target & Target.OWL)
74
+
75
+ @property
76
+ def to_rdf(self) -> str:
77
+ return self._value.toRdf
78
+
51
79
  @classmethod
52
80
  def from_value(cls, value: Xsd_QName | str) -> Self:
53
81
  """
@@ -73,6 +101,3 @@ class AttributeClass(Enum):
73
101
  return member
74
102
  raise ValueError(f"No member with name {name} found")
75
103
 
76
- @property
77
- def to_rdf(self) -> str:
78
- return self._value.toRdf
@@ -15,7 +15,7 @@ class ExternalOntologyAttr(AttributeClass):
15
15
  (QName, mandatory, immutable, datatype)
16
16
  """
17
17
  # order: (QName, mandatory, immutable, datatype)
18
- PREFIX = ('oldap:prefix', True, False, Xsd_NCName)
18
+ PREFIX = ('oldap:prefix', True, True, Xsd_NCName)
19
19
  NAMESPACE_IRI = ('oldap:namespaceIri', True, True, NamespaceIRI)
20
20
  LABEL = ('rdfs:label', False, False, LangString)
21
21
  COMMENT = ('rdfs:comment', False, False, LangString)
@@ -19,8 +19,8 @@ class OwlPropertyType(Enum):
19
19
  IrreflexiveProperty = 'owl:IrreflexiveProperty'
20
20
  FunctionalProperty = 'owl:FunctionalProperty'
21
21
  InverseFunctionalProperty = 'owl:InverseFunctionalProperty'
22
- # InverseOfProperty = 'owl:InverseOfProperty'
23
- # EquivalentProperty = 'owl:EquivalentProperty'
22
+ # InverseOfProperty = 'owl:inverseOf'
23
+ # EquivalentProperty = 'owl:equivalentProperty'
24
24
  # _owl_inverseOf: Xsd_QName # :hasParent owl:inverseOf :hasChild .
25
25
  # _owl_equivalent: Xsd_QName # :hasSpouse owl:equivalentProperty :marriedTo .
26
26
 
@@ -3,7 +3,7 @@ from typing import Self
3
3
 
4
4
  from oldaplib.src.dtypes.languagein import LanguageIn
5
5
  from oldaplib.src.dtypes.xsdset import XsdSet
6
- from oldaplib.src.enums.attributeclass import AttributeClass
6
+ from oldaplib.src.enums.attributeclass import AttributeClass, Target
7
7
  from oldaplib.src.enums.xsd_datatypes import XsdDatatypes
8
8
  from oldaplib.src.helpers.langstring import LangString
9
9
  from oldaplib.src.helpers.numeric import Numeric
@@ -12,6 +12,7 @@ from oldaplib.src.helpers.observable_set import ObservableSet
12
12
  from oldaplib.src.xsd.iri import Iri
13
13
  from oldaplib.src.xsd.xsd_boolean import Xsd_boolean
14
14
  from oldaplib.src.xsd.xsd_integer import Xsd_integer
15
+ from oldaplib.src.xsd.xsd_qname import Xsd_QName
15
16
  from oldaplib.src.xsd.xsd_string import Xsd_string
16
17
 
17
18
 
@@ -35,26 +36,28 @@ class PropClassAttr(AttributeClass):
35
36
  - `PropertyClassAttribute.DESCRIPTION`: Description of the property. The literal is a string that may
36
37
  have attached a language id.
37
38
  """
38
- # order: (QName, mandatory, immutable, datatype)
39
+ # order: (QName, mandatory, immutable, datatype, target)
39
40
  SUBPROPERTY_OF = ('rdfs:subPropertyOf', False, False, Iri)
40
- TYPE = ('rdf:type', False, False, ObservableSet)
41
- CLASS = ('sh:class', False, False, Iri)
42
- NODEKIND = ('sh:nodeKind', False, False, Iri)
43
- DATATYPE = ('sh:datatype', False, False, XsdDatatypes)
44
- NAME = ('sh:name', False, False, LangString) # needs notifier
45
- DESCRIPTION = ('sh:description', False, False, LangString) # needs notifier
46
- LANGUAGE_IN = ('sh:languageIn', False, False, LanguageIn) # needs notifier
47
- UNIQUE_LANG = ('sh:uniqueLang', False, False, Xsd_boolean)
48
- IN = ('sh:in', False, False, XsdSet) # needs notifier
49
- MIN_LENGTH = ('sh:minLength', False, False, Xsd_integer)
50
- MAX_LENGTH = ('sh:maxLength', False, False, Xsd_integer)
51
- PATTERN = ('sh:pattern', False, False, Xsd_string)
52
- MIN_EXCLUSIVE = ('sh:minExclusive', False, False, Numeric)
53
- MIN_INCLUSIVE = ('sh:minInclusive', False, False, Numeric)
54
- MAX_EXCLUSIVE = ('sh:maxExclusive', False, False, Numeric)
55
- MAX_INCLUSIVE = ('sh:maxInclusive', False, False, Numeric)
56
- LESS_THAN = ('sh:lessThan', False, False, Iri)
57
- LESS_THAN_OR_EQUALS = ('sh:lessThanOrEquals', False, False, Iri)
41
+ TYPE = ('rdf:type', False, False, ObservableSet, Target.OWL)
42
+ CLASS = ('sh:class', False, False, Iri, Target.SHACL)
43
+ NODEKIND = ('sh:nodeKind', False, False, Iri, Target.SHACL)
44
+ DATATYPE = ('sh:datatype', False, False, XsdDatatypes, Target.SHACL)
45
+ NAME = ('sh:name', False, False, LangString, Target.SHACL) # needs notifier
46
+ DESCRIPTION = ('sh:description', False, False, LangString, Target.SHACL) # needs notifier
47
+ LANGUAGE_IN = ('sh:languageIn', False, False, LanguageIn, Target.SHACL) # needs notifier
48
+ UNIQUE_LANG = ('sh:uniqueLang', False, False, Xsd_boolean, Target.SHACL)
49
+ IN = ('sh:in', False, False, XsdSet, Target.SHACL) # needs notifier
50
+ MIN_LENGTH = ('sh:minLength', False, False, Xsd_integer, Target.SHACL)
51
+ MAX_LENGTH = ('sh:maxLength', False, False, Xsd_integer, Target.SHACL)
52
+ PATTERN = ('sh:pattern', False, False, Xsd_string, Target.SHACL)
53
+ MIN_EXCLUSIVE = ('sh:minExclusive', False, False, Numeric, Target.SHACL)
54
+ MIN_INCLUSIVE = ('sh:minInclusive', False, False, Numeric, Target.SHACL)
55
+ MAX_EXCLUSIVE = ('sh:maxExclusive', False, False, Numeric, Target.SHACL)
56
+ MAX_INCLUSIVE = ('sh:maxInclusive', False, False, Numeric, Target.SHACL)
57
+ LESS_THAN = ('sh:lessThan', False, False, Iri, Target.SHACL)
58
+ LESS_THAN_OR_EQUALS = ('sh:lessThanOrEquals', False, False, Iri, Target.SHACL)
59
+ INVERSE_OF = ('owl:inverseOf', False, False, Xsd_QName, Target.OWL)
60
+ EQUIVALEND_PROPERTY = ('owl:equivalentProperty', False, False, Xsd_QName, Target.OWL)
58
61
 
59
62
 
60
63
  @classmethod
@@ -144,7 +144,9 @@ class ResourceInstance:
144
144
  self.validate_value(self._values[prop_iri], hasprop.prop)
145
145
 
146
146
  def process_superclasses(superclass: dict[Xsd_QName, ResourceClass]):
147
- for sc_iri, sc in superclass.items():
147
+ for sc_iri, sc in superclass.items():
148
+ if not sc:
149
+ continue
148
150
  if sc.superclass:
149
151
  process_superclasses(sc.superclass)
150
152
  if sc.owl_class_iri == Xsd_QName("oldap:Thing", validate=False):
@@ -823,6 +823,8 @@ class PropertyClass(Model, Notify):
823
823
  group = val
824
824
  elif key in propkeys:
825
825
  attr = PropClassAttr.from_value(key)
826
+ if not attr.in_shacl:
827
+ continue
826
828
  if attr.datatype == Numeric:
827
829
  if not isinstance(val, (Xsd_integer, Xsd_float)):
828
830
  raise OldapErrorInconsistency(f'SHACL inconsistency: "{attr.value}" expects a "Xsd:integer" or "Xsd:float", but got "{type(val).__name__}".')
@@ -858,6 +860,7 @@ class PropertyClass(Model, Notify):
858
860
  def read_owl(self) -> None:
859
861
  if self._externalOntology:
860
862
  return
863
+ propkeys = {Xsd_QName(x.value) for x in PropClassAttr}
861
864
  context = Context(name=self._con.context_name)
862
865
  query1 = context.sparql_context
863
866
  query1 += f"""
@@ -878,24 +881,12 @@ class PropertyClass(Model, Notify):
878
881
  obj = r['o']
879
882
  match attr:
880
883
  case 'rdf:type':
881
- if obj == 'owl:DatatypeProperty':
882
- self._attributes[PropClassAttr.TYPE].add(OwlPropertyType.OwlDataProperty)
883
- elif obj == 'owl:ObjectProperty':
884
- self._attributes[PropClassAttr.TYPE].add(OwlPropertyType.OwlObjectProperty)
885
- elif obj == 'rdf:Property':
886
- self._attributes[PropClassAttr.TYPE].add(OwlPropertyType.StatementProperty)
887
- elif obj == 'owl:TransitiveProperty':
888
- self._attributes[PropClassAttr.TYPE].add(OwlPropertyType.TransitiveProperty)
889
- elif obj == 'owl:SymmetricProperty':
890
- self._attributes[PropClassAttr.TYPE].add(OwlPropertyType.SymmetricProperty)
891
- elif obj == 'owl:ReflexiveProperty':
892
- self._attributes[PropClassAttr.TYPE].add(OwlPropertyType.ReflexiveProperty)
893
- elif obj == 'owl:IrreflexiveProperty':
894
- self._attributes[PropClassAttr.TYPE].add(OwlPropertyType.IrreflexiveProperty)
895
- elif obj == 'owl:InverseFunctionalProperty':
896
- self._attributes[PropClassAttr.TYPE].add(OwlPropertyType.InverseFunctionalProperty)
897
- else:
898
- raise OldapErrorNotFound(f'Unknown owl:Property type "{obj}"')
884
+ try:
885
+ # If obj is already a member, keep it; otherwise look it up by value
886
+ prop_type = obj if isinstance(obj, OwlPropertyType) else OwlPropertyType(obj)
887
+ except ValueError as e:
888
+ raise OldapErrorNotFound(f'Unknown owl:Property type "{obj}"') from e
889
+ self._attributes[PropClassAttr.TYPE].add(prop_type)
899
890
  case 'owl:subPropertyOf':
900
891
  self._attributes[PropClassAttr.SUBPROPERTY_OF] = obj
901
892
  case 'rdfs:range':
@@ -919,6 +910,11 @@ class PropertyClass(Model, Notify):
919
910
  dt = obj
920
911
  if self._modified != dt:
921
912
  raise OldapError(f'Inconsistency between SHACL and OWL: created "{self._modified}" vs "{dt}" for property "{self._property_class_iri}".')
913
+ case _:
914
+ if attr in propkeys:
915
+ pcattr = PropClassAttr.from_value(attr)
916
+ if pcattr.in_owl:
917
+ self._attributes[pcattr] = pcattr.datatype(obj)
922
918
  #
923
919
  # Consistency checks
924
920
  #
@@ -1052,7 +1048,7 @@ class PropertyClass(Model, Notify):
1052
1048
  sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}oldap:statementProperty {self._statementProperty.toRdf}'
1053
1049
  sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}oldap:externalOntology {self._externalOntology.toRdf}'
1054
1050
  for prop, value in self._attributes.items():
1055
- if prop == PropClassAttr.TYPE:
1051
+ if not prop.in_shacl:
1056
1052
  continue
1057
1053
  if not value and not isinstance(value, bool):
1058
1054
  #if value is None:
@@ -1085,24 +1081,47 @@ class PropertyClass(Model, Notify):
1085
1081
 
1086
1082
  def create_owl_part1(self, timestamp: Xsd_dateTime, indent: int = 0, indent_inc: int = 4) -> str:
1087
1083
  blank = ''
1088
- sparql = f'{blank:{indent * indent_inc}}{self._property_class_iri.toRdf} rdf:type {self._attributes[PropClassAttr.TYPE].toRdf}'
1089
- if self._attributes.get(PropClassAttr.SUBPROPERTY_OF):
1090
- sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}rdfs:subPropertyOf {self._attributes[PropClassAttr.SUBPROPERTY_OF].toRdf}'
1084
+ sparql = f'{blank:{indent * indent_inc}}{self._property_class_iri.toRdf} {PropClassAttr.TYPE.toRdf} {self._attributes[PropClassAttr.TYPE].toRdf}'
1091
1085
  if self._internal:
1092
1086
  sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}rdfs:domain {self._internal.toRdf}'
1093
1087
  if self._attributes.get(PropClassAttr.TYPE) and OwlPropertyType.OwlDataProperty in self._attributes[PropClassAttr.TYPE]:
1094
1088
  sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}rdfs:range {self._attributes[PropClassAttr.DATATYPE].value}'
1095
1089
  elif self._attributes.get(PropClassAttr.TYPE) and OwlPropertyType.OwlObjectProperty in self._attributes[PropClassAttr.TYPE]:
1096
1090
  sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}rdfs:range {self._attributes[PropClassAttr.CLASS].toRdf}'
1091
+ for attr, val in self._attributes.items():
1092
+ #attr = PropClassAttr.from_value(key)
1093
+ if not attr.in_owl or attr == PropClassAttr.TYPE or val is None:
1094
+ continue
1095
+ if attr == PropClassAttr.NAME:
1096
+ sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}rdfs:label {val.toRdf}'
1097
+ elif attr == PropClassAttr.DESCRIPTION:
1098
+ sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}rdfs:comment {val.toRdf}'
1099
+ else:
1100
+ sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}{attr.toRdf} {val.toRdf}'
1097
1101
  sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}dcterms:creator {self._con.userIri.toRdf}'
1098
1102
  sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}dcterms:created {timestamp.toRdf}'
1099
1103
  sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}dcterms:contributor {self._con.userIri.toRdf}'
1100
1104
  sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}dcterms:modified {timestamp.toRdf}'
1101
- if self.name:
1102
- sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}rdfs:label {self.name.toRdf}'
1103
- if self.description:
1104
- sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}rdfs:comment {self.description.toRdf}'
1105
1105
  sparql += ' .\n'
1106
+
1107
+ # sparql = f'{blank:{indent * indent_inc}}{self._property_class_iri.toRdf} rdf:type {self._attributes[PropClassAttr.TYPE].toRdf}'
1108
+ # if self._attributes.get(PropClassAttr.SUBPROPERTY_OF):
1109
+ # sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}rdfs:subPropertyOf {self._attributes[PropClassAttr.SUBPROPERTY_OF].toRdf}'
1110
+ # if self._internal:
1111
+ # sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}rdfs:domain {self._internal.toRdf}'
1112
+ # if self._attributes.get(PropClassAttr.TYPE) and OwlPropertyType.OwlDataProperty in self._attributes[PropClassAttr.TYPE]:
1113
+ # sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}rdfs:range {self._attributes[PropClassAttr.DATATYPE].value}'
1114
+ # elif self._attributes.get(PropClassAttr.TYPE) and OwlPropertyType.OwlObjectProperty in self._attributes[PropClassAttr.TYPE]:
1115
+ # sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}rdfs:range {self._attributes[PropClassAttr.CLASS].toRdf}'
1116
+ # sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}dcterms:creator {self._con.userIri.toRdf}'
1117
+ # sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}dcterms:created {timestamp.toRdf}'
1118
+ # sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}dcterms:contributor {self._con.userIri.toRdf}'
1119
+ # sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}dcterms:modified {timestamp.toRdf}'
1120
+ # if self.name:
1121
+ # sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}rdfs:label {self.name.toRdf}'
1122
+ # if self.description:
1123
+ # sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}rdfs:comment {self.description.toRdf}'
1124
+ # sparql += ' .\n'
1106
1125
  return sparql
1107
1126
 
1108
1127
  def create_owl_part2(self, *,
@@ -1218,6 +1237,7 @@ class PropertyClass(Model, Notify):
1218
1237
  try:
1219
1238
  self._con.transaction_update(sparql)
1220
1239
  except OldapError as err:
1240
+ print(sparql)
1221
1241
  self._con.transaction_abort()
1222
1242
  raise
1223
1243
  if not self._externalOntology: # it's a project specific property -> OWL has been written -> check consistency!
@@ -1362,12 +1382,14 @@ class PropertyClass(Model, Notify):
1362
1382
  owlclass_iri: Xsd_QName | None = None,
1363
1383
  timestamp: Xsd_dateTime,
1364
1384
  indent: int = 0, indent_inc: int = 4) -> str:
1385
+ tmp = {x for x in PropClassAttr if x.in_owl and x != PropClassAttr.TYPE}
1365
1386
  owl_propclass_attributes = {PropClassAttr.SUBPROPERTY_OF, # should be in OWL ontology
1366
1387
  PropClassAttr.DATATYPE, # used for rdfs:range in OWL ontology
1367
- PropClassAttr.CLASS} # used for rdfs:range in OWL ontology
1388
+ PropClassAttr.CLASS} | tmp # used for rdfs:range in OWL ontology
1389
+ tmp = {x: x.value.toRdf for x in PropClassAttr if x.in_owl and x != PropClassAttr.TYPE}
1368
1390
  owl_prop = {PropClassAttr.SUBPROPERTY_OF: PropClassAttr.SUBPROPERTY_OF.value,
1369
1391
  PropClassAttr.DATATYPE: "rdfs:range",
1370
- PropClassAttr.CLASS: "rdfs:range"}
1392
+ PropClassAttr.CLASS: "rdfs:range"} | tmp
1371
1393
  blank = ''
1372
1394
  sparql_list = []
1373
1395
  for prop, change in self._changeset.items():
@@ -0,0 +1 @@
1
+ __version__ = "0.3.6"
@@ -55,7 +55,7 @@ class Xsd_QName(Xsd):
55
55
  raise OldapErrorValue(f'Invalid string "{value}" for QName. Error: {err}')
56
56
  self._value = f'{prefix}:{fragment}'
57
57
  else:
58
- raise OldapErrorValue(f'Invalid value for QName "{value}"')
58
+ raise OldapErrorValue(f'Invalid value for QName "{value}" (type: {type(value).__name__})')
59
59
  else:
60
60
  prefix = Xsd_NCName(value, validate=validate)
61
61
  if fragment:
@@ -622,10 +622,10 @@ class TestDataModel(unittest.TestCase):
622
622
  def test_datamodel_extonto_add(self):
623
623
  model = DataModel.read(self._connection, self._project, ignore_cache=True)
624
624
  eo = ExternalOntology(con=self._connection,
625
- projectShortName=self._project.projectShortName,
626
- prefix='testonto',
627
- namespaceIri='http://www.example.org/ns/testonto#',
628
- label=LangString("Test ontology@en", "Test ontology@de"))
625
+ projectShortName=self._project.projectShortName,
626
+ prefix='testonto',
627
+ namespaceIri='http://www.example.org/ns/testonto#',
628
+ label=LangString("Test ontology@en", "Test ontology@de"))
629
629
  model[Xsd_QName('test:testonto')] = eo
630
630
  model.update()
631
631
  model = DataModel.read(self._connection, self._project, ignore_cache=True)
@@ -6,6 +6,8 @@ from pathlib import Path
6
6
  from pprint import pprint
7
7
  from time import sleep
8
8
 
9
+ from oldaplib.src.cachesingleton import CacheSingletonRedis
10
+ from oldaplib.src.datamodel import DataModel
9
11
  from oldaplib.src.objectfactory import ResourceInstanceFactory
10
12
  from oldaplib.src.connection import Connection
11
13
  from oldaplib.src.enums.action import Action
@@ -129,6 +131,8 @@ class TestObjectFactory(unittest.TestCase):
129
131
  isActive=True)
130
132
  user.create()
131
133
  cls._tuser = User.read(cls._connection, "factorytestuser")
134
+ cache = CacheSingletonRedis()
135
+ cache.clear()
132
136
 
133
137
 
134
138
  @classmethod
@@ -337,6 +341,14 @@ class TestObjectFactory(unittest.TestCase):
337
341
  grantsPermission=Iri('oldap:GenericView'))
338
342
  b.create()
339
343
 
344
+ def test_constructor_D(self):
345
+ dm = DataModel.read(con=self._connection, project='test')
346
+ factory = ResourceInstanceFactory(con=self._connection, project='test')
347
+ Cat = factory.createObjectInstance('Cat')
348
+
349
+ mycat = Cat(name="Fluffy", subName="Fluffy the Cat")
350
+ mycat.create()
351
+
340
352
  def test_read_A(self):
341
353
  factory = ResourceInstanceFactory(con=self._connection, project='test')
342
354
  Book = factory.createObjectInstance('Book')
@@ -110,6 +110,22 @@ class TestPropertyClass(unittest.TestCase):
110
110
  self.assertEqual(p.get(PropClassAttr.DESCRIPTION), LangString("A property for testing...@en", "Property für Tests@de"))
111
111
  self.assertEqual(p[PropClassAttr.TYPE], {OwlPropertyType.StatementProperty, OwlPropertyType.OwlDataProperty})
112
112
 
113
+ def test_propertyclass_constructor_owlprop(self):
114
+ p = PropertyClass(con=self._connection,
115
+ project=self._project,
116
+ property_class_iri=Xsd_QName('test:isParent'),
117
+ toClass=Iri('test:Human'),
118
+ name=LangString(["Parent"]),
119
+ description={"Parent of the human"})
120
+ i = PropertyClass(con=self._connection,
121
+ project=self._project,
122
+ property_class_iri=Xsd_QName('test:isChild'),
123
+ toClass=Iri('test:Human'),
124
+ inverseOf=Xsd_QName('test:isParent'),
125
+ name=LangString(["Child"]),
126
+ description={"Child of the human"})
127
+ self.assertEqual(i.inverseOf, Xsd_QName('test:isParent'))
128
+
113
129
  def test_propertyclass_inset_datatypes(self):
114
130
  p = PropertyClass(con=self._connection,
115
131
  project=self._project,
@@ -416,6 +432,30 @@ class TestPropertyClass(unittest.TestCase):
416
432
  ignore_cache=True)
417
433
  self.assertEqual(p4.get(PropClassAttr.TYPE), {OwlPropertyType.SymmetricProperty, OwlPropertyType.OwlDataProperty})
418
434
 
435
+ def test_propertyclass_create_G(self):
436
+ p = PropertyClass(con=self._connection,
437
+ project=self._project,
438
+ property_class_iri=Xsd_QName('test:isParentG'),
439
+ toClass=Iri('test:Human'),
440
+ name=LangString(["Parent"]),
441
+ description={"Parent of the human"})
442
+ p.create()
443
+ i = PropertyClass(con=self._connection,
444
+ project=self._project,
445
+ property_class_iri=Xsd_QName('test:isChildG'),
446
+ toClass=Iri('test:Human'),
447
+ inverseOf=Xsd_QName('test:isParentG'),
448
+ name=LangString(["Child"]),
449
+ description={"Child of the human"})
450
+ self.assertEqual(i.inverseOf, Xsd_QName('test:isParentG'))
451
+ i.create()
452
+ i2 = PropertyClass.read(con=self._connection,
453
+ project=self._project,
454
+ property_class_iri=Xsd_QName('test:isChildG'),
455
+ ignore_cache=True)
456
+ self.assertEqual(i2.get(PropClassAttr.INVERSE_OF), Xsd_QName('test:isParentG'))
457
+
458
+
419
459
  def test_propertyclass_create_nopermission(self):
420
460
  p1 = PropertyClass(
421
461
  con=self._unpriv,
@@ -850,6 +890,24 @@ class TestPropertyClass(unittest.TestCase):
850
890
  ignore_cache=True)
851
891
  self.assertEqual(p8.get(PropClassAttr.TYPE), {OwlPropertyType.SymmetricProperty, OwlPropertyType.OwlDataProperty})
852
892
 
893
+ def test_propertyclass_update9(self):
894
+ i = PropertyClass(con=self._connection,
895
+ project=self._project,
896
+ property_class_iri=Xsd_QName('test:isChild9'),
897
+ toClass=Iri('test:Human'),
898
+ inverseOf=Xsd_QName('test:isParent9'),
899
+ name=LangString(["Child"]),
900
+ description={"Child of the human"})
901
+ self.assertEqual(i.inverseOf, Xsd_QName('test:isParent9'))
902
+ i.create()
903
+ i.inverseOf = Xsd_QName('test:anotherParent')
904
+ i.update()
905
+ i2 = PropertyClass.read(con=self._connection,
906
+ project=self._project,
907
+ property_class_iri=Xsd_QName('test:isChild9'),
908
+ ignore_cache=True)
909
+ self.assertEqual(i2.get(PropClassAttr.INVERSE_OF), Xsd_QName('test:anotherParent'))
910
+
853
911
  # @unittest.skip('Work in progress')
854
912
  def test_propertyclass_delete_attrs(self):
855
913
  p1 = PropertyClass(
@@ -894,6 +952,23 @@ class TestPropertyClass(unittest.TestCase):
894
952
  res = QueryProcessor(self._context, jsonres)
895
953
  self.assertEqual(len(res), 0)
896
954
 
955
+ def test_propertyclass_delete_owlattr(self):
956
+ i = PropertyClass(con=self._connection,
957
+ project=self._project,
958
+ property_class_iri=Xsd_QName('test:isChildDel'),
959
+ toClass=Iri('test:Human'),
960
+ inverseOf=Xsd_QName('test:isParentDel'),
961
+ name=LangString(["Child"]),
962
+ description={"Child of the human"})
963
+ i.create()
964
+ i.inverseOf = None
965
+ i.update()
966
+ i2 = PropertyClass.read(con=self._connection,
967
+ project=self._project,
968
+ property_class_iri=Xsd_QName('test:isChildDel'),
969
+ ignore_cache=True)
970
+ self.assertIsNone(i2.get(PropClassAttr.INVERSE_OF))
971
+
897
972
  # @unittest.skip('Work in progress')
898
973
  def test_propertyclass_delete(self):
899
974
  p1 = PropertyClass(
@@ -30,6 +30,46 @@ test:shacl {
30
30
 
31
31
  test:shapes schema:version "0.1.0"^^xsd:string .
32
32
 
33
+ test:MammalShape a sh:NodeShape ;
34
+ sh:targetClass test:Mammal ;
35
+ dcterms:created "2024-05-16T18:38:25.551434"^^xsd:dateTime ;
36
+ dcterms:creator <https://orcid.org/0000-0003-1681-4036> ;
37
+ dcterms:modified "2024-05-16T18:38:25.551434"^^xsd:dateTime ;
38
+ dcterms:contributor <https://orcid.org/0000-0003-1681-4036> ;
39
+ sh:node oldap:ThingShape ;
40
+ sh:property [
41
+ sh:path rdf:type ;
42
+ ],
43
+ [
44
+ sh:path test:name ;
45
+ sh:datatype xsd:string ;
46
+ dcterms:creator <https://orcid.org/0000-0003-1681-4036> ;
47
+ dcterms:created "2024-05-16T18:38:25.551434"^^xsd:dateTime ;
48
+ dcterms:contributor <https://orcid.org/0000-0003-1681-4036> ;
49
+ dcterms:modified "2024-05-16T18:38:25.551434"^^xsd:dateTime ;
50
+ ] .
51
+
52
+ test:CatShape a sh:NodeShape ;
53
+ sh:targetClass test:Cat ;
54
+ dcterms:created "2024-05-16T18:38:25.551434"^^xsd:dateTime ;
55
+ dcterms:creator <https://orcid.org/0000-0003-1681-4036> ;
56
+ dcterms:modified "2024-05-16T18:38:25.551434"^^xsd:dateTime ;
57
+ dcterms:contributor <https://orcid.org/0000-0003-1681-4036> ;
58
+ sh:node oldap:ThingShape, test:MammalShape ;
59
+ sh:property [
60
+ sh:path rdf:type ;
61
+ ],
62
+ [
63
+ sh:path test:subName ;
64
+ sh:datatype xsd:string ;
65
+ dcterms:creator <https://orcid.org/0000-0003-1681-4036> ;
66
+ dcterms:created "2024-05-16T18:38:25.551434"^^xsd:dateTime ;
67
+ dcterms:contributor <https://orcid.org/0000-0003-1681-4036> ;
68
+ dcterms:modified "2024-05-16T18:38:25.551434"^^xsd:dateTime ;
69
+ ] .
70
+
71
+
72
+
33
73
  test:PersonShape a sh:NodeShape ;
34
74
  sh:targetClass test:Person ;
35
75
  dcterms:created "2024-05-16T18:38:25.551434"^^xsd:dateTime ;
@@ -776,6 +816,46 @@ test:onto {
776
816
  test:ontology owl:type owl:Ontology ;
777
817
  owl:versionInfo "0.1.0"^^xsd:string .
778
818
 
819
+ test:Mammal rdf:type owl:Class ;
820
+ dcterms:created "2024-05-16T18:38:25.551434"^^xsd:dateTime ;
821
+ dcterms:creator <https://orcid.org/0000-0003-1681-4036> ;
822
+ dcterms:modified "2024-05-16T18:38:25.551434"^^xsd:dateTime ;
823
+ dcterms:contributor <https://orcid.org/0000-0003-1681-4036> ;
824
+ rdfs:subClassOf oldap:Thing ,
825
+ [
826
+ rdf:type owl:Restriction ;
827
+ owl:onProperty test:name ;
828
+ owl:onDataRange xsd:string ;
829
+ ] .
830
+
831
+ test:Cat rdf:type owl:Class ;
832
+ dcterms:creator <https://orcid.org/0000-0003-1681-4036> ;
833
+ dcterms:created "2023-11-04T12:00:00+00:00"^^xsd:dateTime ;
834
+ dcterms:contributor <https://orcid.org/0000-0003-1681-4036> ;
835
+ dcterms:modified "2023-11-04T12:00:00+00:00"^^xsd:dateTime ;
836
+ rdfs:subClassOf oldap:Thing, test:Mammal,
837
+ [
838
+ rdf:type owl:Restriction ;
839
+ owl:onProperty test:subName ;
840
+ owl:onDataRange xsd:string ;
841
+ ] .
842
+
843
+ test:name rdf:type owl:DatatypeProperty ;
844
+ rdfs:domain test:Mammal ;
845
+ rdfs:range xsd:string ;
846
+ dcterms:creator <https://orcid.org/0000-0003-1681-4036> ;
847
+ dcterms:created "2024-05-16T18:38:25.551434"^^xsd:dateTime ;
848
+ dcterms:contributor <https://orcid.org/0000-0003-1681-4036> ;
849
+ dcterms:modified "2024-05-16T18:38:25.551434"^^xsd:dateTime .
850
+
851
+ test:subName rdf:type owl:DatatypeProperty ;
852
+ rdfs:domain test:Cat ;
853
+ rdfs:range xsd:string ;
854
+ dcterms:creator <https://orcid.org/0000-0003-1681-4036> ;
855
+ dcterms:created "2024-05-16T18:38:25.551434"^^xsd:dateTime ;
856
+ dcterms:contributor <https://orcid.org/0000-0003-1681-4036> ;
857
+ dcterms:modified "2024-05-16T18:38:25.551434"^^xsd:dateTime .
858
+
779
859
  test:Person rdf:type owl:Class ;
780
860
  dcterms:creator <https://orcid.org/0000-0003-1681-4036> ;
781
861
  dcterms:created "2023-11-04T12:00:00+00:00"^^xsd:dateTime ;
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "oldaplib"
3
- version = "0.3.4"
3
+ version = "0.3.6"
4
4
  description = "Open Media Access Server Library (Linked Open Data middleware/RESTApi)"
5
5
  authors = ["Lukas Rosenthaler <lukas.rosenthaler@unibas.ch>"]
6
6
  license = "GNU Affero General Public License version 3"
@@ -1 +0,0 @@
1
- __version__ = "0.3.4"
File without changes
File without changes