oldaplib 0.4.3__py3-none-any.whl → 0.4.5__py3-none-any.whl

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.
@@ -1,3 +1,4 @@
1
+ import json
1
2
  from enum import Enum, unique, EnumMeta
2
3
 
3
4
  from oldaplib.src.helpers.serializer import serializer
@@ -72,7 +73,3 @@ class Editor(Enum, metaclass=_ValidateEnumMeta):
72
73
  def _as_dict(self):
73
74
  return {"value": self.value }
74
75
 
75
-
76
- if __name__ == "__main__":
77
- print(Editor(value="dash:TextFieldWithLangEditor"))
78
-
@@ -1,6 +1,7 @@
1
1
  from enum import unique
2
2
 
3
3
  from oldaplib.src.enums.attributeclass import AttributeClass, Target
4
+ from oldaplib.src.enums.editor import Editor
4
5
  from oldaplib.src.xsd.iri import Iri
5
6
  from oldaplib.src.xsd.xsd_decimal import Xsd_decimal
6
7
  from oldaplib.src.xsd.xsd_integer import Xsd_integer
@@ -16,5 +17,5 @@ class HasPropertyAttr(AttributeClass):
16
17
  MAX_COUNT = ('sh:maxCount', False, False, Xsd_integer)
17
18
  ORDER = ('sh:order', False, False, Xsd_decimal, Target.SHACL)
18
19
  GROUP = ('sh:group', False, False, Xsd_QName, Target.SHACL)
19
- EDITOR = ('dash:editor', False, False, Xsd_QName, Target.SHACL)
20
+ EDITOR = ('dash:editor', False, False, Editor, Target.SHACL)
20
21
 
@@ -1,5 +1,6 @@
1
1
  import re
2
2
  import textwrap
3
+ from pprint import pprint
3
4
 
4
5
  import jwt
5
6
 
@@ -1073,7 +1074,7 @@ class ResourceInstance:
1073
1074
  continue
1074
1075
  if not data.get(r['predicate'].as_qname):
1075
1076
  data[r['predicate'].as_qname] = []
1076
- data[str(r['predicate'].as_qname)].append(str(r['value']))
1077
+ data[str(r['predicate'].as_qname)].append(r['value'])
1077
1078
  else:
1078
1079
  raise OldapErrorInconsistency(f"Expected QName as predicate, got {r['predicate']}")
1079
1080
  if not data.get('rdf:type'):
oldaplib/src/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.4.3"
1
+ __version__ = "0.4.5"
oldaplib/src/xsd/iri.py CHANGED
@@ -246,6 +246,10 @@ class Iri(Xsd):
246
246
  parts = self.__value.split(':')
247
247
  return parts[1]
248
248
 
249
+ @property
250
+ def value(self) -> str:
251
+ return self.__value
252
+
249
253
 
250
254
  if __name__ == '__main__':
251
255
  #iri = Iri("oldap:HyperHamlet\".}\nSELECT * WHERE{?s ?p ?s})#")
@@ -4,6 +4,7 @@ from time import sleep
4
4
 
5
5
  from oldaplib.src.connection import Connection
6
6
  from oldaplib.src.dtypes.namespaceiri import NamespaceIRI
7
+ from oldaplib.src.enums.editor import Editor
7
8
  from oldaplib.src.enums.xsd_datatypes import XsdDatatypes
8
9
  from oldaplib.src.hasproperty import HasProperty
9
10
  from oldaplib.src.helpers.context import Context
@@ -74,14 +75,14 @@ class TestHasProperty(unittest.TestCase):
74
75
  maxCount=1,
75
76
  group=Xsd_QName('test:group'),
76
77
  order=1,
77
- editor=Xsd_QName("dash:TextAreaEditor")),
78
+ editor=Editor.TEXT_AREA),
78
79
  HasProperty(con=self._connection,
79
80
  project=self._project,
80
81
  prop=Xsd_QName("test:comment"),
81
82
  maxCount=1,
82
83
  group=Xsd_QName('test:group'),
83
84
  order=2,
84
- editor=Xsd_QName("dash:TextFieldEditor")),
85
+ editor=Editor.TEXT_FIELD),
85
86
  ]
