oldaplib 0.3.3__py3-none-any.whl → 0.3.4__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/ontologies/admin-testing.trig +2 -4
- oldaplib/ontologies/admin.trig +2 -4
- oldaplib/ontologies/oldap.trig +221 -131
- oldaplib/ontologies/shared.trig +0 -3
- oldaplib/src/datamodel.py +109 -17
- oldaplib/src/dtypes/namespaceiri.py +16 -1
- oldaplib/src/enums/externalontologyattr.py +22 -0
- oldaplib/src/enums/owlpropertytype.py +10 -0
- oldaplib/src/enums/projectattr.py +0 -1
- oldaplib/src/enums/propertyclassattr.py +3 -1
- oldaplib/src/externalontology.py +554 -0
- oldaplib/src/hasproperty.py +5 -0
- oldaplib/src/helpers/context.py +4 -4
- oldaplib/src/helpers/langstring.py +11 -2
- oldaplib/src/helpers/observable_dict.py +4 -1
- oldaplib/src/helpers/observable_set.py +135 -80
- oldaplib/src/helpers/query_processor.py +3 -0
- oldaplib/src/model.py +1 -1
- oldaplib/src/oldaplist.py +2 -2
- oldaplib/src/oldaplistnode.py +2 -2
- oldaplib/src/permissionset.py +3 -3
- oldaplib/src/project.py +47 -113
- oldaplib/src/propertyclass.py +64 -24
- oldaplib/src/resourceclass.py +7 -5
- oldaplib/src/version.py +1 -1
- oldaplib/src/xsd/iri.py +3 -0
- oldaplib/src/xsd/xsd_anyuri.py +5 -5
- oldaplib/src/xsd/xsd_qname.py +5 -2
- oldaplib/test/test_context.py +0 -4
- oldaplib/test/test_datamodel.py +50 -1
- oldaplib/test/test_dtypes.py +3 -2
- oldaplib/test/test_externalontologies.py +175 -0
- oldaplib/test/test_project.py +31 -76
- oldaplib/test/test_propertyclass.py +93 -6
- oldaplib/test/test_resourceclass.py +10 -10
- oldaplib/testdata/connection_test.trig +29 -12
- oldaplib/testdata/datamodel_test.trig +1 -1
- oldaplib/testdata/objectfactory_test.trig +2 -1
- {oldaplib-0.3.3.dist-info → oldaplib-0.3.4.dist-info}/METADATA +1 -1
- {oldaplib-0.3.3.dist-info → oldaplib-0.3.4.dist-info}/RECORD +41 -38
- {oldaplib-0.3.3.dist-info → oldaplib-0.3.4.dist-info}/WHEEL +0 -0
|
@@ -18,6 +18,9 @@ from oldaplib.src.helpers.oldaperror import OldapErrorKey, OldapErrorNotImplemen
|
|
|
18
18
|
from oldaplib.src.helpers.serializer import serializer
|
|
19
19
|
from oldaplib.src.helpers.attributechange import AttributeChange
|
|
20
20
|
from oldaplib.src.xsd.iri import Iri
|
|
21
|
+
from oldaplib.src.xsd.xsd_datetime import Xsd_dateTime
|
|
22
|
+
from oldaplib.src.xsd.xsd_ncname import Xsd_NCName
|
|
23
|
+
from oldaplib.src.xsd.xsd_qname import Xsd_QName
|
|
21
24
|
|
|
22
25
|
|
|
23
26
|
#@strict
|
|
@@ -28,8 +31,8 @@ class ObservableSet(Notify):
|
|
|
28
31
|
is items are added or removed. For this purpose, a callback function can be added to the set which is
|
|
29
32
|
called whenever the set changes.
|
|
30
33
|
"""
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
_setdata: Set[Any]
|
|
35
|
+
_old_value: Self | None
|
|
33
36
|
|
|
34
37
|
def __init__(self,
|
|
35
38
|
setitems: Self | Iterable | None = None,
|
|
@@ -44,56 +47,56 @@ class ObservableSet(Notify):
|
|
|
44
47
|
:param on_change: Callback function to be called when an item is added/removed
|
|
45
48
|
:param on_change_data: data supplied to the callback function
|
|
46
49
|
"""
|
|
47
|
-
self.
|
|
50
|
+
self._old_value = old_value
|
|
48
51
|
super().__init__(notifier=notifier, data=notify_data)
|
|
49
52
|
if isinstance(setitems, ObservableSet):
|
|
50
|
-
self.
|
|
53
|
+
self._setdata = setitems._setdata
|
|
51
54
|
else:
|
|
52
|
-
self.
|
|
55
|
+
self._setdata = set(setitems if setitems else [])
|
|
53
56
|
|
|
54
57
|
def __deepcopy__(self, memo: dict[Any, Any]) -> Self:
|
|
55
58
|
new_copy = self.__class__.__new__(self.__class__)
|
|
56
59
|
memo[id(self)] = new_copy
|
|
57
60
|
#new_copy.__data = deepcopy(self.__data, memo)
|
|
58
|
-
new_copy.
|
|
61
|
+
new_copy._setdata = set(self._setdata)
|
|
59
62
|
#new_copy._notifier = deepcopy(self._notifier, memo)
|
|
60
63
|
new_copy._notifier = self._notifier
|
|
61
64
|
new_copy._notify_data = deepcopy(self._notify_data, memo)
|
|
62
65
|
return new_copy
|
|
63
66
|
|
|
64
67
|
def __iter__(self):
|
|
65
|
-
return iter(self.
|
|
68
|
+
return iter(self._setdata)
|
|
66
69
|
|
|
67
70
|
def __len__(self) -> int:
|
|
68
|
-
return len(self.
|
|
71
|
+
return len(self._setdata)
|
|
69
72
|
|
|
70
73
|
def __contains__(self, item: Any) -> bool:
|
|
71
|
-
return item in self.
|
|
74
|
+
return item in self._setdata
|
|
72
75
|
|
|
73
76
|
def __repr__(self) -> str:
|
|
74
|
-
l = [repr(x) for x in self.
|
|
77
|
+
l = [repr(x) for x in self._setdata]
|
|
75
78
|
return ", ".join(l)
|
|
76
79
|
|
|
77
80
|
def __str__(self) -> str:
|
|
78
|
-
return str(self.
|
|
81
|
+
return str(self._setdata)
|
|
79
82
|
|
|
80
83
|
def __eq__(self, other: Iterable) -> bool:
|
|
81
84
|
if isinstance(other, ObservableSet):
|
|
82
|
-
return self.
|
|
85
|
+
return self._setdata == other._setdata
|
|
83
86
|
elif isinstance(other, set):
|
|
84
|
-
return self.
|
|
87
|
+
return self._setdata == other
|
|
85
88
|
elif isinstance(other, Iterable):
|
|
86
|
-
return self.
|
|
89
|
+
return self._setdata == set(other)
|
|
87
90
|
else:
|
|
88
91
|
raise OldapErrorNotImplemented(f'Set.__eq__() not implemented for {type(other).__name__}')
|
|
89
92
|
|
|
90
93
|
def __or__(self, other: Iterable) -> Self:
|
|
91
94
|
if isinstance(other, ObservableSet):
|
|
92
|
-
return ObservableSet(self.
|
|
95
|
+
return ObservableSet(self._setdata.__or__(other._setdata), self._notifier, self._notify_data)
|
|
93
96
|
elif isinstance(other, set):
|
|
94
|
-
return ObservableSet(self.
|
|
97
|
+
return ObservableSet(self._setdata.__or__(other), self._notifier, self._notify_data)
|
|
95
98
|
elif isinstance(other, Iterable):
|
|
96
|
-
return ObservableSet(self.
|
|
99
|
+
return ObservableSet(self._setdata.__or__(set(other)), self._notifier, self._notify_data)
|
|
97
100
|
else:
|
|
98
101
|
raise OldapErrorNotImplemented(f'Set.__or__() not implemented for {type(other).__name__}')
|
|
99
102
|
|
|
@@ -103,40 +106,40 @@ class ObservableSet(Notify):
|
|
|
103
106
|
def __ior__(self, other: Iterable) -> Self:
|
|
104
107
|
tmp_copy = deepcopy(self)
|
|
105
108
|
if isinstance(other, ObservableSet):
|
|
106
|
-
self.
|
|
109
|
+
self._setdata.__ior__(other._setdata)
|
|
107
110
|
elif isinstance(other, set):
|
|
108
|
-
self.
|
|
111
|
+
self._setdata.__ior__(other)
|
|
109
112
|
elif isinstance(other, Iterable):
|
|
110
|
-
return ObservableSet(self.
|
|
113
|
+
return ObservableSet(self._setdata.__ior__(set(other)), self._notifier, self._notify_data)
|
|
111
114
|
else:
|
|
112
115
|
raise OldapErrorNotImplemented(f'Set.i__or__() not implemented for {type(other).__name__}')
|
|
113
|
-
if not self.
|
|
114
|
-
self.
|
|
116
|
+
if not self._old_value:
|
|
117
|
+
self._old_value = tmp_copy
|
|
115
118
|
self.notify()
|
|
116
119
|
return self
|
|
117
120
|
|
|
118
121
|
def __and__(self, other: Iterable) -> Self:
|
|
119
122
|
if isinstance(other, ObservableSet):
|
|
120
|
-
return ObservableSet(self.
|
|
123
|
+
return ObservableSet(self._setdata.__and__(other._setdata), self._notifier, self._notify_data)
|
|
121
124
|
elif isinstance(other, set):
|
|
122
|
-
return ObservableSet(self.
|
|
125
|
+
return ObservableSet(self._setdata.__and__(other), self._notifier, self._notify_data)
|
|
123
126
|
elif isinstance(other, Iterable):
|
|
124
|
-
return ObservableSet(self.
|
|
127
|
+
return ObservableSet(self._setdata.__and__(set(other)), self._notifier, self._notify_data)
|
|
125
128
|
else:
|
|
126
129
|
raise OldapErrorNotImplemented(f'Set.__and__() not implemented for {type(other).__name__}')
|
|
127
130
|
|
|
128
131
|
def __iand__(self, other: Iterable) -> Self:
|
|
129
132
|
tmp_copy = deepcopy(self)
|
|
130
133
|
if isinstance(other, ObservableSet):
|
|
131
|
-
self.
|
|
134
|
+
self._setdata.__iand__(other._setdata)
|
|
132
135
|
elif isinstance(other, set):
|
|
133
|
-
self.
|
|
136
|
+
self._setdata.__iand__(other)
|
|
134
137
|
elif isinstance(other, Iterable):
|
|
135
|
-
self.
|
|
138
|
+
self._setdata.__iand__(set(other))
|
|
136
139
|
else:
|
|
137
140
|
raise OldapErrorNotImplemented(f'Set.__iand__() not implemented for {type(other).__name__}')
|
|
138
|
-
if not self.
|
|
139
|
-
self.
|
|
141
|
+
if not self._old_value:
|
|
142
|
+
self._old_value = tmp_copy
|
|
140
143
|
self.notify()
|
|
141
144
|
return self
|
|
142
145
|
|
|
@@ -145,136 +148,144 @@ class ObservableSet(Notify):
|
|
|
145
148
|
|
|
146
149
|
def __sub__(self, other: Iterable) -> Self:
|
|
147
150
|
if isinstance(other, ObservableSet):
|
|
148
|
-
return ObservableSet(self.
|
|
151
|
+
return ObservableSet(self._setdata.__sub__(other._setdata), self.notify, self._notify_data)
|
|
149
152
|
elif isinstance(other, set):
|
|
150
|
-
return ObservableSet(self.
|
|
153
|
+
return ObservableSet(self._setdata.__sub__(other), self.notify, self._notify_data)
|
|
151
154
|
elif isinstance(other, Iterable):
|
|
152
|
-
return ObservableSet(self.
|
|
155
|
+
return ObservableSet(self._setdata.__sub__(set(other)), self.notify, self._notify_data)
|
|
153
156
|
else:
|
|
154
157
|
raise OldapErrorNotImplemented(f'Set.__sub__() not implemented for {type(other).__name__}')
|
|
155
158
|
|
|
156
159
|
def __isub__(self, other: Iterable) -> Self:
|
|
157
160
|
tmp_copy = deepcopy(self)
|
|
158
161
|
if isinstance(other, ObservableSet):
|
|
159
|
-
self.
|
|
162
|
+
self._setdata.__isub__(other._setdata)
|
|
160
163
|
elif isinstance(other, set):
|
|
161
|
-
self.
|
|
164
|
+
self._setdata.__isub__(other)
|
|
162
165
|
elif isinstance(other, Iterable):
|
|
163
|
-
self.
|
|
166
|
+
self._setdata.__isub__(set(other))
|
|
164
167
|
else:
|
|
165
168
|
raise OldapErrorNotImplemented(f'Set.__isub__() not implemented for {type(other).__name__}')
|
|
166
|
-
if not self.
|
|
167
|
-
self.
|
|
169
|
+
if not self._old_value:
|
|
170
|
+
self._old_value = tmp_copy
|
|
168
171
|
self.notify()
|
|
169
172
|
return self
|
|
170
173
|
|
|
171
174
|
def update(self, items: Iterable):
|
|
172
175
|
tmp_copy = deepcopy(self)
|
|
173
|
-
self.
|
|
174
|
-
if not self.
|
|
175
|
-
self.
|
|
176
|
+
self._setdata.update(items)
|
|
177
|
+
if not self._old_value:
|
|
178
|
+
self._old_value = tmp_copy
|
|
176
179
|
self.notify()
|
|
177
180
|
|
|
178
181
|
def intersection_update(self, items: Iterable):
|
|
179
182
|
tmp_copy = deepcopy(self)
|
|
180
|
-
self.
|
|
181
|
-
if not self.
|
|
182
|
-
self.
|
|
183
|
+
self._setdata.intersection_update(items)
|
|
184
|
+
if not self._old_value:
|
|
185
|
+
self._old_value = tmp_copy
|
|
183
186
|
self.notify()
|
|
184
187
|
|
|
185
188
|
def difference_update(self, items: Iterable):
|
|
186
189
|
tmp_copy = deepcopy(self)
|
|
187
|
-
self.
|
|
188
|
-
if not self.
|
|
189
|
-
self.
|
|
190
|
+
self._setdata.difference_update(items)
|
|
191
|
+
if not self._old_value:
|
|
192
|
+
self._old_value = tmp_copy
|
|
190
193
|
self.notify()
|
|
191
194
|
|
|
192
195
|
def symmetric_difference_update(self, items: Iterable):
|
|
193
196
|
tmp_copy = deepcopy(self)
|
|
194
|
-
self.
|
|
195
|
-
if not self.
|
|
196
|
-
self.
|
|
197
|
+
self._setdata.symmetric_difference_update(items)
|
|
198
|
+
if not self._old_value:
|
|
199
|
+
self._old_value = tmp_copy
|
|
197
200
|
self.notify()
|
|
198
201
|
|
|
199
202
|
def add(self, item: Any) -> None:
|
|
200
203
|
tmp_copy = deepcopy(self)
|
|
201
|
-
self.
|
|
202
|
-
if not self.
|
|
203
|
-
self.
|
|
204
|
+
self._setdata.add(item)
|
|
205
|
+
if not self._old_value:
|
|
206
|
+
self._old_value = tmp_copy
|
|
204
207
|
self.notify()
|
|
205
208
|
|
|
206
209
|
def remove(self, item: Any) -> None:
|
|
207
210
|
tmp_copy = deepcopy(self)
|
|
208
|
-
self.
|
|
209
|
-
if not self.
|
|
210
|
-
self.
|
|
211
|
+
self._setdata.remove(item)
|
|
212
|
+
if not self._old_value:
|
|
213
|
+
self._old_value = tmp_copy
|
|
211
214
|
self.notify()
|
|
212
215
|
|
|
213
216
|
def discard(self, item: Any):
|
|
214
217
|
tmp_copy = deepcopy(self)
|
|
215
|
-
self.
|
|
216
|
-
if not self.
|
|
217
|
-
self.
|
|
218
|
+
self._setdata.discard(item)
|
|
219
|
+
if not self._old_value:
|
|
220
|
+
self._old_value = tmp_copy
|
|
218
221
|
self.notify()
|
|
219
222
|
|
|
220
223
|
def pop(self):
|
|
221
224
|
tmp_copy = deepcopy(self)
|
|
222
|
-
item = self.
|
|
223
|
-
if not self.
|
|
224
|
-
self.
|
|
225
|
+
item = self._setdata.pop()
|
|
226
|
+
if not self._old_value:
|
|
227
|
+
self._old_value = tmp_copy
|
|
225
228
|
self.notify()
|
|
226
229
|
return item
|
|
227
230
|
|
|
228
231
|
def clear(self) -> None:
|
|
229
232
|
tmp_copy = deepcopy(self)
|
|
230
|
-
self.
|
|
231
|
-
if not self.
|
|
232
|
-
self.
|
|
233
|
+
self._setdata.clear()
|
|
234
|
+
if not self._old_value:
|
|
235
|
+
self._old_value = tmp_copy
|
|
233
236
|
self.notify()
|
|
234
237
|
|
|
235
238
|
@property
|
|
236
239
|
def old_value(self) -> Self | None:
|
|
237
|
-
return self.
|
|
240
|
+
return self._old_value
|
|
238
241
|
|
|
239
242
|
def clear_old_value(self) -> None:
|
|
240
243
|
"""
|
|
241
244
|
Clear the changeset. This method is only for internal use or debugging...
|
|
242
245
|
:return: None
|
|
243
246
|
"""
|
|
244
|
-
self.
|
|
247
|
+
self._old_value = None
|
|
245
248
|
|
|
246
249
|
def copy(self) -> Self:
|
|
247
|
-
return ObservableSet(self.
|
|
250
|
+
return ObservableSet(self._setdata.copy(), notifier=self._notifier, notify_data=self._notify_data)
|
|
248
251
|
|
|
249
252
|
@property
|
|
250
253
|
def toRdf(self) -> str:
|
|
251
|
-
l = [x.toRdf if getattr(x, "toRdf", None) else x for x in self.
|
|
254
|
+
l = [x.toRdf if getattr(x, "toRdf", None) else x for x in self._setdata]
|
|
252
255
|
return ", ".join(l)
|
|
253
256
|
|
|
254
257
|
def _as_dict(self):
|
|
255
|
-
return {'setitems': list(self.
|
|
258
|
+
return {'setitems': list(self._setdata)}
|
|
256
259
|
|
|
257
260
|
def asSet(self) -> set:
|
|
258
|
-
return self.
|
|
261
|
+
return self._setdata.copy()
|
|
259
262
|
|
|
260
263
|
def to_set(self) -> set:
|
|
261
|
-
return self.
|
|
264
|
+
return self._setdata
|
|
262
265
|
|
|
263
266
|
def undo(self) -> None:
|
|
264
|
-
if self.
|
|
265
|
-
self.
|
|
266
|
-
self.
|
|
267
|
+
if self._old_value:
|
|
268
|
+
self._setdata = self._old_value.to_set()
|
|
269
|
+
self._old_value = None
|
|
267
270
|
|
|
268
|
-
def clear_changeset(self):
|
|
269
|
-
self.
|
|
271
|
+
def clear_changeset(self) -> None:
|
|
272
|
+
for item in self._setdata:
|
|
273
|
+
if hasattr(item, 'clear_changeset'):
|
|
274
|
+
item.clear_changeset()
|
|
275
|
+
self._old_value = None
|
|
270
276
|
|
|
271
277
|
def update_sparql(self, *,
|
|
272
|
-
graph: Iri,
|
|
278
|
+
graph: Iri | Xsd_QName,
|
|
273
279
|
subject: Iri,
|
|
274
280
|
field: Iri,
|
|
281
|
+
ignoreitems: Set[Any] | None = None,
|
|
275
282
|
indent: int = 0, indent_inc: int = 4) -> list[str]:
|
|
276
|
-
items_to_add = self.
|
|
277
|
-
|
|
283
|
+
items_to_add = self._setdata - self._old_value.to_set()
|
|
284
|
+
if ignoreitems:
|
|
285
|
+
items_to_add = items_to_add - ignoreitems
|
|
286
|
+
items_to_delete = self._old_value.to_set() - self._setdata
|
|
287
|
+
if ignoreitems:
|
|
288
|
+
items_to_delete = items_to_delete - ignoreitems
|
|
278
289
|
blank = ''
|
|
279
290
|
sparql_list = []
|
|
280
291
|
|
|
@@ -297,3 +308,47 @@ class ObservableSet(Notify):
|
|
|
297
308
|
sparql_list.append(sparql)
|
|
298
309
|
|
|
299
310
|
return sparql_list
|
|
311
|
+
|
|
312
|
+
def update_shacl(self, *,
|
|
313
|
+
graph: Xsd_NCName,
|
|
314
|
+
owlclass_iri: Iri | None = None,
|
|
315
|
+
prop_iri: Iri,
|
|
316
|
+
attr: AttributeClass,
|
|
317
|
+
modified: Xsd_dateTime,
|
|
318
|
+
indent: int = 0, indent_inc: int = 4) -> list[str]:
|
|
319
|
+
items_to_add = self._setdata - self._old_value
|
|
320
|
+
items_to_delete = self._old_value - self._setdata
|
|
321
|
+
|
|
322
|
+
blank = ''
|
|
323
|
+
sparql_list = []
|
|
324
|
+
sparql = f'# ObservableSet: Update SHACL\n'
|
|
325
|
+
sparql += f'{blank:{indent * indent_inc}}WITH {graph}:shacl\n'
|
|
326
|
+
|
|
327
|
+
if items_to_add:
|
|
328
|
+
sparql = f'{blank:{indent * indent_inc}}INSERT {{\n'
|
|
329
|
+
sparql += f'{blank:{(indent + 1) * indent_inc}}GRAPH {graph} {{\n'
|
|
330
|
+
for item in items_to_add:
|
|
331
|
+
sparql += f'{blank:{(indent + 2) * indent_inc}}?prop {attr.value.toRdf} {item.toRdf} .'
|
|
332
|
+
sparql += f'{blank:{(indent + 1) * indent_inc}}}}\n'
|
|
333
|
+
sparql += f'{blank:{indent * indent_inc}}}}\n'
|
|
334
|
+
|
|
335
|
+
if items_to_delete:
|
|
336
|
+
sparql = f'{blank:{indent * indent_inc}}DELETE {{\n'
|
|
337
|
+
sparql += f'{blank:{(indent + 1) * indent_inc}}GRAPH {graph} {{\n'
|
|
338
|
+
for item in items_to_delete:
|
|
339
|
+
sparql += f'{blank:{(indent + 2) * indent_inc}}?prop {attr.value.toRdf} {item.toRdf} .'
|
|
340
|
+
sparql += f'{blank:{(indent + 1) * indent_inc}}}}\n'
|
|
341
|
+
sparql += f'{blank:{indent * indent_inc}}}}\n'
|
|
342
|
+
sparql_list.append(sparql)
|
|
343
|
+
|
|
344
|
+
sparql += f'{blank:{indent * indent_inc}}WHERE {{\n'
|
|
345
|
+
if owlclass_iri:
|
|
346
|
+
sparql += f'{blank:{(indent + 1) * indent_inc}}{owlclass_iri}Shape sh:property ?prop .\n'
|
|
347
|
+
sparql += f'{blank:{(indent + 1) * indent_inc}}?prop sh:path {prop_iri.toRdf} .\n'
|
|
348
|
+
else:
|
|
349
|
+
sparql += f'{blank:{(indent + 1) * indent_inc}}BIND({prop_iri}Shape as ?prop) .\n'
|
|
350
|
+
sparql += f'{blank:{(indent + 1) * indent_inc}}?prop dcterms:modified ?modified .\n'
|
|
351
|
+
sparql += f'{blank:{(indent + 1) * indent_inc}}FILTER(?modified = {modified.toRdf})\n'
|
|
352
|
+
sparql += f'{blank:{indent * indent_inc}}}}'
|
|
353
|
+
sparql_list.append(sparql)
|
|
354
|
+
return sparql
|
|
@@ -3,6 +3,7 @@ from typing import List, Dict
|
|
|
3
3
|
|
|
4
4
|
from pystrict import strict
|
|
5
5
|
|
|
6
|
+
from oldaplib.src.dtypes.namespaceiri import NamespaceIRI
|
|
6
7
|
from oldaplib.src.helpers.context import Context
|
|
7
8
|
from oldaplib.src.dtypes.bnode import BNode
|
|
8
9
|
from oldaplib.src.xsd.iri import Iri
|
|
@@ -72,6 +73,8 @@ class QueryProcessor:
|
|
|
72
73
|
tmp = context.iri2qname(valobj["value"], validate=False)
|
|
73
74
|
if tmp is None:
|
|
74
75
|
row[name] = Iri(valobj["value"], validate=False)
|
|
76
|
+
elif not tmp.fragment:
|
|
77
|
+
row[name] = NamespaceIRI(valobj["value"], validate=False)
|
|
75
78
|
else:
|
|
76
79
|
#row[name] = Iri(tmp, validate=False)
|
|
77
80
|
row[name] = tmp
|
oldaplib/src/model.py
CHANGED
|
@@ -45,7 +45,7 @@ class Model:
|
|
|
45
45
|
_created: Xsd_dateTime | None
|
|
46
46
|
_contributor: Iri | None
|
|
47
47
|
_modified: Xsd_dateTime | None
|
|
48
|
-
_attributes: dict[
|
|
48
|
+
_attributes: dict[AttributeClass, Any]
|
|
49
49
|
_changeset: dict[AttributeClass | Xsd_QName, AttributeChange]
|
|
50
50
|
_validate: bool
|
|
51
51
|
|
oldaplib/src/oldaplist.py
CHANGED
|
@@ -501,10 +501,10 @@ class OldapList(Model):
|
|
|
501
501
|
definition = LangString()
|
|
502
502
|
definition.add(r['val'])
|
|
503
503
|
if prefLabel:
|
|
504
|
-
prefLabel.
|
|
504
|
+
prefLabel.clear_changeset()
|
|
505
505
|
prefLabel.set_notifier(cls.notifier, Xsd_QName(OldapListAttr.PREF_LABEL.value))
|
|
506
506
|
if definition:
|
|
507
|
-
definition.
|
|
507
|
+
definition.clear_changeset()
|
|
508
508
|
definition.set_notifier(cls.notifier, Xsd_QName(OldapListAttr.DEFINITION.value))
|
|
509
509
|
|
|
510
510
|
instance = cls(con=con,
|
oldaplib/src/oldaplistnode.py
CHANGED
|
@@ -352,10 +352,10 @@ class OldapListNode(Model):
|
|
|
352
352
|
case 'oldap:rightIndex':
|
|
353
353
|
rightIndex = r['val']
|
|
354
354
|
if prefLabel:
|
|
355
|
-
prefLabel.
|
|
355
|
+
prefLabel.clear_changeset()
|
|
356
356
|
prefLabel.set_notifier(cls.notifier, Xsd_QName(OldapListNodeAttr.PREF_LABEL.value))
|
|
357
357
|
if definition:
|
|
358
|
-
definition.
|
|
358
|
+
definition.clear_changeset()
|
|
359
359
|
definition.set_notifier(cls.notifier, Xsd_QName(OldapListNodeAttr.DEFINITION.value))
|
|
360
360
|
return cls(con=con,
|
|
361
361
|
projectShortName=projectShortName,
|
oldaplib/src/permissionset.py
CHANGED
|
@@ -179,7 +179,7 @@ class PermissionSet(Model):
|
|
|
179
179
|
return False, f'Actor has no ADMIN_PERMISSION_SETS permission for project {self.definedByProject}'
|
|
180
180
|
return True, "OK"
|
|
181
181
|
|
|
182
|
-
def notifier(self, what: PermissionSetAttr) -> None:
|
|
182
|
+
def notifier(self, what: PermissionSetAttr, value: Any = None) -> None:
|
|
183
183
|
self._changeset[what] = AttributeChange(None, Action.MODIFY)
|
|
184
184
|
|
|
185
185
|
@property
|
|
@@ -379,10 +379,10 @@ class PermissionSet(Model):
|
|
|
379
379
|
_definedByProject = r['o']
|
|
380
380
|
cls.__permset_iri = permset_iri
|
|
381
381
|
if comment:
|
|
382
|
-
comment.
|
|
382
|
+
comment.clear_changeset()
|
|
383
383
|
comment.set_notifier(cls.notifier, Xsd_QName(PermissionSetAttr.LABEL.value))
|
|
384
384
|
if label:
|
|
385
|
-
label.
|
|
385
|
+
label.clear_changeset()
|
|
386
386
|
label.set_notifier(cls.notifier, Xsd_QName(PermissionSetAttr.LABEL.value))
|
|
387
387
|
instance = cls(con=con,
|
|
388
388
|
permissionSetId=Xsd_NCName(_permissionSetId, validate=False),
|