oldaplib 0.3.1__py3-none-any.whl → 0.3.3__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.
- oldaplib/src/datamodel.py +19 -19
- oldaplib/src/enums/haspropertyattr.py +2 -1
- oldaplib/src/hasproperty.py +22 -23
- oldaplib/src/helpers/Notify.py +7 -6
- oldaplib/src/helpers/irincname.py +50 -4
- oldaplib/src/helpers/observable_dict.py +4 -2
- oldaplib/src/helpers/query_processor.py +2 -1
- oldaplib/src/helpers/tools.py +11 -11
- oldaplib/src/model.py +1 -1
- oldaplib/src/objectfactory.py +22 -22
- oldaplib/src/oldaplist.py +1 -1
- oldaplib/src/permissionset.py +15 -10
- oldaplib/src/propertyclass.py +26 -27
- oldaplib/src/resourceclass.py +89 -87
- oldaplib/src/version.py +1 -1
- oldaplib/src/xsd/xsd_qname.py +21 -0
- oldaplib/test/test_datamodel.py +168 -169
- oldaplib/test/test_hasproperty.py +65 -65
- oldaplib/test/test_objectfactory.py +1 -1
- oldaplib/test/test_observable_dict.py +10 -0
- oldaplib/test/test_oldaplist.py +9 -9
- oldaplib/test/test_oldaplistnode.py +30 -30
- oldaplib/test/test_permissionset.py +14 -14
- oldaplib/test/test_project.py +4 -4
- oldaplib/test/test_propertyclass.py +89 -91
- oldaplib/test/test_resourceclass.py +342 -336
- oldaplib/test/test_user.py +8 -8
- {oldaplib-0.3.1.dist-info → oldaplib-0.3.3.dist-info}/METADATA +1 -1
- {oldaplib-0.3.1.dist-info → oldaplib-0.3.3.dist-info}/RECORD +30 -30
- {oldaplib-0.3.1.dist-info → oldaplib-0.3.3.dist-info}/WHEEL +0 -0
|
@@ -80,12 +80,12 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
80
80
|
def test_propertyclass_constructor(self):
|
|
81
81
|
p = PropertyClass(con=self._connection,
|
|
82
82
|
project=self._project,
|
|
83
|
-
property_class_iri=
|
|
84
|
-
subPropertyOf=
|
|
83
|
+
property_class_iri=Xsd_QName('test:testprop'),
|
|
84
|
+
subPropertyOf=Xsd_QName('test:comment'),
|
|
85
85
|
datatype=XsdDatatypes.string,
|
|
86
86
|
name=LangString(["Test property@en", "Testprädikat@de"]),
|
|
87
87
|
description={"A property for testing...@en", "Property für Tests@de"})
|
|
88
|
-
self.assertEqual(p.property_class_iri,
|
|
88
|
+
self.assertEqual(p.property_class_iri, Xsd_QName('test:testprop'))
|
|
89
89
|
self.assertEqual(p.get(PropClassAttr.SUBPROPERTY_OF), Iri('test:comment'))
|
|
90
90
|
self.assertEqual(p.get(PropClassAttr.DATATYPE), XsdDatatypes.string)
|
|
91
91
|
self.assertEqual(p.get(PropClassAttr.NAME), LangString(["Test property@en", "Testprädikat@de"]))
|
|
@@ -94,12 +94,12 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
94
94
|
def test_star_propertyclass_constructor(self):
|
|
95
95
|
p = PropertyClass(con=self._connection,
|
|
96
96
|
project=self._project,
|
|
97
|
-
property_class_iri=
|
|
97
|
+
property_class_iri=Xsd_QName('test:testpropstar'),
|
|
98
98
|
_statementProperty=True,
|
|
99
99
|
datatype=XsdDatatypes.string,
|
|
100
100
|
name=LangString(["Test property@en", "Testprädikat@de"]),
|
|
101
101
|
description={"A property for testing...@en", "Property für Tests@de"})
|
|
102
|
-
self.assertEqual(p.property_class_iri,
|
|
102
|
+
self.assertEqual(p.property_class_iri, Xsd_QName('test:testpropstar'))
|
|
103
103
|
self.assertTrue(p.statementProperty)
|
|
104
104
|
self.assertEqual(p.get(PropClassAttr.DATATYPE), XsdDatatypes.string)
|
|
105
105
|
self.assertEqual(p.get(PropClassAttr.NAME), LangString(["Test property@en", "Testprädikat@de"]))
|
|
@@ -108,8 +108,8 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
108
108
|
def test_propertyclass_inset_datatypes(self):
|
|
109
109
|
p = PropertyClass(con=self._connection,
|
|
110
110
|
project=self._project,
|
|
111
|
-
property_class_iri=
|
|
112
|
-
subPropertyOf=
|
|
111
|
+
property_class_iri=Xsd_QName('test:inset'),
|
|
112
|
+
subPropertyOf=Xsd_QName('test:comment'),
|
|
113
113
|
datatype=XsdDatatypes.string,
|
|
114
114
|
inSet={"AAA", "BBB", "CCC"},
|
|
115
115
|
name=LangString(["Deepcopy@en", "Tiefekopie@de"]),
|
|
@@ -118,8 +118,8 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
118
118
|
def test_propertyclass_jsonify(self):
|
|
119
119
|
p = PropertyClass(con=self._connection,
|
|
120
120
|
project=self._project,
|
|
121
|
-
property_class_iri=
|
|
122
|
-
subPropertyOf=
|
|
121
|
+
property_class_iri=Xsd_QName('test:deepcopy'),
|
|
122
|
+
subPropertyOf=Xsd_QName('test:comment'),
|
|
123
123
|
datatype=XsdDatatypes.string,
|
|
124
124
|
inSet=XsdSet(Xsd_string("AAA"), Xsd_string("BBB"), Xsd_string("CCC")),
|
|
125
125
|
name=LangString(["Deepcopy@en", "Tiefekopie@de"]),
|
|
@@ -132,8 +132,8 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
132
132
|
def test_propertyclass_deepcopy(self):
|
|
133
133
|
p = PropertyClass(con=self._connection,
|
|
134
134
|
project=self._project,
|
|
135
|
-
property_class_iri=
|
|
136
|
-
subPropertyOf=
|
|
135
|
+
property_class_iri=Xsd_QName('test:deepcopy'),
|
|
136
|
+
subPropertyOf=Xsd_QName('test:comment'),
|
|
137
137
|
datatype=XsdDatatypes.string,
|
|
138
138
|
inSet=XsdSet(Xsd_string("AAA"), Xsd_string("BBB"), Xsd_string("CCC")),
|
|
139
139
|
name=LangString(["Deepcopy@en", "Tiefekopie@de"]),
|
|
@@ -164,31 +164,31 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
164
164
|
def test_propertyclass_toclass_constructor(self):
|
|
165
165
|
p2 = PropertyClass(con=self._connection,
|
|
166
166
|
project=self._project,
|
|
167
|
-
toClass=
|
|
167
|
+
toClass=Xsd_QName('test:Person'))
|
|
168
168
|
self.assertEqual(p2.get(PropClassAttr.CLASS), Xsd_QName('test:Person'))
|
|
169
169
|
|
|
170
170
|
def test_propertyclass_toclass_constructor_invalid_A(self):
|
|
171
171
|
with self.assertRaises(OldapErrorValue):
|
|
172
172
|
p2 = PropertyClass(con=self._connection,
|
|
173
173
|
project=self._project,
|
|
174
|
-
toClass=
|
|
174
|
+
toClass=Xsd_QName('rdf:Person'))
|
|
175
175
|
|
|
176
176
|
with self.assertRaises(OldapErrorValue):
|
|
177
177
|
p2 = PropertyClass(con=self._connection,
|
|
178
178
|
project=self._project,
|
|
179
|
-
toClass=
|
|
179
|
+
toClass=Xsd_QName('xml:Person'))
|
|
180
180
|
|
|
181
181
|
def test_propertyclass_toclass_constructor_invalid_B(self):
|
|
182
182
|
with self.assertRaises(OldapErrorValue):
|
|
183
183
|
p2 = PropertyClass(con=self._connection,
|
|
184
184
|
project=self._project,
|
|
185
|
-
toClass=
|
|
185
|
+
toClass=Xsd_QName('gaga:Person'))
|
|
186
186
|
|
|
187
187
|
|
|
188
188
|
def test_propertyclass_datatype_constructor(self):
|
|
189
189
|
p3 = PropertyClass(con=self._connection,
|
|
190
190
|
project=self._project,
|
|
191
|
-
property_class_iri=
|
|
191
|
+
property_class_iri=Xsd_QName('test:testprop3'),
|
|
192
192
|
datatype=XsdDatatypes.string,
|
|
193
193
|
inSet=RdfSet(Xsd_string('yes'), Xsd_string('may be'), Xsd_string('no')))
|
|
194
194
|
self.assertEqual(p3.property_class_iri, Xsd_QName('test:testprop3'))
|
|
@@ -198,7 +198,7 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
198
198
|
def test_propertyclass_languagein_constructor(self):
|
|
199
199
|
p4 = PropertyClass(con=self._connection,
|
|
200
200
|
project=self._project,
|
|
201
|
-
property_class_iri=
|
|
201
|
+
property_class_iri=Xsd_QName('test:testprop4'),
|
|
202
202
|
languageIn=LanguageIn(Language.EN, Language.DE, Language.FR))
|
|
203
203
|
self.assertEqual(p4.property_class_iri, Xsd_QName('test:testprop4'))
|
|
204
204
|
self.assertEqual(p4.get(PropClassAttr.LANGUAGE_IN), LanguageIn(Language.EN, Language.DE, Language.FR))
|
|
@@ -206,7 +206,7 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
206
206
|
|
|
207
207
|
p4a = PropertyClass(con=self._connection,
|
|
208
208
|
project=self._project,
|
|
209
|
-
property_class_iri=
|
|
209
|
+
property_class_iri=Xsd_QName('test:testprop4a'),
|
|
210
210
|
languageIn={'en', 'fr'})
|
|
211
211
|
self.assertEqual(p4a.property_class_iri, Xsd_QName('test:testprop4a'))
|
|
212
212
|
self.assertEqual(p4a.get(PropClassAttr.LANGUAGE_IN), LanguageIn(Language.EN, Language.FR))
|
|
@@ -216,7 +216,7 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
216
216
|
with self.assertRaises(OldapErrorValue):
|
|
217
217
|
p5 = PropertyClass(con=self._connection,
|
|
218
218
|
project=self._project,
|
|
219
|
-
property_class_iri=
|
|
219
|
+
property_class_iri=Xsd_QName('test:testprop5'),
|
|
220
220
|
datatype=XsdDatatypes.string,
|
|
221
221
|
languageIn=LanguageIn(Language.EN, Language.DE, Language.FR))
|
|
222
222
|
|
|
@@ -224,14 +224,14 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
224
224
|
with self.assertRaises(OldapErrorInconsistency):
|
|
225
225
|
px = PropertyClass(con=self._connection,
|
|
226
226
|
project=self._project,
|
|
227
|
-
property_class_iri=
|
|
228
|
-
toClass=
|
|
227
|
+
property_class_iri=Xsd_QName('test:testpropX'),
|
|
228
|
+
toClass=Xsd_QName('test:comment'),
|
|
229
229
|
minLength=42)
|
|
230
230
|
|
|
231
231
|
def test_propertyclass_projectsn_constructor(self):
|
|
232
232
|
p6 = PropertyClass(con=self._connection,
|
|
233
233
|
project="test",
|
|
234
|
-
property_class_iri=
|
|
234
|
+
property_class_iri=Xsd_QName('test:testprop6'),
|
|
235
235
|
languageIn=LanguageIn(Language.EN, Language.DE, Language.FR))
|
|
236
236
|
self.assertEqual(p6.property_class_iri, Xsd_QName('test:testprop6'))
|
|
237
237
|
self.assertEqual(p6.get(PropClassAttr.LANGUAGE_IN), LanguageIn(Language.EN, Language.DE, Language.FR))
|
|
@@ -242,9 +242,9 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
242
242
|
def test_propertyclass_read_shacl(self):
|
|
243
243
|
p1 = PropertyClass.read(con=self._connection,
|
|
244
244
|
project=self._project,
|
|
245
|
-
property_class_iri=
|
|
245
|
+
property_class_iri=Xsd_QName('test:comment'),
|
|
246
246
|
ignore_cache=True)
|
|
247
|
-
self.assertEqual(p1.property_class_iri,
|
|
247
|
+
self.assertEqual(p1.property_class_iri, Xsd_QName('test:comment'))
|
|
248
248
|
self.assertEqual(p1.get(PropClassAttr.DATATYPE), XsdDatatypes.langString)
|
|
249
249
|
self.assertEqual(p1.datatype, XsdDatatypes.langString)
|
|
250
250
|
self.assertTrue(p1.get(PropClassAttr.UNIQUE_LANG))
|
|
@@ -262,9 +262,9 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
262
262
|
|
|
263
263
|
p2 = PropertyClass.read(con=self._connection,
|
|
264
264
|
project=self._project,
|
|
265
|
-
property_class_iri=
|
|
265
|
+
property_class_iri=Xsd_QName('test:test'),
|
|
266
266
|
ignore_cache=True)
|
|
267
|
-
self.assertEqual(p2.property_class_iri,
|
|
267
|
+
self.assertEqual(p2.property_class_iri, Xsd_QName('test:test'))
|
|
268
268
|
self.assertEqual(p2[PropClassAttr.NAME], LangString("Test"))
|
|
269
269
|
self.assertEqual(p2[PropClassAttr.DESCRIPTION], LangString("Property shape for testing purposes"))
|
|
270
270
|
self.assertEqual(p2[PropClassAttr.DATATYPE], XsdDatatypes.string)
|
|
@@ -272,7 +272,7 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
272
272
|
|
|
273
273
|
p3 = PropertyClass.read(con=self._connection,
|
|
274
274
|
project=self._project,
|
|
275
|
-
property_class_iri=
|
|
275
|
+
property_class_iri=Xsd_QName('test:enum'),
|
|
276
276
|
ignore_cache=True)
|
|
277
277
|
self.assertEqual(p3[PropClassAttr.IN],
|
|
278
278
|
{"very good", "good", "fair", "insufficient"})
|
|
@@ -284,8 +284,8 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
284
284
|
p1 = PropertyClass(
|
|
285
285
|
con=self._connection,
|
|
286
286
|
project=self._project,
|
|
287
|
-
property_class_iri=
|
|
288
|
-
toClass=
|
|
287
|
+
property_class_iri=Xsd_QName('test:testWrite'),
|
|
288
|
+
toClass=Xsd_QName('test:comment'),
|
|
289
289
|
name=LangString("Annotations@en"),
|
|
290
290
|
description=LangString("An annotation@en"),
|
|
291
291
|
inSet=RdfSet(Iri("http://www.test.org/comment1"), Iri("http://www.test.org/comment2"))
|
|
@@ -293,10 +293,10 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
293
293
|
p1.create()
|
|
294
294
|
p1 = PropertyClass.read(con=self._connection,
|
|
295
295
|
project=self._project,
|
|
296
|
-
property_class_iri=
|
|
296
|
+
property_class_iri=Xsd_QName('test:testWrite'),
|
|
297
297
|
ignore_cache=True)
|
|
298
|
-
self.assertEqual(p1.property_class_iri,
|
|
299
|
-
self.assertEqual(p1[PropClassAttr.CLASS],
|
|
298
|
+
self.assertEqual(p1.property_class_iri, Xsd_QName('test:testWrite'))
|
|
299
|
+
self.assertEqual(p1[PropClassAttr.CLASS], Xsd_QName('test:comment'))
|
|
300
300
|
self.assertEqual(p1[PropClassAttr.NAME], LangString("Annotations@en"))
|
|
301
301
|
self.assertEqual(p1[PropClassAttr.DESCRIPTION], LangString("An annotation@en"))
|
|
302
302
|
self.assertEqual(p1[PropClassAttr.IN],
|
|
@@ -306,7 +306,7 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
306
306
|
p2 = PropertyClass(
|
|
307
307
|
con=self._connection,
|
|
308
308
|
project=self._project,
|
|
309
|
-
property_class_iri=
|
|
309
|
+
property_class_iri=Xsd_QName('test:testWrite2'),
|
|
310
310
|
name=LangString("Annotations@en"),
|
|
311
311
|
description=LangString("An annotation@en"),
|
|
312
312
|
languageIn=LanguageIn(Language.EN, Language.DE, Language.FR, Language.IT),
|
|
@@ -315,9 +315,9 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
315
315
|
p2.create()
|
|
316
316
|
p2 = PropertyClass.read(con=self._connection,
|
|
317
317
|
project=self._project,
|
|
318
|
-
property_class_iri=
|
|
318
|
+
property_class_iri=Xsd_QName('test:testWrite2'),
|
|
319
319
|
ignore_cache=True)
|
|
320
|
-
self.assertEqual(p2.property_class_iri,
|
|
320
|
+
self.assertEqual(p2.property_class_iri, Xsd_QName('test:testWrite2'))
|
|
321
321
|
self.assertEqual(p2[PropClassAttr.DATATYPE], XsdDatatypes.langString)
|
|
322
322
|
self.assertEqual(p2[PropClassAttr.NAME], LangString("Annotations@en"))
|
|
323
323
|
self.assertEqual(p2[PropClassAttr.DESCRIPTION], LangString("An annotation@en"))
|
|
@@ -328,14 +328,14 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
328
328
|
p3 = PropertyClass(
|
|
329
329
|
con=self._connection,
|
|
330
330
|
project=self._project,
|
|
331
|
-
property_class_iri=
|
|
331
|
+
property_class_iri=Xsd_QName('test:testWrite3'),
|
|
332
332
|
datatype=XsdDatatypes.string,
|
|
333
333
|
pattern=r"^[\w\.-]+@[a-zA-Z\d-]+(\.[a-zA-Z\d-]+)*\.[a-zA-Z]{2,}$"
|
|
334
334
|
)
|
|
335
335
|
p3.create()
|
|
336
336
|
p3 = PropertyClass.read(con=self._connection,
|
|
337
337
|
project=self._project,
|
|
338
|
-
property_class_iri=
|
|
338
|
+
property_class_iri=Xsd_QName('test:testWrite3'),
|
|
339
339
|
ignore_cache=True)
|
|
340
340
|
self.assertEqual(p3.pattern, r"^[\w\.-]+@[a-zA-Z\d-]+(\.[a-zA-Z\d-]+)*\.[a-zA-Z]{2,}$")
|
|
341
341
|
|
|
@@ -344,7 +344,7 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
344
344
|
con=self._connection,
|
|
345
345
|
#graph=Xsd_NCName('test'),
|
|
346
346
|
project=self._project,
|
|
347
|
-
property_class_iri=
|
|
347
|
+
property_class_iri=Xsd_QName('test:testWrite'),
|
|
348
348
|
datatype=XsdDatatypes.int
|
|
349
349
|
)
|
|
350
350
|
with self.assertRaises(OldapErrorAlreadyExists) as ex:
|
|
@@ -355,14 +355,14 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
355
355
|
p = PropertyClass(
|
|
356
356
|
con=self._connection,
|
|
357
357
|
project=self._project,
|
|
358
|
-
property_class_iri=
|
|
358
|
+
property_class_iri=Xsd_QName('test:testWriteStar'),
|
|
359
359
|
_statementProperty=True,
|
|
360
360
|
datatype=XsdDatatypes.string,
|
|
361
361
|
)
|
|
362
362
|
p.create()
|
|
363
363
|
p = PropertyClass.read(con=self._connection,
|
|
364
364
|
project=self._project,
|
|
365
|
-
property_class_iri=
|
|
365
|
+
property_class_iri=Xsd_QName('test:testWriteStar'),
|
|
366
366
|
ignore_cache=True)
|
|
367
367
|
self.assertTrue(p.statementProperty)
|
|
368
368
|
self.assertEqual(p.get(PropClassAttr.DATATYPE), XsdDatatypes.string)
|
|
@@ -371,8 +371,8 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
371
371
|
p1 = PropertyClass(
|
|
372
372
|
con=self._unpriv,
|
|
373
373
|
project=self._project,
|
|
374
|
-
property_class_iri=
|
|
375
|
-
toClass=
|
|
374
|
+
property_class_iri=Xsd_QName('test:testCreateNoPerm'),
|
|
375
|
+
toClass=Xsd_QName('test:comment'),
|
|
376
376
|
name=LangString("NoPerm@en"),
|
|
377
377
|
description=LangString("NoPerm@en")
|
|
378
378
|
)
|
|
@@ -384,8 +384,8 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
384
384
|
p1 = PropertyClass(
|
|
385
385
|
con=self._connection,
|
|
386
386
|
project=self._project,
|
|
387
|
-
property_class_iri=
|
|
388
|
-
toClass=
|
|
387
|
+
property_class_iri=Xsd_QName('test:testCache'),
|
|
388
|
+
toClass=Xsd_QName('test:comment'),
|
|
389
389
|
name=LangString("Annotations@en"),
|
|
390
390
|
description=LangString("An annotation@en"),
|
|
391
391
|
inSet=RdfSet(Iri("http://www.test.org/comment1"), Iri("http://www.test.org/comment2"))
|
|
@@ -393,7 +393,7 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
393
393
|
p1.create()
|
|
394
394
|
p2 = PropertyClass.read(con=self._connection,
|
|
395
395
|
project=self._project,
|
|
396
|
-
property_class_iri=
|
|
396
|
+
property_class_iri=Xsd_QName('test:testCache'))
|
|
397
397
|
self.assertFalse(p1 is p2)
|
|
398
398
|
self.assertEqual(p1.property_class_iri, p2.property_class_iri)
|
|
399
399
|
self.assertEqual(p1.toClass, p2.toClass)
|
|
@@ -410,7 +410,7 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
410
410
|
p1 = PropertyClass(
|
|
411
411
|
con=self._connection,
|
|
412
412
|
project=self._project,
|
|
413
|
-
property_class_iri=
|
|
413
|
+
property_class_iri=Xsd_QName('test:testUndo'),
|
|
414
414
|
datatype=XsdDatatypes.langString,
|
|
415
415
|
name=LangString(["Annotations@en", "Annotationen@de"]),
|
|
416
416
|
languageIn=LanguageIn(Language.EN, Language.DE),
|
|
@@ -455,13 +455,13 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
455
455
|
p1 = PropertyClass(
|
|
456
456
|
con=self._connection,
|
|
457
457
|
project=self._project,
|
|
458
|
-
property_class_iri=
|
|
459
|
-
toClass=
|
|
458
|
+
property_class_iri=Xsd_QName('test:testUndo'),
|
|
459
|
+
toClass=Xsd_QName('test:TestObject'),
|
|
460
460
|
name=LangString(["Annotations@en", "Annotationen@de"]),
|
|
461
461
|
inSet=XsdSet(Iri("http://www.test.org/comment1"),
|
|
462
462
|
Iri("http://www.test.org/comment2"),
|
|
463
463
|
Iri("http://www.test.org/comment3")))
|
|
464
|
-
self.assertEqual(p1.get(PropClassAttr.CLASS),
|
|
464
|
+
self.assertEqual(p1.get(PropClassAttr.CLASS), Xsd_QName('test:TestObject'))
|
|
465
465
|
self.assertEqual(p1[PropClassAttr.NAME], LangString(["Annotations@en", "Annotationen@de"]))
|
|
466
466
|
self.assertEqual(p1[PropClassAttr.IN],
|
|
467
467
|
XsdSet(Iri("http://www.test.org/comment1"),
|
|
@@ -475,7 +475,7 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
475
475
|
self.assertEqual(p1[PropClassAttr.NAME], LangString(["Annotationen@de", "Annotations en Français@fr"]))
|
|
476
476
|
self.assertEqual(p1[PropClassAttr.IN], XsdSet(Iri("http://google.com"), Iri("https://google.com")))
|
|
477
477
|
p1.undo()
|
|
478
|
-
self.assertEqual(p1.get(PropClassAttr.CLASS),
|
|
478
|
+
self.assertEqual(p1.get(PropClassAttr.CLASS), Xsd_QName('test:TestObject'))
|
|
479
479
|
self.assertEqual(p1[PropClassAttr.NAME], LangString(["Annotations@en", "Annotationen@de"]))
|
|
480
480
|
self.assertEqual(p1[PropClassAttr.IN],
|
|
481
481
|
XsdSet(Iri("http://www.test.org/comment1"),
|
|
@@ -492,7 +492,9 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
492
492
|
p1.undo(PropClassAttr.DESCRIPTION)
|
|
493
493
|
self.assertIsNone(p1.get(PropClassAttr.DESCRIPTION))
|
|
494
494
|
p1.undo(PropClassAttr.IN)
|
|
495
|
-
self.assertEqual(p1[PropClassAttr.IN], RdfSet(Iri("http://www.test.org/comment1"),
|
|
495
|
+
self.assertEqual(p1[PropClassAttr.IN], RdfSet(Iri("http://www.test.org/comment1"),
|
|
496
|
+
Iri("http://www.test.org/comment2"),
|
|
497
|
+
Iri("http://www.test.org/comment3")))
|
|
496
498
|
self.assertEqual(p1.changeset, {})
|
|
497
499
|
|
|
498
500
|
|
|
@@ -500,16 +502,16 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
500
502
|
con=self._connection,
|
|
501
503
|
#graph=Xsd_NCName('test'),
|
|
502
504
|
project=self._project,
|
|
503
|
-
property_class_iri=
|
|
504
|
-
toClass=
|
|
505
|
+
property_class_iri=Xsd_QName('test:testUndo'),
|
|
506
|
+
toClass=Xsd_QName('test:testUndo42'),
|
|
505
507
|
inSet={'test:testUndo42', 'test:UP4014'}
|
|
506
508
|
)
|
|
507
|
-
p1.toClass =
|
|
509
|
+
p1.toClass = Xsd_QName('test:UP4014')
|
|
508
510
|
p1.inSet.add('test:RGW168')
|
|
509
|
-
self.assertEqual(p1.toClass,
|
|
511
|
+
self.assertEqual(p1.toClass, Xsd_QName('test:UP4014'))
|
|
510
512
|
self.assertEqual(p1.inSet, {'test:testUndo42', 'test:UP4014', 'test:RGW168'})
|
|
511
513
|
p1.undo()
|
|
512
|
-
self.assertEqual(p1.toClass,
|
|
514
|
+
self.assertEqual(p1.toClass, Xsd_QName('test:testUndo42'))
|
|
513
515
|
self.assertEqual(p1.inSet, {'test:testUndo42', 'test:UP4014'})
|
|
514
516
|
|
|
515
517
|
|
|
@@ -518,8 +520,8 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
518
520
|
p1 = PropertyClass(
|
|
519
521
|
con=self._connection,
|
|
520
522
|
project=self._project,
|
|
521
|
-
property_class_iri=
|
|
522
|
-
subPropertyOf=
|
|
523
|
+
property_class_iri=Xsd_QName('test:testUpdate'),
|
|
524
|
+
subPropertyOf=Xsd_QName('test:masterProp'),
|
|
523
525
|
datatype=XsdDatatypes.langString,
|
|
524
526
|
name=LangString("Annotations@en"),
|
|
525
527
|
description=LangString("An annotation@en"),
|
|
@@ -528,7 +530,7 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
528
530
|
)
|
|
529
531
|
p1.create()
|
|
530
532
|
|
|
531
|
-
p1[PropClassAttr.SUBPROPERTY_OF] =
|
|
533
|
+
p1[PropClassAttr.SUBPROPERTY_OF] = Xsd_QName('test:masterProp2')
|
|
532
534
|
p1[PropClassAttr.NAME][Language.DE] = 'Annotationen'
|
|
533
535
|
p1[PropClassAttr.UNIQUE_LANG] = Xsd_boolean(False)
|
|
534
536
|
p1[PropClassAttr.IN] = RdfSet(Xsd_string("gaga"), Xsd_string("is was"))
|
|
@@ -536,7 +538,7 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
536
538
|
self.assertEqual(p1.changeset, {
|
|
537
539
|
PropClassAttr.NAME: AttributeChange(None, Action.MODIFY),
|
|
538
540
|
# PropClassAttr.LANGUAGE_IN: PropClassAttrChange(LanguageIn(Language.EN, Language.DE, Language.FR, Language.IT), Action.REPLACE, True),
|
|
539
|
-
PropClassAttr.SUBPROPERTY_OF: AttributeChange(
|
|
541
|
+
PropClassAttr.SUBPROPERTY_OF: AttributeChange(Xsd_QName('test:masterProp'), Action.REPLACE),
|
|
540
542
|
PropClassAttr.UNIQUE_LANG: AttributeChange(Xsd_boolean(True), Action.REPLACE),
|
|
541
543
|
PropClassAttr.IN: AttributeChange(None, Action.CREATE),
|
|
542
544
|
})
|
|
@@ -545,10 +547,10 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
545
547
|
|
|
546
548
|
p2 = PropertyClass.read(con=self._connection,
|
|
547
549
|
project=self._project,
|
|
548
|
-
property_class_iri=
|
|
550
|
+
property_class_iri=Xsd_QName('test:testUpdate'),
|
|
549
551
|
ignore_cache=True)
|
|
550
|
-
self.assertEqual(p2.property_class_iri,
|
|
551
|
-
self.assertEqual(p2.subPropertyOf,
|
|
552
|
+
self.assertEqual(p2.property_class_iri, Xsd_QName('test:testUpdate'))
|
|
553
|
+
self.assertEqual(p2.subPropertyOf, Xsd_QName('test:masterProp2'))
|
|
552
554
|
self.assertEqual(p2[PropClassAttr.DATATYPE], XsdDatatypes.langString)
|
|
553
555
|
self.assertIsNone(p2.get(PropClassAttr.CLASS))
|
|
554
556
|
self.assertEqual(p2[PropClassAttr.NAME], LangString(["Annotations@en", "Annotationen@de"]))
|
|
@@ -562,7 +564,7 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
562
564
|
p1 = PropertyClass(
|
|
563
565
|
con=self._connection,
|
|
564
566
|
project=self._project,
|
|
565
|
-
property_class_iri=
|
|
567
|
+
property_class_iri=Xsd_QName('test:testUpdate2'),
|
|
566
568
|
name=LangString("Annotations@en"),
|
|
567
569
|
description=LangString("An annotation@en"),
|
|
568
570
|
datatype=XsdDatatypes.langString,
|
|
@@ -587,9 +589,9 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
587
589
|
p2 = PropertyClass.read(con=self._connection,
|
|
588
590
|
#graph=Xsd_NCName('test'),
|
|
589
591
|
project=self._project,
|
|
590
|
-
property_class_iri=
|
|
592
|
+
property_class_iri=Xsd_QName('test:testUpdate2'),
|
|
591
593
|
ignore_cache=True)
|
|
592
|
-
self.assertEqual(p2.property_class_iri,
|
|
594
|
+
self.assertEqual(p2.property_class_iri, Xsd_QName('test:testUpdate2'))
|
|
593
595
|
self.assertEqual(p2.datatype, XsdDatatypes.langString)
|
|
594
596
|
self.assertIsNone(p2.toClass)
|
|
595
597
|
self.assertEqual(p2.name, LangString(["Annotations@en", "Annotationen@de"]))
|
|
@@ -603,7 +605,7 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
603
605
|
p1 = PropertyClass(
|
|
604
606
|
con=self._connection,
|
|
605
607
|
project=self._project,
|
|
606
|
-
property_class_iri=
|
|
608
|
+
property_class_iri=Xsd_QName('test:testUpdate3'),
|
|
607
609
|
name=LangString("Annotations@en"),
|
|
608
610
|
description=LangString("An annotation@en"),
|
|
609
611
|
datatype=XsdDatatypes.langString,
|
|
@@ -616,9 +618,9 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
616
618
|
|
|
617
619
|
p1 = PropertyClass.read(con=self._connection,
|
|
618
620
|
project=self._project,
|
|
619
|
-
property_class_iri=
|
|
621
|
+
property_class_iri=Xsd_QName('test:testUpdate3'),
|
|
620
622
|
ignore_cache=True)
|
|
621
|
-
self.assertEqual(p1.property_class_iri,
|
|
623
|
+
self.assertEqual(p1.property_class_iri, Xsd_QName('test:testUpdate3'))
|
|
622
624
|
self.assertEqual(p1.datatype, XsdDatatypes.langString)
|
|
623
625
|
self.assertEqual(p1.minLength, 2)
|
|
624
626
|
self.assertEqual(p1.maxLength, 10)
|
|
@@ -634,11 +636,11 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
634
636
|
|
|
635
637
|
p2 = PropertyClass.read(con=self._connection,
|
|
636
638
|
project=self._project,
|
|
637
|
-
property_class_iri=
|
|
639
|
+
property_class_iri=Xsd_QName('test:testUpdate3'),
|
|
638
640
|
ignore_cache=True)
|
|
639
|
-
self.assertEqual(p2.property_class_iri,
|
|
641
|
+
self.assertEqual(p2.property_class_iri, Xsd_QName('test:testUpdate3'))
|
|
640
642
|
self.assertIsNone(p2.datatype)
|
|
641
|
-
self.assertEqual(p2.toClass,
|
|
643
|
+
self.assertEqual(p2.toClass, Xsd_QName('test:masterProp3'))
|
|
642
644
|
self.assertEqual(p2.name, LangString(["Annotations@en"]))
|
|
643
645
|
self.assertEqual(p2.description, LangString("An annotation@en"))
|
|
644
646
|
self.assertIsNone(p2.languageIn)
|
|
@@ -648,16 +650,16 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
648
650
|
p1 = PropertyClass(
|
|
649
651
|
con=self._connection,
|
|
650
652
|
project=self._project,
|
|
651
|
-
property_class_iri=
|
|
653
|
+
property_class_iri=Xsd_QName('test:testUpdate4'),
|
|
652
654
|
name=LangString("Annotations@en"),
|
|
653
655
|
description=LangString("An annotation@en"),
|
|
654
|
-
toClass=
|
|
656
|
+
toClass=Xsd_QName('test:masterProp4')
|
|
655
657
|
)
|
|
656
658
|
p1.create()
|
|
657
659
|
|
|
658
660
|
p1 = PropertyClass.read(con=self._connection,
|
|
659
661
|
project=self._project,
|
|
660
|
-
property_class_iri=
|
|
662
|
+
property_class_iri=Xsd_QName('test:testUpdate4'),
|
|
661
663
|
ignore_cache=True)
|
|
662
664
|
p1.datatype = XsdDatatypes.string
|
|
663
665
|
p1.maxLength = 100
|
|
@@ -667,7 +669,7 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
667
669
|
|
|
668
670
|
p2 = PropertyClass.read(con=self._connection,
|
|
669
671
|
project=self._project,
|
|
670
|
-
property_class_iri=
|
|
672
|
+
property_class_iri=Xsd_QName('test:testUpdate4'),
|
|
671
673
|
ignore_cache=True)
|
|
672
674
|
self.assertEqual(p2.datatype, XsdDatatypes.string)
|
|
673
675
|
self.assertEqual(p2.maxLength, 100)
|
|
@@ -681,7 +683,7 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
681
683
|
p1 = PropertyClass(
|
|
682
684
|
con=self._connection,
|
|
683
685
|
project=self._project,
|
|
684
|
-
property_class_iri=
|
|
686
|
+
property_class_iri=Xsd_QName('test:testUpdate5'),
|
|
685
687
|
datatype=XsdDatatypes.string,
|
|
686
688
|
name=LangString(["name english@en", "nom français@fr"]),
|
|
687
689
|
description=LangString("description english@en", "description français@fr"),
|
|
@@ -690,7 +692,7 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
690
692
|
|
|
691
693
|
p1 = PropertyClass.read(con=self._connection,
|
|
692
694
|
project=self._project,
|
|
693
|
-
property_class_iri=
|
|
695
|
+
property_class_iri=Xsd_QName('test:testUpdate5'),
|
|
694
696
|
ignore_cache=True)
|
|
695
697
|
p1.name[Language.DE] = "name deutsch"
|
|
696
698
|
p1.description[Language.DE] = "description deutsch"
|
|
@@ -715,7 +717,7 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
715
717
|
p1 = PropertyClass(
|
|
716
718
|
con=self._connection,
|
|
717
719
|
project=self._project,
|
|
718
|
-
property_class_iri=
|
|
720
|
+
property_class_iri=Xsd_QName('test:testUpdate6'),
|
|
719
721
|
datatype=XsdDatatypes.string,
|
|
720
722
|
name=LangString(["name english@en", "nom français@fr"]),
|
|
721
723
|
)
|
|
@@ -726,7 +728,7 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
726
728
|
|
|
727
729
|
p1 = PropertyClass.read(con=self._connection,
|
|
728
730
|
project=self._project,
|
|
729
|
-
property_class_iri=
|
|
731
|
+
property_class_iri=Xsd_QName('test:testUpdate6'),
|
|
730
732
|
ignore_cache=True)
|
|
731
733
|
|
|
732
734
|
#
|
|
@@ -761,16 +763,12 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
761
763
|
for r in res:
|
|
762
764
|
self.assertIn(r['comment'], [Xsd_string("description english@en"), Xsd_string("description français@fr")])
|
|
763
765
|
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
766
|
# @unittest.skip('Work in progress')
|
|
769
767
|
def test_propertyclass_delete_attrs(self):
|
|
770
768
|
p1 = PropertyClass(
|
|
771
769
|
con=self._connection,
|
|
772
770
|
project=self._project,
|
|
773
|
-
property_class_iri=
|
|
771
|
+
property_class_iri=Xsd_QName('test:testDelete'),
|
|
774
772
|
name=LangString(["Annotations@en", "Annotationen@de"]),
|
|
775
773
|
description=LangString("An annotation@en"),
|
|
776
774
|
languageIn=LanguageIn(Language.ZU, Language.CY, Language.SV, Language.RM),
|
|
@@ -786,7 +784,7 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
786
784
|
|
|
787
785
|
p2 = PropertyClass.read(con=self._connection,
|
|
788
786
|
project=self._project,
|
|
789
|
-
property_class_iri=
|
|
787
|
+
property_class_iri=Xsd_QName('test:testDelete'),
|
|
790
788
|
ignore_cache=True)
|
|
791
789
|
self.assertIsNone(p2.name)
|
|
792
790
|
self.assertIsNone(p2.uniqueLang)
|
|
@@ -814,7 +812,7 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
814
812
|
p1 = PropertyClass(
|
|
815
813
|
con=self._connection,
|
|
816
814
|
project=self._project,
|
|
817
|
-
property_class_iri=
|
|
815
|
+
property_class_iri=Xsd_QName('test:testDeleteIt'),
|
|
818
816
|
name=LangString(["Annotations@en", "Annotationen@de"]),
|
|
819
817
|
description=LangString("An annotation@en"),
|
|
820
818
|
languageIn=LanguageIn(Language.ZU, Language.CY, Language.SV, Language.RM),
|
|
@@ -824,7 +822,7 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
824
822
|
|
|
825
823
|
p2 = PropertyClass.read(con=self._connection,
|
|
826
824
|
project=self._project,
|
|
827
|
-
property_class_iri=
|
|
825
|
+
property_class_iri=Xsd_QName('test:testDeleteIt'),
|
|
828
826
|
ignore_cache=True)
|
|
829
827
|
p2.delete()
|
|
830
828
|
sparql = self._context.sparql_context
|
|
@@ -850,7 +848,7 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
850
848
|
p1 = PropertyClass(
|
|
851
849
|
con=self._connection,
|
|
852
850
|
project=self._project,
|
|
853
|
-
property_class_iri=
|
|
851
|
+
property_class_iri=Xsd_QName('test:testDeleteIt2'),
|
|
854
852
|
toClass=Iri('test:comment'),
|
|
855
853
|
name=LangString(["Annotations@en", "Annotationen@de"]),
|
|
856
854
|
description=LangString("An annotation@en"),
|
|
@@ -860,7 +858,7 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
860
858
|
|
|
861
859
|
p2 = PropertyClass.read(con=self._connection,
|
|
862
860
|
project=self._project,
|
|
863
|
-
property_class_iri=
|
|
861
|
+
property_class_iri=Xsd_QName('test:testDeleteIt2'),
|
|
864
862
|
ignore_cache=True)
|
|
865
863
|
p2.delete()
|
|
866
864
|
sparql = self._context.sparql_context
|
|
@@ -887,7 +885,7 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
887
885
|
p1 = PropertyClass(
|
|
888
886
|
con=self._connection,
|
|
889
887
|
project=self._project,
|
|
890
|
-
property_class_iri=
|
|
888
|
+
property_class_iri=Xsd_QName('test:testWriteIt'),
|
|
891
889
|
toClass=Iri('test:comment'),
|
|
892
890
|
name=LangString(["Annotations@en", "Annotationen@de"]),
|
|
893
891
|
description=LangString("An annotation@en"),
|