86
87
  r1 = ResourceClass(con=self._connection,
87
88
  project=self._project,
@@ -100,13 +101,13 @@ class TestHasProperty(unittest.TestCase):
100
101
  self.assertEqual(r1[Xsd_QName('test:hasprop_test_A')].maxCount, Xsd_integer(1))
101
102
  self.assertEqual(r1[Xsd_QName('test:hasprop_test_A')].order, Xsd_decimal(1))
102
103
  self.assertEqual(r1[Xsd_QName('test:hasprop_test_A')].group, Xsd_QName('test:group'))
103
- self.assertEqual(r1[Xsd_QName('test:hasprop_test_A')].editor, Xsd_QName("dash:TextAreaEditor"))
104
+ self.assertEqual(r1[Xsd_QName('test:hasprop_test_A')].editor, Editor.TEXT_AREA)
104
105
 
105
106
  self.assertIsNone(r1[Xsd_QName("test:comment")].minCount)
106
107
  self.assertEqual(r1[Xsd_QName("test:comment")].maxCount, Xsd_integer(1))
107
108
  self.assertEqual(r1[Xsd_QName("test:comment")].order, Xsd_decimal(2))
108
109
  self.assertEqual(r1[Xsd_QName("test:comment")].group, Xsd_QName('test:group'))
109
- self.assertEqual(r1[Xsd_QName('test:comment')].editor, Xsd_QName("dash:TextFieldEditor"))
110
+ self.assertEqual(r1[Xsd_QName('test:comment')].editor, Editor.TEXT_FIELD)
110
111
 
111
112
  def test_creation_B(self):
112
113
  p1 = PropertyClass(con=self._connection,
@@ -117,9 +118,9 @@ class TestHasProperty(unittest.TestCase):
117
118
  hasproperties: list[HasProperty] = [
118
119
  HasProperty(con=self._connection, project=self._project, prop=p1,
119
120
  minCount=1, maxCount=1, group=Xsd_QName('test:group'),
120
- order=1, editor=Xsd_QName("dash:TextAreaEditor")),
121
+ order=1, editor=Editor.TEXT_AREA),
121
122
  HasProperty(con=self._connection, project=self._project, prop=Xsd_QName("test:comment"),
122
- maxCount=1, group=Xsd_QName('test:group'), order=2, editor=Xsd_QName("dash:TextFieldEditor")),
123
+ maxCount=1, group=Xsd_QName('test:group'), order=2, editor=Editor.TEXT_FIELD),
123
124
  ]
124
125
  r1 = ResourceClass(con=self._connection,
125
126
  project=self._project,
@@ -137,12 +138,12 @@ class TestHasProperty(unittest.TestCase):
137
138
  r1[Xsd_QName('test:hasprop_test_B')].maxCount = Xsd_integer(2)
138
139
  r1[Xsd_QName('test:hasprop_test_B')].order = Xsd_decimal(2)
139
140
  r1[Xsd_QName('test:hasprop_test_B')].group = Xsd_QName('test:groupB')
140
- r1[Xsd_QName('test:hasprop_test_B')].editor = Xsd_QName("dash:TextFieldEditor")
141
+ r1[Xsd_QName('test:hasprop_test_B')].editor = Editor.TEXT_FIELD
141
142
 
142
143
  r1[Xsd_QName('test:comment')].maxCount = Xsd_integer(2)
143
144
  r1[Xsd_QName('test:comment')].order = Xsd_decimal(1)
144
145
  r1[Xsd_QName('test:comment')].group = Xsd_QName('test:groupB')
145
- r1[Xsd_QName('test:comment')].editor = Xsd_QName("dash:TextAreaEditor")
146
+ r1[Xsd_QName('test:comment')].editor = Editor.TEXT_AREA
146
147
 
147
148
  r1.update()
148
149
  r1 = ResourceClass.read(con=self._connection,
@@ -151,11 +152,11 @@ class TestHasProperty(unittest.TestCase):
151
152
  self.assertEqual(Xsd_integer(2), r1[Xsd_QName('test:hasprop_test_B')].maxCount)
152
153
  self.assertEqual(Xsd_decimal(2), r1[Xsd_QName('test:hasprop_test_B')].order)
153
154
  self.assertEqual(Xsd_QName('test:groupB'), r1[Xsd_QName('test:hasprop_test_B')].group)
154
- self.assertEqual(Xsd_QName("dash:TextFieldEditor"), r1[Xsd_QName('test:hasprop_test_B')].editor)
155
+ self.assertEqual(Editor.TEXT_FIELD, r1[Xsd_QName('test:hasprop_test_B')].editor)
155
156
 
156
157
  self.assertEqual(Xsd_integer(2), r1[Xsd_QName('test:comment')].maxCount)
157
158
  self.assertEqual(Xsd_decimal(1), r1[Xsd_QName('test:comment')].order)
158
- self.assertEqual(Xsd_QName("dash:TextAreaEditor"), r1[Xsd_QName('test:comment')].editor)
159
+ self.assertEqual(Editor.TEXT_AREA, r1[Xsd_QName('test:comment')].editor)
159
160
 
160
161
  def test_modification_add(self):
161
162
  p1 = PropertyClass(con=self._connection,
@@ -169,7 +170,7 @@ class TestHasProperty(unittest.TestCase):
169
170
  prop=p1,
170
171
  minCount=1,
171
172
  order=1,
172
- editor=Xsd_QName("dash:TextAreaEditor")),
173
+ editor=Editor.TEXT_AREA),
173
174
  HasProperty(con=self._connection,
174
175
  project=self._project,
175
176
  prop=Xsd_QName("test:comment"),
@@ -194,7 +195,7 @@ class TestHasProperty(unittest.TestCase):
194
195
  r1[Xsd_QName('test:hasprop_test_C')].editor = None
195
196
  r1[Xsd_QName("test:comment")].minCount = Xsd_integer(1)
196
197
  r1[Xsd_QName("test:comment")].order = Xsd_decimal(1)
197
- r1[Xsd_QName("test:comment")].editor = Xsd_QName("dash:TextFieldEditor")
198
+ r1[Xsd_QName("test:comment")].editor = Editor.TEXT_FIELD
198
199
 
199
200
  r1.update()
200
201
  r1 = ResourceClass.read(con=self._connection,
@@ -205,7 +206,7 @@ class TestHasProperty(unittest.TestCase):
205
206
  self.assertIsNone(r1[Xsd_QName('test:hasprop_test_C')].editor)
206
207
  self.assertEqual(Xsd_integer(1), r1[Xsd_QName("test:comment")].minCount)
207
208
  self.assertEqual(Xsd_decimal(1), r1[Xsd_QName("test:comment")].order)
208
- self.assertEqual(Xsd_QName("dash:TextFieldEditor"), r1[Xsd_QName("test:comment")].editor)
209
+ self.assertEqual(Editor.TEXT_FIELD, r1[Xsd_QName("test:comment")].editor)
209
210
 
210
211
  def test_modification_delete(self):
211
212
  p1 = PropertyClass(con=self._connection,
@@ -216,10 +217,10 @@ class TestHasProperty(unittest.TestCase):
216
217
  hasproperties: list[HasProperty] = [
217
218
  HasProperty(con=self._connection, project=self._project, prop=p1,
218
219
  minCount=1, maxCount=1, group=Xsd_QName('test:group'), order=1,
219
- editor=Xsd_QName("dash:TextFieldEditor")),
220
+ editor=Editor.TEXT_FIELD),
220
221
  HasProperty(con=self._connection, project=self._project, prop=Xsd_QName("test:comment"),
221
222
  maxCount=1, group=Xsd_QName('test:group'), order=2,
222
- editor=Xsd_QName("dash:TextAreaEditor")),
223
+ editor=Editor.TEXT_AREA),
223
224
  ]
224
225
  r1 = ResourceClass(con=self._connection,
225
226
  project=self._project,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: oldaplib
3
- Version: 0.4.3
3
+ Version: 0.4.5
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
@@ -2,7 +2,6 @@ oldaplib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  oldaplib/ontologies/admin-testing.trig,sha256=w2I3Fk7J9MAPfRmDunFL-4dyyvsmiwderUid18uZjaA,8763
3
3
  oldaplib/ontologies/admin.trig,sha256=0pEGowW5Zjt7_Pp_Cuf_LxHixbGfkjADnbMYBHBDsoo,6759
4
4
  oldaplib/ontologies/example.trig,sha256=MdRrFBZZ1L6aUDiT6aX4cnXiy-RoZHczF3Exn7aBSmU,1518
5
- oldaplib/ontologies/gaga.trigs,sha256=4SIOyCwHXE4u2AGHWNM9rElqEkGvPQk6rZ8TAWFRPqI,544
6
5
  oldaplib/ontologies/oldap.trig,sha256=OEcjBUiTdE3SuUA0Z3F20azI8abeK1OIpKqcQo1pjvw,63764
7
6
  oldaplib/ontologies/oldap.ttl,sha256=qdA0uiSjzVhkc1d5IN2y5ioK1QMzwl-TTnn3M_D1Kh8,29446
8
7
  oldaplib/ontologies/shared.trig,sha256=8BMbhsqmnGAFUotc1bGc6morWhJqU0pCGy9TlkiEKIY,27550
@@ -21,14 +20,14 @@ oldaplib/src/dtypes/languagein.py,sha256=6h3VrTH8IcTN6mvnWuGvzDoKX_Jh6h9w3wWrLuA
21
20
  oldaplib/src/dtypes/namespaceiri.py,sha256=kbLuqS-OzWCelGkGMUP0IN43LibrTDfn4s7cm8p73Ro,2797
22
21
  oldaplib/src/dtypes/rdfset.py,sha256=1RNbjQuUknaEfj84o-AsXEJvEWs3OI6QSKe4p6aDXqc,7782
23
22
  oldaplib/src/dtypes/xsdset.py,sha256=oMFSY7JGBf0CYneoHL3OtnFIeEPaULN3FdUW7u15_I4,4256
24
- oldaplib/src/enums/XXXeditor.py,sha256=Jh4_fEKkQjm-eCbZk8eP_DOQZVwwyrXy0UyNr6s-id0,2236
25
23
  oldaplib/src/enums/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
24
  oldaplib/src/enums/action.py,sha256=aL7XXmoZ63_L2TTR37vqHpPPf5H_kYiPunNyiSDN28U,828
27
25
  oldaplib/src/enums/adminpermissions.py,sha256=nn76g2E8TIhkiVbZ64LGt81NuPwFXIDRISKBV6l9dyM,1969
28
26
  oldaplib/src/enums/attributeclass.py,sha256=CSXeL0QlLKxbk27vkPmLuFY4QjuUi5xsO9ncOUM3qds,3437
29
27
  oldaplib/src/enums/datapermissions.py,sha256=MiaVHXzNDKTGnZJ9pvs-IgQotyV4wA3X484s2RVMOvs,4104
28
+ oldaplib/src/enums/editor.py,sha256=sb7jMh7eC4pq3fEGK2ufZKwcUD84wnzGLXoRrhjp6Ro,2163
30
29
  oldaplib/src/enums/externalontologyattr.py,sha256=H7SrWrhe1Dkz_t1OFCWZVh3_14lJDltYGh3dOFr1Z6w,807
31
- oldaplib/src/enums/haspropertyattr.py,sha256=x9z2b59aFhV3gx8IVz-743dAQ_wfMTzZuN1IqnLwpBM,831
30
+ oldaplib/src/enums/haspropertyattr.py,sha256=i_KiPY9cUi8QHdYHjwPLmEMPIiJDFV8jBdT-JVFiZxA,873
32
31
  oldaplib/src/enums/language.py,sha256=OfQsFpIBj8lGBbZEqVCR_1F-bimPM48vqBl4EKBgggY,4623
33
32
  oldaplib/src/enums/oldaplistattr.py,sha256=xuOU3oP35-PFFmlI-jlN28yqdk5lp_OzScKCC1O4IDI,620
34
33
  oldaplib/src/enums/oldaplistnodeattr.py,sha256=qokSxE-0FLyWNipjjY3gZJC2bBEt1qS1Z2SFg-gb0kc,722
@@ -64,7 +63,7 @@ oldaplib/src/helpers/tools.py,sha256=sNbiOLucTGNFzZmiWwPLFOb80VTXQH0Zd9uCGubhzAk
64
63
  oldaplib/src/iconnection.py,sha256=XlOc2Kh4tK_UOHydLQwlWjUFLUze-Aq_vEZpf9KS1-s,3677
65
64
  oldaplib/src/in_project.py,sha256=ZnfeOFwpdPh1oyC2mAGH8DnSD9afxYtvsh7_GrfGVgQ,10663
66
65
  oldaplib/src/model.py,sha256=wgvXaR2GVHk4hJxoL6rigFHwjPYEukBOjtf1Jmo-m9A,19326
67
- oldaplib/src/objectfactory.py,sha256=F8QcxKdgvtrmnRcgnSwHICQYkX13HeScF7ErBzOnug4,85841
66
+ oldaplib/src/objectfactory.py,sha256=4pPzsbbjnmtAobMH4ZIazwFZVzCuOd8MZWCZ2lZgOz8,85862
68
67
  oldaplib/src/oldaplist.py,sha256=s5afrHtUnvDfMUFoZTt-jMxlBlmK2c0tLeTMp0KiIfg,43077
69
68
  oldaplib/src/oldaplist_helpers.py,sha256=D_X7KdFjPNlX-OwR04D6onxhFucrGo8052WuJPRjLkA,14213
70
69
  oldaplib/src/oldaplistnode.py,sha256=NnC2juEGTtEkDO6OlB9PjSw_zTF-wSsRUgEk-6VV9DA,87344
@@ -75,10 +74,10 @@ oldaplib/src/resourceclass.py,sha256=zJNWNY1TfhGs-A2HNa1DO0KAajps_1jMQsoEkUsr7P0
75
74
  oldaplib/src/role.py,sha256=AWtZx80OVERT2xbKeuP8g32VSXkm4MVlzeUWd9nh6mQ,30741
76
75
  oldaplib/src/user.py,sha256=iTJzSvR0xfc3FFkoKG-q5LptkWB_PGpRGpG-L3271z8,55833
77
76
  oldaplib/src/userdataclass.py,sha256=4kWktau9XSv5alfEVuOvikfxnSSUSKT8cw77TWdMhQM,13921
78
- oldaplib/src/version.py,sha256=-0DFAS3GW84dLmJEuzbtUA7qvIf_cBb4LhqSg0oFfeI,21
77
+ oldaplib/src/version.py,sha256=LHFUavV7Y99A-kKkHFv_mfCPFBihywzHsYRHNSa6xBs,21
79
78
  oldaplib/src/xsd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
80
79
  oldaplib/src/xsd/floatingpoint.py,sha256=rDReKqh0mXyc4F5wslgTUxbeGf3-PGERyughj5_62YI,8852
81
- oldaplib/src/xsd/iri.py,sha256=w1Dr0z-REi7yPe3GPGnyzGrLVMvLY03kEeK-AmZ9sxw,8383
80
+ oldaplib/src/xsd/iri.py,sha256=VrM1rgs-DKEuYLI8SUBp7QWMEZbxzxoUcvFKKfqY7mA,8454
82
81
  oldaplib/src/xsd/xsd.py,sha256=KiAIhqE7y5s7rPZWxA8eP-1Spf_saFOndNznaWOKSbM,1550
83
82
  oldaplib/src/xsd/xsd_anyuri.py,sha256=tsZfOpIlsomQubywMmXzgoX-LvtQ7hBdfP7TrGpW7Xk,6244
84
83
  oldaplib/src/xsd/xsd_base64binary.py,sha256=beHouGagNdqTxH7MHh03YKuErlHx4qSjmBrKdGB6sTU,3930
@@ -127,7 +126,7 @@ oldaplib/test/test_context.py,sha256=0qCTOOS6lKjjlZXRxXOoWeix5HnvgwcmKzOF17Fou6M
127
126
  oldaplib/test/test_datamodel.py,sha256=AHClO0KyYFGI44OBO5wA21GOQDXL8NrVsE3skhojrUo,59921
128
127
  oldaplib/test/test_dtypes.py,sha256=ifXWUc6ExAKGukyM1ziku7Xd9eehg4J7HZy9B63-aPo,8601
129
128
  oldaplib/test/test_externalontologies.py,sha256=WUPjTbklMmrM4OucPXOChyNmwFD9qdYVKkZyo0WHlP0,7797
130
- oldaplib/test/test_hasproperty.py,sha256=cU9t7uBaMxtIVbpk3UyGjPyIzQKDSS2PzqGHIINYZRw,13515
129
+ oldaplib/test/test_hasproperty.py,sha256=_cc-wH_b4c_GIDOLQxirbAS7486KC19YSUxzykf7QTw,13320
131
130
  oldaplib/test/test_in_project.py,sha256=OV5csuPwxcctmOM2HsB_ITmXXASRcH9-A2GlWW5foa4,7580
132
131
  oldaplib/test/test_langstring.py,sha256=37BeKiQzj63G-SyS_paK_SEG7ulRbGrE89Mz40UB_bE,15146
133
132
  oldaplib/test/test_language_in.py,sha256=ELqHO-YIsZSCPF3E3rWde4J7rERL7En7sV_pzQ00zgs,8826
@@ -164,6 +163,6 @@ oldaplib/testdata/source_type.yaml,sha256=dSihKikw3O-IlGf6anj5KWMoBYLaweLVF1Zojm
164
163
  oldaplib/testdata/test_move_left_of_toL.yaml,sha256=2m1OSQrQFlsCQxeJrjzBAO74LMprNDo_HuyrYGsOeXI,787
165
164
  oldaplib/testdata/testlist.yaml,sha256=AT11nXEG81Sfyb-tr1gQV0H_dZBrOCcFuHf7YtL8P2g,1994
166
165
  oldaplib/testit.http,sha256=qW7mnr6aNLXFG6lQdLgyhXILOPN6qc5iFVZclLyVvkY,303
167
- oldaplib-0.4.3.dist-info/METADATA,sha256=K5sUH-ivSkbjm9EI2IjPFsUygs_gBmRxjfEbVIWvFQ8,3035
168
- oldaplib-0.4.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
169
- oldaplib-0.4.3.dist-info/RECORD,,
166
+ oldaplib-0.4.5.dist-info/METADATA,sha256=VLeo79-yIMMJG2qmHv-s4uBvZrNntcNPYXp_RAkpLvQ,3035
167
+ oldaplib-0.4.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
168
+ oldaplib-0.4.5.dist-info/RECORD,,
@@ -1,23 +0,0 @@
1
- @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2
- @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
3
- @prefix owl: <http://www.w3.org/2002/07/owl#> .
4
-
5
- @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
6
- @prefix o: <http://www.ooo.org/ns#> .
7
-
8
- @prefix : <https://gaga.com/> .
9
-
10
- :test {
11
- :Unknown o:hasName "Unknown" .
12
-
13
- :UserA o:hasName "UserA" ;
14
- o:hasRole :Unknown .
15
-
16
- :InstanceA o:hasName "InstanceA" ;
17
- o:attachedToRole :Unknown .
18
-
19
- <<:InstanceA o:attachedToRole :Unknown>> o:hasDataPermission 2 .
20
-
21
- }
22
-
23
-