oldaplib 0.3.27__py3-none-any.whl → 0.3.28__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/shared.trig +122 -1
- oldaplib/src/connection.py +43 -71
- oldaplib/src/datamodel.py +49 -47
- oldaplib/src/helpers/context.py +3 -1
- oldaplib/src/objectfactory.py +19 -2
- oldaplib/src/oldaplist.py +2 -0
- oldaplib/src/permissionset.py +26 -10
- oldaplib/src/project.py +36 -20
- oldaplib/src/user.py +74 -26
- oldaplib/src/version.py +1 -1
- oldaplib/src/xsd/xsd_anyuri.py +4 -4
- oldaplib/test/XXX_test_fasnacht.py +17 -0
- oldaplib/test/test_connection.py +0 -1
- oldaplib/test/test_context.py +4 -2
- oldaplib/test/test_datamodel.py +2 -5
- oldaplib/test/test_externalontologies.py +0 -1
- oldaplib/test/test_hasproperty.py +0 -1
- oldaplib/test/test_objectfactory.py +3 -3
- oldaplib/test/test_oldaplist.py +1 -1
- oldaplib/test/test_oldaplist_helpers.py +1 -1
- oldaplib/test/test_oldaplistnode.py +0 -1
- oldaplib/test/test_permissionset.py +2 -1
- oldaplib/test/test_project.py +0 -1
- oldaplib/test/test_propertyclass.py +0 -1
- oldaplib/test/test_resourceclass.py +1 -1
- oldaplib/test/test_user.py +0 -1
- oldaplib/test/test_xsd_datatypes.py +1 -1
- {oldaplib-0.3.27.dist-info → oldaplib-0.3.28.dist-info}/METADATA +1 -1
- {oldaplib-0.3.27.dist-info → oldaplib-0.3.28.dist-info}/RECORD +30 -30
- oldaplib/apps/load_list.py +0 -45
- {oldaplib-0.3.27.dist-info → oldaplib-0.3.28.dist-info}/WHEEL +0 -0
oldaplib/ontologies/shared.trig
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
@prefix sh: <http://www.w3.org/ns/shacl#> .
|
|
5
5
|
@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
|
6
6
|
@prefix dcterms: <http://purl.org/dc/terms/> .
|
|
7
|
+
@prefix dcmitype: <http://purl.org/dc/dcmitype/> .
|
|
7
8
|
@prefix schema: <http://schema.org/> .
|
|
8
9
|
@prefix oldap: <http://oldap.org/base#> .
|
|
9
10
|
|
|
@@ -109,6 +110,90 @@ shared:shacl {
|
|
|
109
110
|
# Media object
|
|
110
111
|
###############################################################################
|
|
111
112
|
|
|
113
|
+
# dcmitype:CollectionShape a sh:NodeShape ;
|
|
114
|
+
# sh:targetClass shared:Collection ;
|
|
115
|
+
# dcterms:created "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime ;
|
|
116
|
+
# dcterms:creator <https://orcid.org/0000-0003-1681-4036> ;
|
|
117
|
+
# dcterms:modified "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime ;
|
|
118
|
+
# dcterms:contributor <https://orcid.org/0000-0003-1681-4036> ;
|
|
119
|
+
# oldap:externalOntology "true"^^xsd:boolean ;
|
|
120
|
+
# rdfs:label "Collection"@en, "Sammlung"@de, "Collection"@fr, "Collezione"@it ;
|
|
121
|
+
# sh:property [
|
|
122
|
+
# sh:path rdf:type ;
|
|
123
|
+
# ] .
|
|
124
|
+
#
|
|
125
|
+
# dcmitype:DatasetShape a sh:NodeShape ;
|
|
126
|
+
# sh:targetClass shared:Dataset ;
|
|
127
|
+
# dcterms:created "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime ;
|
|
128
|
+
# dcterms:creator <https://orcid.org/0000-0003-1681-4036> ;
|
|
129
|
+
# dcterms:modified "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime ;
|
|
130
|
+
# dcterms:contributor <https://orcid.org/0000-0003-1681-4036> ;
|
|
131
|
+
# oldap:externalOntology "true"^^xsd:boolean ;
|
|
132
|
+
# rdfs:label "Dataset"@en, "Dataset"@de, "Dataset"@fr, "Dataset"@it ;
|
|
133
|
+
# sh:property [
|
|
134
|
+
# sh:path rdf:type ;
|
|
135
|
+
# ] .
|
|
136
|
+
#
|
|
137
|
+
# dcmitype:StillImageShape a sh:NodeShape ;
|
|
138
|
+
# sh:targetClass shared:StillImage ;
|
|
139
|
+
# dcterms:created "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime ;
|
|
140
|
+
# dcterms:creator <https://orcid.org/0000-0003-1681-4036> ;
|
|
141
|
+
# dcterms:modified "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime ;
|
|
142
|
+
# dcterms:contributor <https://orcid.org/0000-0003-1681-4036> ;
|
|
143
|
+
# oldap:externalOntology "true"^^xsd:boolean ;
|
|
144
|
+
# rdfs:label "StillImage"@en, "Standbild"@de, "Image fixe"@fr, "Immagine fissa"@it ;
|
|
145
|
+
# sh:property [
|
|
146
|
+
# sh:path rdf:type ;
|
|
147
|
+
# ] .
|
|
148
|
+
#
|
|
149
|
+
# dcmitype:ImageShape a sh:NodeShape ;
|
|
150
|
+
# sh:targetClass shared:Image ;
|
|
151
|
+
# dcterms:created "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime ;
|
|
152
|
+
# dcterms:creator <https://orcid.org/0000-0003-1681-4036> ;
|
|
153
|
+
# dcterms:modified "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime ;
|
|
154
|
+
# dcterms:contributor <https://orcid.org/0000-0003-1681-4036> ;
|
|
155
|
+
# oldap:externalOntology "true"^^xsd:boolean ;
|
|
156
|
+
# rdfs:label "Image"@en, "Bild"@de, "Image"@fr, "Immagine"@it ;
|
|
157
|
+
# sh:property [
|
|
158
|
+
# sh:path rdf:type ;
|
|
159
|
+
# ] .
|
|
160
|
+
#
|
|
161
|
+
# dcmitype:MovingImageShape a sh:NodeShape ;
|
|
162
|
+
# sh:targetClass shared:MovingImage ;
|
|
163
|
+
# dcterms:created "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime ;
|
|
164
|
+
# dcterms:creator <https://orcid.org/0000-0003-1681-4036> ;
|
|
165
|
+
# dcterms:modified "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime ;
|
|
166
|
+
# dcterms:contributor <https://orcid.org/0000-0003-1681-4036> ;
|
|
167
|
+
# oldap:externalOntology "true"^^xsd:boolean ;
|
|
168
|
+
# rdfs:label "MovingImage"@en, "Bewegtbild"@de, "Image animée"@fr, "Immagine in movimento"@it ;
|
|
169
|
+
# sh:property [
|
|
170
|
+
# sh:path rdf:type ;
|
|
171
|
+
# ] .
|
|
172
|
+
#
|
|
173
|
+
# dcmitype:SoundShape a sh:NodeShape ;
|
|
174
|
+
# sh:targetClass shared:Sound ;
|
|
175
|
+
# dcterms:created "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime ;
|
|
176
|
+
# dcterms:creator <https://orcid.org/0000-0003-1681-4036> ;
|
|
177
|
+
# dcterms:modified "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime ;
|
|
178
|
+
# dcterms:contributor <https://orcid.org/0000-0003-1681-4036> ;
|
|
179
|
+
# oldap:externalOntology "true"^^xsd:boolean ;
|
|
180
|
+
# rdfs:label "Sound"@en, "Ton"@de, "Son"@fr, "Sound"@it ;
|
|
181
|
+
# sh:property [
|
|
182
|
+
# sh:path rdf:type ;
|
|
183
|
+
# ] .
|
|
184
|
+
#
|
|
185
|
+
# dcmitype:TextShape a sh:NodeShape ;
|
|
186
|
+
# sh:targetClass shared:Text ;
|
|
187
|
+
# dcterms:created "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime ;
|
|
188
|
+
# dcterms:creator <https://orcid.org/0000-0003-1681-4036> ;
|
|
189
|
+
# dcterms:modified "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime ;
|
|
190
|
+
# dcterms:contributor <https://orcid.org/0000-0003-1681-4036> ;
|
|
191
|
+
# oldap:externalOntology "true"^^xsd:boolean ;
|
|
192
|
+
# rdfs:label "Text"@en, "Text"@de, "Texte"@fr, "Testo"@it ;
|
|
193
|
+
# sh:property [
|
|
194
|
+
# sh:path rdf:type ;
|
|
195
|
+
# ] .
|
|
196
|
+
|
|
112
197
|
shared:MediaObjectShape a sh:NodeShape ;
|
|
113
198
|
sh:targetClass shared:MediaObject ;
|
|
114
199
|
dcterms:created "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime ;
|
|
@@ -117,12 +202,33 @@ shared:shacl {
|
|
|
117
202
|
dcterms:contributor <https://orcid.org/0000-0003-1681-4036> ;
|
|
118
203
|
oldap:externalOntology "false"^^xsd:boolean ;
|
|
119
204
|
rdfs:label "MediaObject"@en, "Medienobjekt"@de, "MediaObject"@fr, "MediaObject"@it ;
|
|
120
|
-
rdfs:comment "Page of a book"@en, "Seite eines Buches"@de ;
|
|
121
205
|
sh:closed "true"^^xsd:boolean ;
|
|
122
206
|
sh:node oldap:ThingShape ;
|
|
123
207
|
sh:property [
|
|
124
208
|
sh:path rdf:type ;
|
|
125
209
|
] ;
|
|
210
|
+
sh:property [
|
|
211
|
+
sh:path dcterms:type ;
|
|
212
|
+
dcterms:creator <https://orcid.org/0000-0003-1681-4036> ;
|
|
213
|
+
dcterms:created "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime ;
|
|
214
|
+
dcterms:contributor <https://orcid.org/0000-0003-1681-4036> ;
|
|
215
|
+
dcterms:modified "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime ;
|
|
216
|
+
oldap:statementProperty "false"^^xsd:boolean ;
|
|
217
|
+
oldap:externalOntology "false"^^xsd:boolean ;
|
|
218
|
+
sh:nodeKind sh:IRI ;
|
|
219
|
+
sh:in (
|
|
220
|
+
dcmitype:Collection
|
|
221
|
+
dcmitype:Dataset
|
|
222
|
+
dcmitype:StillImage
|
|
223
|
+
dcmitype:Image
|
|
224
|
+
dcmitype:MovingImage
|
|
225
|
+
dcmitype:Sound
|
|
226
|
+
dcmitype:Text
|
|
227
|
+
) ;
|
|
228
|
+
sh:minCount 1 ;
|
|
229
|
+
sh:maxCount 1 ;
|
|
230
|
+
sh:order "0.5"^^xsd:decimal ;
|
|
231
|
+
] ;
|
|
126
232
|
sh:property [
|
|
127
233
|
sh:path shared:originalName ;
|
|
128
234
|
schema:version "0.1.0"^^xsd:string ;
|
|
@@ -344,6 +450,15 @@ shared:onto {
|
|
|
344
450
|
# Media object
|
|
345
451
|
###########################################################################
|
|
346
452
|
|
|
453
|
+
# shared:mediaType rdf:type owl:ObjectProperty ;
|
|
454
|
+
# dcterms:creator <https://orcid.org/0000-0003-1681-4036> ;
|
|
455
|
+
# dcterms:created "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime ;
|
|
456
|
+
# dcterms:contributor <https://orcid.org/0000-0003-1681-4036> ;
|
|
457
|
+
# dcterms:modified "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime .
|
|
458
|
+
# #owl:subPropertyOf dcterms:type ;
|
|
459
|
+
# rdfs:domain shared:MediaObject ;
|
|
460
|
+
# rdfs:range rdfs:Class ;
|
|
461
|
+
|
|
347
462
|
shared:originalName rdf:type owl:DatatypeProperty ;
|
|
348
463
|
rdfs:domain shared:MediaObject ;
|
|
349
464
|
rdfs:range xsd:string ;
|
|
@@ -401,6 +516,12 @@ shared:onto {
|
|
|
401
516
|
rdfs:label "MediaObject"@en, "Medienobjekt"@de, "MediaObject"@fr, "MediaObject"@it ;
|
|
402
517
|
rdfs:comment "Page of a book"@en, "Seite eines Buches"@de ;
|
|
403
518
|
rdfs:subClassOf oldap:Thing ,
|
|
519
|
+
[
|
|
520
|
+
rdf:type owl:Restriction ;
|
|
521
|
+
owl:onProperty dcterms:type ;
|
|
522
|
+
owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ;
|
|
523
|
+
owl:onClass rdfs:Class ;
|
|
524
|
+
] ,
|
|
404
525
|
[
|
|
405
526
|
rdf:type owl:Restriction ;
|
|
406
527
|
owl:onProperty shared:originalName ;
|
oldaplib/src/connection.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import os
|
|
3
|
-
|
|
3
|
+
import time
|
|
4
4
|
|
|
5
5
|
import bcrypt
|
|
6
6
|
import jwt
|
|
@@ -338,80 +338,52 @@ class Connection(IConnection):
|
|
|
338
338
|
if not req.ok:
|
|
339
339
|
raise OldapError(req.text)
|
|
340
340
|
|
|
341
|
+
|
|
342
|
+
|
|
341
343
|
def upload_turtle(self, filename: str, graphname: Optional[str] = None) -> None:
|
|
342
344
|
"""
|
|
343
|
-
|
|
344
|
-
import and does not wait for the completion of the import process. The process itself may continue for some time
|
|
345
|
-
after the command is issued.
|
|
346
|
-
|
|
347
|
-
:param filename: Name of the file to be uploaded.
|
|
348
|
-
:type filename: str
|
|
349
|
-
:param graphname: Optional; the name of the RDF-graph into which the data is to be imported.
|
|
350
|
-
:type graphname: str or None
|
|
351
|
-
:return: None
|
|
352
|
-
:rtype: None
|
|
353
|
-
:raises OldapError: Raised when there are issues with the repository or during the HTTP request.
|
|
354
|
-
"""
|
|
355
|
-
# if not self._userdata:
|
|
356
|
-
# raise OldapErrorNoPermission("No permission")
|
|
357
|
-
# actor = self._userdata
|
|
358
|
-
# sysperms = actor.inProject.get(QName('oldap:SystemProject'))
|
|
359
|
-
# is_root: bool = False
|
|
360
|
-
# if sysperms and AdminPermission.ADMIN_OLDAP in sysperms:
|
|
361
|
-
# is_root = True
|
|
362
|
-
# if not is_root:
|
|
363
|
-
# raise OldapErrorNoPermission("No permission")
|
|
345
|
+
Upload a TTL/TRiG file to GraphDB using the RDF4J /statements endpoint.
|
|
364
346
|
|
|
347
|
+
This call is synchronous: when it returns without error, the data is loaded.
|
|
348
|
+
"""
|
|
365
349
|
logger = get_logger()
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
mime = ""
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
data =
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
"Content-Type": "application/json; charset=utf-8"
|
|
404
|
-
}
|
|
405
|
-
url = f"{self._server}/rest/repositories/{self._repo}/import/upload/text"
|
|
406
|
-
auth = HTTPBasicAuth(self._dbuser, self._dbpassword) if self._dbuser and self._dbpassword else None
|
|
407
|
-
req = requests.post(url,
|
|
408
|
-
headers=headers,
|
|
409
|
-
data=jsondata,
|
|
410
|
-
auth=auth)
|
|
411
|
-
if not req.ok:
|
|
412
|
-
logger.error(f'Upload of file "{filename}" failed: {req.text}')
|
|
413
|
-
raise OldapError(req.text)
|
|
414
|
-
logger.info(f'File "{filename}" uploaded.')
|
|
350
|
+
|
|
351
|
+
ext = Path(filename).suffix.lower()
|
|
352
|
+
if ext == ".ttl":
|
|
353
|
+
mime = "text/turtle"
|
|
354
|
+
elif ext == ".trig":
|
|
355
|
+
# use the standard MIME type for TriG
|
|
356
|
+
mime = "application/trig"
|
|
357
|
+
else:
|
|
358
|
+
raise OldapError(f"Unsupported RDF extension: {ext}")
|
|
359
|
+
|
|
360
|
+
with open(filename, "rb") as f:
|
|
361
|
+
data = f.read()
|
|
362
|
+
|
|
363
|
+
# RDF4J / GraphDB statements endpoint
|
|
364
|
+
url = f"{self._server.rstrip('/')}/repositories/{self._repo}/statements"
|
|
365
|
+
|
|
366
|
+
# Optional context: only use this if you really want to force
|
|
367
|
+
# all triples into a single named graph. For TriG you usually
|
|
368
|
+
# leave this empty so the quads' graph IRIs are respected.
|
|
369
|
+
params = {}
|
|
370
|
+
if graphname:
|
|
371
|
+
# GraphDB expects the context IRI wrapped in < > and URL-encoded
|
|
372
|
+
params["context"] = f"<{graphname}>"
|
|
373
|
+
|
|
374
|
+
auth = HTTPBasicAuth(self._dbuser, self._dbpassword) if self._dbuser and self._dbpassword else None
|
|
375
|
+
headers = {
|
|
376
|
+
"Content-Type": mime,
|
|
377
|
+
"Accept": "text/plain" # or */*, result body is usually empty
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
resp = requests.post(url, params=params, headers=headers, data=data, auth=auth)
|
|
381
|
+
|
|
382
|
+
if not resp.ok:
|
|
383
|
+
logger.error(f'Upload of file "{filename}" failed: {resp.status_code} {resp.text}')
|
|
384
|
+
raise OldapError(resp.text)
|
|
385
|
+
|
|
386
|
+
logger.info(f'File "{filename}" uploaded synchronously via /statements.')
|
|
415
387
|
|
|
416
388
|
def query(self, query: str, format: SparqlResultFormat = SparqlResultFormat.JSON) -> Any:
|
|
417
389
|
"""
|
oldaplib/src/datamodel.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import io
|
|
1
2
|
from copy import deepcopy
|
|
2
3
|
from dataclasses import dataclass
|
|
3
4
|
from datetime import datetime
|
|
4
|
-
from typing import Dict, List, Optional, Union, Any, Self
|
|
5
|
+
from typing import Dict, List, Optional, Union, Any, Self, TextIO
|
|
5
6
|
|
|
6
7
|
from oldaplib.src.cachesingleton import CacheSingleton, CacheSingletonRedis
|
|
7
8
|
from oldaplib.src.dtypes.namespaceiri import NamespaceIRI
|
|
@@ -723,57 +724,58 @@ class DataModel(Model):
|
|
|
723
724
|
cache = CacheSingletonRedis()
|
|
724
725
|
cache.delete(Xsd_QName(self._project.projectShortName, 'shacl'))
|
|
725
726
|
|
|
726
|
-
|
|
727
|
-
def write_as_trig(self, filename: str, indent: int = 0, indent_inc: int = 4) -> None:
|
|
727
|
+
def __to_trig_format(self, f: TextIO, indent: int = 0, indent_inc: int = 4) -> None:
|
|
728
728
|
"""
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
:
|
|
738
|
-
|
|
739
|
-
to 0
|
|
740
|
-
:type indent: int
|
|
741
|
-
:param indent_inc: Number of characters to increment for each indent
|
|
742
|
-
level. Defaults to 4
|
|
743
|
-
:type indent_inc: int
|
|
729
|
+
Generates and writes TriG-formatted RDF data to the given TextIO object. The method constructs
|
|
730
|
+
SHACL and OWL ontology representations based on the internal state and configuration of the
|
|
731
|
+
object. SHACL validation shapes, ontology metadata, and RDF structure are included. This
|
|
732
|
+
method is primarily used for exporting RDF data in a standard, compliant format.
|
|
733
|
+
|
|
734
|
+
:param f: The output stream (e.g., a file or any TextIO object) where the generated TriG
|
|
735
|
+
data will be written.
|
|
736
|
+
:param indent: The base indentation level applied when formatting the output.
|
|
737
|
+
:param indent_inc: The number of spaces added for each level of indentation to format
|
|
738
|
+
nested structures cleanly.
|
|
744
739
|
:return: None
|
|
745
740
|
"""
|
|
741
|
+
timestamp = Xsd_dateTime.now()
|
|
742
|
+
blank = ''
|
|
743
|
+
context = Context(name=self._con.context_name)
|
|
744
|
+
f.write('\n')
|
|
745
|
+
f.write(context.turtle_context)
|
|
746
|
+
f.write(f'\n{blank:{indent * indent_inc}}{self.__graph}:shacl {{\n')
|
|
747
|
+
f.write(f'{blank:{(indent + 1) * indent_inc}}{self.__graph}:shapes schema:version {self.__version.toRdf} .\n')
|
|
748
|
+
f.write('\n')
|
|
749
|
+
for qname, onto in self.__extontos.items():
|
|
750
|
+
f.write(onto.create_shacl(timestamp=timestamp, indent=1))
|
|
751
|
+
f.write('\n\n')
|
|
752
|
+
for iri, prop in self.__propclasses.items():
|
|
753
|
+
if not prop.internal:
|
|
754
|
+
f.write(prop.create_shacl(timestamp=timestamp, indent=1))
|
|
755
|
+
f.write('\n\n')
|
|
756
|
+
for iri, resclass in self.__resclasses.items():
|
|
757
|
+
f.write(resclass.create_shacl(timestamp=timestamp, indent=1))
|
|
758
|
+
f.write('\n\n')
|
|
759
|
+
f.write(f'\n{blank:{indent * indent_inc}}}}\n')
|
|
760
|
+
|
|
761
|
+
f.write(f'{blank:{indent * indent_inc}}{self.__graph}:onto {{\n')
|
|
762
|
+
f.write(f'{blank:{(indent + 2) * indent_inc}}{self.__graph}:ontology owl:type owl:Ontology ;\n')
|
|
763
|
+
f.write(f'{blank:{(indent + 2) * indent_inc}}owl:versionInfo {self.__version.toRdf} .\n')
|
|
764
|
+
f.write('\n')
|
|
765
|
+
for iri, prop in self.__propclasses.items():
|
|
766
|
+
f.write(prop.create_owl_part1(timestamp=timestamp, indent=2))
|
|
767
|
+
for iri, resclass in self.__resclasses.items():
|
|
768
|
+
f.write(resclass.create_owl(timestamp=timestamp))
|
|
769
|
+
f.write(f'{blank:{indent * indent_inc}}}}\n')
|
|
770
|
+
|
|
771
|
+
def write_as_trig(self, filename: str, indent: int = 0, indent_inc: int = 4) -> None:
|
|
746
772
|
with open(filename, 'w') as f:
|
|
747
|
-
|
|
748
|
-
blank = ''
|
|
749
|
-
context = Context(name=self._con.context_name)
|
|
750
|
-
f.write('\n')
|
|
751
|
-
f.write(context.turtle_context)
|
|
752
|
-
f.write(f'\n{blank:{indent * indent_inc}}{self.__graph}:shacl {{\n')
|
|
753
|
-
f.write(f'{blank:{(indent + 1) * indent_inc}}{self.__graph}:shapes schema:version {self.__version.toRdf} .\n')
|
|
754
|
-
f.write('\n')
|
|
755
|
-
for qname, onto in self.__extontos.items():
|
|
756
|
-
f.write(onto.create_shacl(timestamp=timestamp, indent=1))
|
|
757
|
-
f.write('\n\n')
|
|
758
|
-
for iri, prop in self.__propclasses.items():
|
|
759
|
-
if not prop.internal:
|
|
760
|
-
f.write(prop.create_shacl(timestamp=timestamp, indent=1))
|
|
761
|
-
f.write('\n\n')
|
|
762
|
-
for iri, resclass in self.__resclasses.items():
|
|
763
|
-
f.write(resclass.create_shacl(timestamp=timestamp, indent=1))
|
|
764
|
-
f.write('\n\n')
|
|
765
|
-
f.write(f'\n{blank:{indent * indent_inc}}}}\n')
|
|
766
|
-
|
|
767
|
-
f.write(f'{blank:{indent * indent_inc}}{self.__graph}:onto {{\n')
|
|
768
|
-
f.write(f'{blank:{(indent + 2) * indent_inc}}{self.__graph}:ontology owl:type owl:Ontology ;\n')
|
|
769
|
-
f.write(f'{blank:{(indent + 2) * indent_inc}}owl:versionInfo {self.__version.toRdf} .\n')
|
|
770
|
-
f.write('\n')
|
|
771
|
-
for iri, prop in self.__propclasses.items():
|
|
772
|
-
f.write(prop.create_owl_part1(timestamp=timestamp, indent=2))
|
|
773
|
-
for iri, resclass in self.__resclasses.items():
|
|
774
|
-
f.write(resclass.create_owl(timestamp=timestamp))
|
|
775
|
-
f.write(f'{blank:{indent * indent_inc}}}}\n')
|
|
773
|
+
self.__to_trig_format(f, indent=indent, indent_inc=indent_inc)
|
|
776
774
|
|
|
775
|
+
def write_as_str(self, indent: int = 0, indent_inc: int = 4) -> str:
|
|
776
|
+
f = io.StringIO()
|
|
777
|
+
self.__to_trig_format(f, indent=indent, indent_inc=indent_inc)
|
|
778
|
+
return f.getvalue()
|
|
777
779
|
|
|
778
780
|
|
|
779
781
|
|
oldaplib/src/helpers/context.py
CHANGED
|
@@ -48,6 +48,7 @@ class ContextSingleton(type):
|
|
|
48
48
|
Xsd_NCName('schema'): NamespaceIRI('http://schema.org/'),
|
|
49
49
|
#Xsd_NCName('dc'): NamespaceIRI('http://purl.org/dc/elements/1.1/'),
|
|
50
50
|
Xsd_NCName('dcterms'): NamespaceIRI('http://purl.org/dc/terms/'),
|
|
51
|
+
Xsd_NCName('dcmitype'): NamespaceIRI('http://purl.org/dc/dcmitype/'),
|
|
51
52
|
#Xsd_NCName('foaf'): NamespaceIRI('http://xmlns.com/foaf/0.1/'),
|
|
52
53
|
Xsd_NCName('oldap'): NamespaceIRI('http://oldap.org/base#'),
|
|
53
54
|
Xsd_NCName('shared'): NamespaceIRI('http://oldap.org/shared#')
|
|
@@ -63,6 +64,7 @@ class ContextSingleton(type):
|
|
|
63
64
|
NamespaceIRI('http://schema.org/'): Xsd_NCName('schema'),
|
|
64
65
|
#NamespaceIRI('http://purl.org/dc/elements/1.1/'): Xsd_NCName('dc'),
|
|
65
66
|
NamespaceIRI('http://purl.org/dc/terms/'): Xsd_NCName('dcterms'),
|
|
67
|
+
NamespaceIRI('http://purl.org/dc/dcmitype/'): Xsd_NCName('dcmitype'),
|
|
66
68
|
#NamespaceIRI('http://xmlns.com/foaf/0.1/'): Xsd_NCName('foaf'),
|
|
67
69
|
NamespaceIRI('http://oldap.org/base#'): Xsd_NCName('oldap'),
|
|
68
70
|
NamespaceIRI('http://oldap.org/shared#'): Xsd_NCName('shared'),
|
|
@@ -237,7 +239,7 @@ class Context(metaclass=ContextSingleton):
|
|
|
237
239
|
return Xsd_QName(prefix, fragment, validate=validate)
|
|
238
240
|
return None
|
|
239
241
|
|
|
240
|
-
def qname2iri(self, qname: Xsd_QName | str, validate: bool = True) ->
|
|
242
|
+
def qname2iri(self, qname: Xsd_QName | str, validate: bool = True) -> Xsd_anyURI:
|
|
241
243
|
"""
|
|
242
244
|
Convert a QName into a IRI string.
|
|
243
245
|
|
oldaplib/src/objectfactory.py
CHANGED
|
@@ -231,8 +231,25 @@ class ResourceInstance:
|
|
|
231
231
|
return # TODO: LangString does not yet allow multiple entries of the same language...
|
|
232
232
|
if property.get(PropClassAttr.IN):
|
|
233
233
|
#for val in values:
|
|
234
|
-
if
|
|
235
|
-
|
|
234
|
+
if property.datatype is None: # no defined datatype, e.h.sh:IRI
|
|
235
|
+
tmpinset = {str(x) for x in property[PropClassAttr.IN]}
|
|
236
|
+
if isinstance(values, (list, tuple, set, ObservableSet)):
|
|
237
|
+
for val in values:
|
|
238
|
+
if not str(val) in tmpinset:
|
|
239
|
+
raise OldapErrorValue(
|
|
240
|
+
f'Property {property} with IN={property[PropClassAttr.IN]} has invalid value "{val}"')
|
|
241
|
+
else:
|
|
242
|
+
if not str(values) in tmpinset:
|
|
243
|
+
raise OldapErrorValue(f'Property {property.property_class_iri} with IN={property[PropClassAttr.IN]} has invalid value "{values}"')
|
|
244
|
+
else:
|
|
245
|
+
if isinstance(values, (list, tuple, set, ObservableSet)):
|
|
246
|
+
for val in values:
|
|
247
|
+
if not val in property[PropClassAttr.IN]:
|
|
248
|
+
raise OldapErrorValue(
|
|
249
|
+
f'Property {property} with IN={property[PropClassAttr.IN]} has invalid value "{val}"')
|
|
250
|
+
else:
|
|
251
|
+
if not values in property[PropClassAttr.IN]:
|
|
252
|
+
raise OldapErrorValue(f'Property {property.property_class_iri} with IN={property[PropClassAttr.IN]} has invalid value "{values}"')
|
|
236
253
|
if property.get(PropClassAttr.MIN_LENGTH):
|
|
237
254
|
for val in values:
|
|
238
255
|
l = 0
|
oldaplib/src/oldaplist.py
CHANGED
|
@@ -725,6 +725,7 @@ class OldapList(Model):
|
|
|
725
725
|
self.clear_changeset()
|
|
726
726
|
|
|
727
727
|
cache = CacheSingletonRedis()
|
|
728
|
+
cache.delete(Xsd_QName(self.project.projectShortName, 'shacl'))
|
|
728
729
|
cache.set(self.__iri, self)
|
|
729
730
|
|
|
730
731
|
def update(self, indent: int = 0, indent_inc: int = 4) -> None:
|
|
@@ -798,6 +799,7 @@ class OldapList(Model):
|
|
|
798
799
|
#
|
|
799
800
|
cache = CacheSingletonRedis()
|
|
800
801
|
cache.delete(self.__iri)
|
|
802
|
+
cache.delete(Xsd_QName(self.project.projectShortName, 'shacl'))
|
|
801
803
|
|
|
802
804
|
|
|
803
805
|
def in_use_queries(self) -> (str, str):
|
oldaplib/src/permissionset.py
CHANGED
|
@@ -190,6 +190,21 @@ class PermissionSet(Model):
|
|
|
190
190
|
def qname(self) -> Xsd_QName:
|
|
191
191
|
return self.__permset_iri
|
|
192
192
|
|
|
193
|
+
def trig_to_str(self, created: Xsd_dateTime, modified: Xsd_dateTime, indent: int = 0, indent_inc: int = 4):
|
|
194
|
+
blank = ''
|
|
195
|
+
sparql = ''
|
|
196
|
+
sparql += f'{blank:{indent * indent_inc}} {self.__permset_iri.toRdf} a oldap:PermissionSet'
|
|
197
|
+
sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}dcterms:creator {self._con.userIri.toRdf}'
|
|
198
|
+
sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}dcterms:created {created.toRdf}'
|
|
199
|
+
sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}dcterms:contributor {self._con.userIri.toRdf}'
|
|
200
|
+
sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}dcterms:modified {modified.toRdf}'
|
|
201
|
+
for attr, value in self._attributes.items():
|
|
202
|
+
if attr.value.prefix == 'virtual' or not value:
|
|
203
|
+
continue
|
|
204
|
+
sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}{attr.value.toRdf} {value.toRdf}'
|
|
205
|
+
return sparql
|
|
206
|
+
|
|
207
|
+
|
|
193
208
|
def create(self, indent: int = 0, indent_inc: int = 4) -> None:
|
|
194
209
|
"""
|
|
195
210
|
Creates and stores a permission set in the triple store.
|
|
@@ -236,15 +251,16 @@ class PermissionSet(Model):
|
|
|
236
251
|
sparql += f'{blank:{indent * indent_inc}}INSERT DATA {{\n'
|
|
237
252
|
sparql += f'{blank:{(indent + 1) * indent_inc}}GRAPH oldap:admin {{\n'
|
|
238
253
|
|
|
239
|
-
sparql +=
|
|
240
|
-
sparql += f'
|
|
241
|
-
sparql += f' ;\n{blank:{(indent + 3) * indent_inc}}dcterms:
|
|
242
|
-
sparql += f' ;\n{blank:{(indent + 3) * indent_inc}}dcterms:
|
|
243
|
-
sparql += f' ;\n{blank:{(indent + 3) * indent_inc}}dcterms:
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
254
|
+
sparql += self.trig_to_str(created=timestamp, modified=timestamp, indent=indent + 2, indent_inc=indent_inc)
|
|
255
|
+
# sparql += f'{blank:{(indent + 2) * indent_inc}} {self.__permset_iri.toRdf} a oldap:PermissionSet'
|
|
256
|
+
# sparql += f' ;\n{blank:{(indent + 3) * indent_inc}}dcterms:creator {self._con.userIri.toRdf}'
|
|
257
|
+
# sparql += f' ;\n{blank:{(indent + 3) * indent_inc}}dcterms:created {timestamp.toRdf}'
|
|
258
|
+
# sparql += f' ;\n{blank:{(indent + 3) * indent_inc}}dcterms:contributor {self._con.userIri.toRdf}'
|
|
259
|
+
# sparql += f' ;\n{blank:{(indent + 3) * indent_inc}}dcterms:modified {timestamp.toRdf}'
|
|
260
|
+
# for attr, value in self._attributes.items():
|
|
261
|
+
# if attr.value.prefix == 'virtual' or not value:
|
|
262
|
+
# continue
|
|
263
|
+
# sparql += f' ;\n{blank:{(indent + 3) * indent_inc}}{attr.value.toRdf} {value.toRdf}'
|
|
248
264
|
sparql += f'\n{blank:{(indent + 1) * indent_inc}}}}\n'
|
|
249
265
|
sparql += f'{blank:{indent * indent_inc}}}}\n'
|
|
250
266
|
|
|
@@ -307,6 +323,7 @@ class PermissionSet(Model):
|
|
|
307
323
|
:raises OldapErrorInconsistency: Raised if the permission set contains inconsistencies
|
|
308
324
|
in its data during retrieval.
|
|
309
325
|
"""
|
|
326
|
+
context = Context(name=con.context_name)
|
|
310
327
|
if qname:
|
|
311
328
|
permset_iri = Xsd_QName(qname, validate=True)
|
|
312
329
|
elif permissionSetId and definedByProject:
|
|
@@ -325,7 +342,6 @@ class PermissionSet(Model):
|
|
|
325
342
|
if tmp is not None:
|
|
326
343
|
tmp.update_notifier()
|
|
327
344
|
return tmp
|
|
328
|
-
context = Context(name=con.context_name)
|
|
329
345
|
sparql = context.sparql_context
|
|
330
346
|
sparql += f"""
|
|
331
347
|
SELECT ?permset ?p ?o
|
oldaplib/src/project.py
CHANGED
|
@@ -426,6 +426,21 @@ class Project(Model):
|
|
|
426
426
|
projects.append(ProjectSearchResult(r['project'], r['shortname']))
|
|
427
427
|
return projects
|
|
428
428
|
|
|
429
|
+
|
|
430
|
+
def trig_to_str(self, created: Xsd_dateTime, modified: Xsd_dateTime,indent: int = 0, indent_inc: int = 4):
|
|
431
|
+
blank = ''
|
|
432
|
+
sparql = ''
|
|
433
|
+
sparql += f'\n{blank:{indent * indent_inc}}{self.projectIri.toRdf} a oldap:Project'
|
|
434
|
+
sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}dcterms:creator {self._con.userIri.toRdf}'
|
|
435
|
+
sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}dcterms:created {created.toRdf}'
|
|
436
|
+
sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}dcterms:contributor {self._con.userIri.toRdf}'
|
|
437
|
+
sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}dcterms:modified {modified.toRdf}'
|
|
438
|
+
for attr, value in self._attributes.items():
|
|
439
|
+
if not value:
|
|
440
|
+
continue
|
|
441
|
+
sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}{attr.value.toRdf} {value.toRdf}'
|
|
442
|
+
return sparql
|
|
443
|
+
|
|
429
444
|
def create(self, indent: int = 0, indent_inc: int = 4) -> None:
|
|
430
445
|
"""
|
|
431
446
|
Creates a new project in the triple store. The function starts by
|
|
@@ -459,11 +474,14 @@ class Project(Model):
|
|
|
459
474
|
raise OldapErrorNoPermission(message)
|
|
460
475
|
|
|
461
476
|
timestamp = Xsd_dateTime.now()
|
|
462
|
-
indent: int = 0
|
|
463
|
-
indent_inc: int = 4
|
|
477
|
+
#indent: int = 0
|
|
478
|
+
#indent_inc: int = 4
|
|
464
479
|
|
|
465
480
|
context = Context(name=self._con.context_name)
|
|
466
481
|
|
|
482
|
+
#
|
|
483
|
+
# SPARQL to check if project with the given projectShortName already exists
|
|
484
|
+
#
|
|
467
485
|
sparql0 = context.sparql_context
|
|
468
486
|
sparql0 += f"""
|
|
469
487
|
ASK {{
|
|
@@ -475,15 +493,9 @@ class Project(Model):
|
|
|
475
493
|
}}
|
|
476
494
|
"""
|
|
477
495
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
FROM oldap:admin
|
|
482
|
-
WHERE {{
|
|
483
|
-
?project a oldap:Project .
|
|
484
|
-
FILTER(?project = {self.projectIri.toRdf})
|
|
485
|
-
}}
|
|
486
|
-
"""
|
|
496
|
+
#
|
|
497
|
+
# SPARQL to check if the given namespaceIri is already used by another project
|
|
498
|
+
#
|
|
487
499
|
sparql1a = context.sparql_context
|
|
488
500
|
sparql1a += f"""
|
|
489
501
|
ASK {{
|
|
@@ -493,6 +505,9 @@ class Project(Model):
|
|
|
493
505
|
}}
|
|
494
506
|
"""
|
|
495
507
|
|
|
508
|
+
#
|
|
509
|
+
# SPARQL to check if project with the given projectIri already exists
|
|
510
|
+
#
|
|
496
511
|
sparql1b = context.sparql_context
|
|
497
512
|
sparql1b += f"""
|
|
498
513
|
ASK {{
|
|
@@ -506,15 +521,16 @@ class Project(Model):
|
|
|
506
521
|
sparql2 = context.sparql_context
|
|
507
522
|
sparql2 += f'{blank:{indent * indent_inc}}INSERT DATA {{'
|
|
508
523
|
sparql2 += f'\n{blank:{(indent + 1) * indent_inc}}GRAPH oldap:admin {{'
|
|
509
|
-
sparql2 +=
|
|
510
|
-
sparql2 += f'
|
|
511
|
-
sparql2 += f' ;\n{blank:{(indent + 3) * indent_inc}}dcterms:
|
|
512
|
-
sparql2 += f' ;\n{blank:{(indent + 3) * indent_inc}}dcterms:
|
|
513
|
-
sparql2 += f' ;\n{blank:{(indent + 3) * indent_inc}}dcterms:
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
524
|
+
sparql2 += self.trig_to_str(created=timestamp, modified=timestamp, indent=indent + 2, indent_inc=indent_inc)
|
|
525
|
+
# sparql2 += f'\n{blank:{(indent + 2) * indent_inc}}{self.projectIri.toRdf} a oldap:Project'
|
|
526
|
+
# sparql2 += f' ;\n{blank:{(indent + 3) * indent_inc}}dcterms:creator {self._con.userIri.toRdf}'
|
|
527
|
+
# sparql2 += f' ;\n{blank:{(indent + 3) * indent_inc}}dcterms:created {timestamp.toRdf}'
|
|
528
|
+
# sparql2 += f' ;\n{blank:{(indent + 3) * indent_inc}}dcterms:contributor {self._con.userIri.toRdf}'
|
|
529
|
+
# sparql2 += f' ;\n{blank:{(indent + 3) * indent_inc}}dcterms:modified {timestamp.toRdf}'
|
|
530
|
+
# for attr, value in self._attributes.items():
|
|
531
|
+
# if not value:
|
|
532
|
+
# continue
|
|
533
|
+
# sparql2 += f' ;\n{blank:{(indent + 3) * indent_inc}}{attr.value.toRdf} {value.toRdf}'
|
|
518
534
|
sparql2 += f' .\n{blank:{(indent + 1) * indent_inc}}}}\n'
|
|
519
535
|
sparql2 += f'{blank:{indent * indent_inc}}}}\n'
|
|
520
536
|
|
oldaplib/src/user.py
CHANGED
|
@@ -363,7 +363,43 @@ class User(Model):
|
|
|
363
363
|
self._changeset[UserAttr.IN_PROJECT] = AttributeChange(self._attributes[UserAttr.IN_PROJECT], Action.MODIFY)
|
|
364
364
|
self._attributes[UserAttr.IN_PROJECT][project].remove(permission)
|
|
365
365
|
|
|
366
|
-
def
|
|
366
|
+
def trig_to_str(self,
|
|
367
|
+
creator: Iri,
|
|
368
|
+
created: Xsd_dateTime,
|
|
369
|
+
contributor: Iri,
|
|
370
|
+
modified: Xsd_dateTime,
|
|
371
|
+
indent: int = 0, indent_inc: int = 4):
|
|
372
|
+
blank = ''
|
|
373
|
+
sparql = ''
|
|
374
|
+
sparql += f'{blank:{indent * indent_inc}}{self.userIri.toRdf} a oldap:User'
|
|
375
|
+
sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}dcterms:creator {creator.toRdf}'
|
|
376
|
+
sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}dcterms:created {created.toRdf}'
|
|
377
|
+
sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}dcterms:contributor {contributor.toRdf}'
|
|
378
|
+
sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}dcterms:modified {modified.toRdf}'
|
|
379
|
+
sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}oldap:userId {self.userId.toRdf}'
|
|
380
|
+
sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}schema:familyName {self.familyName.toRdf}'
|
|
381
|
+
sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}schema:givenName {self.givenName.toRdf}'
|
|
382
|
+
sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}schema:email {self.email.toRdf}'
|
|
383
|
+
sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}oldap:credentials {self.credentials.toRdf}'
|
|
384
|
+
activeval = "true" if self.isActive else "false"
|
|
385
|
+
sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}oldap:isActive {activeval}'
|
|
386
|
+
star = ''
|
|
387
|
+
if self.inProject:
|
|
388
|
+
project = [p.toRdf for p in self.inProject.keys()]
|
|
389
|
+
rdfstr = ", ".join(project)
|
|
390
|
+
sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}oldap:inProject {rdfstr}'
|
|
391
|
+
for p in self.inProject.keys():
|
|
392
|
+
for admin_p in self.inProject[p]: # TODO: May be use .get() instead of [] !!!!!!!!!!!!!!!!!!!!!!!!!
|
|
393
|
+
star += f'{blank:{indent * indent_inc}}<<{self.userIri.toRdf} oldap:inProject {p.toRdf}>> oldap:hasAdminPermission {admin_p.value} .\n'
|
|
394
|
+
if self.hasPermissions:
|
|
395
|
+
rdfstr = ", ".join([str(x) for x in self.hasPermissions])
|
|
396
|
+
sparql += f' ;\n{blank:{(indent + 1) * indent_inc}}oldap:hasPermissions {rdfstr}'
|
|
397
|
+
sparql += " .\n\n"
|
|
398
|
+
sparql += star
|
|
399
|
+
return sparql
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
def create(self, indent: int = 0, indent_inc: int = 4, keep_dates: bool = False) -> None:
|
|
367
403
|
"""
|
|
368
404
|
Creates a user in the triple store with the provided details. Before proceeding with the
|
|
369
405
|
creation, it verifies the uniqueness of the `userId` and `userIri`. The user is created
|
|
@@ -444,31 +480,43 @@ class User(Model):
|
|
|
444
480
|
sparql += f'{blank:{indent * indent_inc}}INSERT DATA {{\n'
|
|
445
481
|
sparql += f'{blank:{(indent + 1) * indent_inc}}GRAPH oldap:admin {{\n'
|
|
446
482
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
sparql +=
|
|
471
|
-
|
|
483
|
+
if keep_dates:
|
|
484
|
+
sparql += self.trig_to_str(creator=self.creator,
|
|
485
|
+
created=self.created,
|
|
486
|
+
contributor=self.contributor,
|
|
487
|
+
modified=self.modified,
|
|
488
|
+
indent=indent + 2, indent_inc=indent_inc)
|
|
489
|
+
else:
|
|
490
|
+
sparql += self.trig_to_str(creator=self._con.userIri,
|
|
491
|
+
created=timestamp,
|
|
492
|
+
contributor=self._con.userIri,
|
|
493
|
+
modified=timestamp,
|
|
494
|
+
indent=indent + 2, indent_inc=indent_inc)
|
|
495
|
+
# sparql += f'{blank:{(indent + 2) * indent_inc}}{self.userIri.toRdf} a oldap:User'
|
|
496
|
+
# sparql += f' ;\n{blank:{(indent + 3) * indent_inc}}dcterms:creator {self._con.userIri.toRdf}'
|
|
497
|
+
# sparql += f' ;\n{blank:{(indent + 3) * indent_inc}}dcterms:created {timestamp.toRdf}'
|
|
498
|
+
# sparql += f' ;\n{blank:{(indent + 3) * indent_inc}}dcterms:contributor {self._con.userIri.toRdf}'
|
|
499
|
+
# sparql += f' ;\n{blank:{(indent + 3) * indent_inc}}dcterms:modified {timestamp.toRdf}'
|
|
500
|
+
# sparql += f' ;\n{blank:{(indent + 3) * indent_inc}}oldap:userId {self.userId.toRdf}'
|
|
501
|
+
# sparql += f' ;\n{blank:{(indent + 3) * indent_inc}}schema:familyName {self.familyName.toRdf}'
|
|
502
|
+
# sparql += f' ;\n{blank:{(indent + 3) * indent_inc}}schema:givenName {self.givenName.toRdf}'
|
|
503
|
+
# sparql += f' ;\n{blank:{(indent + 3) * indent_inc}}schema:email {self.email.toRdf}'
|
|
504
|
+
# sparql += f' ;\n{blank:{(indent + 3) * indent_inc}}oldap:credentials {self.credentials.toRdf}'
|
|
505
|
+
# activeval = "true" if self.isActive else "false"
|
|
506
|
+
# sparql += f' ;\n{blank:{(indent + 3) * indent_inc}}oldap:isActive {activeval}'
|
|
507
|
+
# star = ''
|
|
508
|
+
# if self.inProject:
|
|
509
|
+
# project = [p.toRdf for p in self.inProject.keys()]
|
|
510
|
+
# rdfstr = ", ".join(project)
|
|
511
|
+
# sparql += f' ;\n{blank:{(indent + 3) * indent_inc}}oldap:inProject {rdfstr}'
|
|
512
|
+
# for p in self.inProject.keys():
|
|
513
|
+
# for admin_p in self.inProject[p]: # TODO: May be use .get() instead of [] !!!!!!!!!!!!!!!!!!!!!!!!!
|
|
514
|
+
# star += f'{blank:{(indent + 2) * indent_inc}}<<{self.userIri.toRdf} oldap:inProject {p.toRdf}>> oldap:hasAdminPermission {admin_p.value} .\n'
|
|
515
|
+
# if self.hasPermissions:
|
|
516
|
+
# rdfstr = ", ".join([str(x) for x in self.hasPermissions])
|
|
517
|
+
# sparql += f' ;\n{blank:{(indent + 3) * indent_inc}}oldap:hasPermissions {rdfstr}'
|
|
518
|
+
# sparql += " .\n\n"
|
|
519
|
+
# sparql += star
|
|
472
520
|
sparql += f'{blank:{(indent + 1) * indent_inc}}}}\n'
|
|
473
521
|
sparql += f'{blank:{indent * indent_inc}}}}\n'
|
|
474
522
|
|
oldaplib/src/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.3.
|
|
1
|
+
__version__ = "0.3.28"
|
oldaplib/src/xsd/xsd_anyuri.py
CHANGED
|
@@ -69,15 +69,15 @@ class Xsd_anyURI(Xsd):
|
|
|
69
69
|
raise OldapErrorValue(f'Invalid URN format for "{value}".')
|
|
70
70
|
elif value.startswith("http"):
|
|
71
71
|
if not re.match(self._uri_pattern, str(value)):
|
|
72
|
-
raise OldapErrorValue(f'Invalid string "{value}" for xsd:anyURI.')
|
|
72
|
+
raise OldapErrorValue(f'Invalid string "{value}" for xsd:anyURI (regexp).')
|
|
73
73
|
if validate:
|
|
74
74
|
if not XsdValidator.validate(XsdDatatypes.anyURI, str(value)):
|
|
75
|
-
raise OldapErrorValue(f'Invalid string "{value}" for anyURI')
|
|
75
|
+
raise OldapErrorValue(f'Invalid string "{value}" for xsd:anyURI (validator)')
|
|
76
76
|
else:
|
|
77
77
|
if not url(str(value)):
|
|
78
|
-
raise OldapErrorValue(f'Invalid string "{value}" for xsd:anyURI.')
|
|
78
|
+
raise OldapErrorValue(f'Invalid string "{value}" for xsd:anyURI (url()).')
|
|
79
79
|
else:
|
|
80
|
-
raise OldapErrorValue(f'Invalid string "{value}" for anyURI')
|
|
80
|
+
raise OldapErrorValue(f'Invalid string "{value}" for anyURI (no urn:/http:)')
|
|
81
81
|
self._value = str(value)
|
|
82
82
|
self._append_allowed = self._value[-1] == '/' or self._value[-1] == '#'
|
|
83
83
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from oldaplib.src.connection import Connection
|
|
2
|
+
import unittest
|
|
3
|
+
|
|
4
|
+
from oldaplib.src.datamodel import DataModel
|
|
5
|
+
from oldaplib.src.project import Project
|
|
6
|
+
|
|
7
|
+
class TestDataModel(unittest.TestCase):
|
|
8
|
+
|
|
9
|
+
# @unittest.skip('Work in progress')
|
|
10
|
+
def test_fasnacht(self):
|
|
11
|
+
connection = Connection(userId="rosenth",
|
|
12
|
+
credentials="RioGrande",
|
|
13
|
+
context_name="DEFAULT")
|
|
14
|
+
|
|
15
|
+
project = Project.read(connection, "fasnacht")
|
|
16
|
+
dm = DataModel.read(connection, project, ignore_cache=False)
|
|
17
|
+
pass
|
oldaplib/test/test_connection.py
CHANGED
|
@@ -52,7 +52,6 @@ class TestBasicConnection(unittest.TestCase):
|
|
|
52
52
|
cls._connection.clear_graph(Xsd_QName('test:onto'))
|
|
53
53
|
file = project_root / 'oldaplib' / 'testdata' / 'connection_test.trig'
|
|
54
54
|
cls._connection.upload_turtle(file)
|
|
55
|
-
sleep(1) # upload may take a while...
|
|
56
55
|
|
|
57
56
|
@classmethod
|
|
58
57
|
def tearDownClass(cls):
|
oldaplib/test/test_context.py
CHANGED
|
@@ -55,14 +55,14 @@ class TestContext(unittest.TestCase):
|
|
|
55
55
|
self.assertIsNone(qn)
|
|
56
56
|
with self.assertRaises(OldapError) as ex:
|
|
57
57
|
qn = context.iri2qname('waseliwas/soll')
|
|
58
|
-
self.assertEqual(str(ex.exception), 'Invalid string "waseliwas/soll" for anyURI')
|
|
58
|
+
self.assertEqual(str(ex.exception), 'Invalid string "waseliwas/soll" for anyURI (no urn:/http:)')
|
|
59
59
|
|
|
60
60
|
def test_context_qname2iri(self):
|
|
61
61
|
context = Context(name='qname2iri')
|
|
62
62
|
self.assertEqual(context.qname2iri(Xsd_QName('skos:gaga')), 'http://www.w3.org/2004/02/skos/core#gaga')
|
|
63
63
|
with self.assertRaises(OldapError) as ex:
|
|
64
64
|
qn = context.iri2qname('gaga')
|
|
65
|
-
self.assertEqual(str(ex.exception), 'Invalid string "gaga" for anyURI')
|
|
65
|
+
self.assertEqual(str(ex.exception), 'Invalid string "gaga" for anyURI (no urn:/http:)')
|
|
66
66
|
self.assertIsNone(context.iri2qname('abc:def'))
|
|
67
67
|
t = Xsd_QName('xml:integer')
|
|
68
68
|
self.assertEqual(context.qname2iri(t), 'http://www.w3.org/XML/1998/namespace#integer')
|
|
@@ -79,6 +79,7 @@ PREFIX sh: <http://www.w3.org/ns/shacl#>
|
|
|
79
79
|
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
|
|
80
80
|
PREFIX schema: <http://schema.org/>
|
|
81
81
|
PREFIX dcterms: <http://purl.org/dc/terms/>
|
|
82
|
+
PREFIX dcmitype: <http://purl.org/dc/dcmitype/>
|
|
82
83
|
PREFIX oldap: <http://oldap.org/base#>
|
|
83
84
|
PREFIX shared: <http://oldap.org/shared#>
|
|
84
85
|
PREFIX test: <http://www.test.org/gaga#>
|
|
@@ -97,6 +98,7 @@ PREFIX test: <http://www.test.org/gaga#>
|
|
|
97
98
|
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
|
|
98
99
|
@prefix schema: <http://schema.org/> .
|
|
99
100
|
@prefix dcterms: <http://purl.org/dc/terms/> .
|
|
101
|
+
@prefix dcmitype: <http://purl.org/dc/dcmitype/> .
|
|
100
102
|
@prefix oldap: <http://oldap.org/base#> .
|
|
101
103
|
@prefix shared: <http://oldap.org/shared#> .
|
|
102
104
|
@prefix test: <http://www.test.org/gaga#> .
|
oldaplib/test/test_datamodel.py
CHANGED
|
@@ -102,9 +102,6 @@ class TestDataModel(unittest.TestCase):
|
|
|
102
102
|
file = project_root / 'oldaplib' / 'testdata' / 'connection_test.trig'
|
|
103
103
|
cls._connection.upload_turtle(file)
|
|
104
104
|
|
|
105
|
-
|
|
106
|
-
sleep(1) # upload may take a while...
|
|
107
|
-
|
|
108
105
|
cls._project = Project.read(cls._connection, "test", ignore_cache=True)
|
|
109
106
|
cls._dmproject = Project.read(cls._connection, "dmtest", ignore_cache=True)
|
|
110
107
|
cls._dmprojectA = Project.read(cls._connection, "dmtestA", ignore_cache=True)
|
|
@@ -390,6 +387,7 @@ class TestDataModel(unittest.TestCase):
|
|
|
390
387
|
|
|
391
388
|
def test_datamodel_read_shared(self):
|
|
392
389
|
model = DataModel.read(self._connection, self._sharedproject, ignore_cache=True)
|
|
390
|
+
pass
|
|
393
391
|
|
|
394
392
|
def test_datamodel_read_system(self):
|
|
395
393
|
model = DataModel.read(self._connection, self._sysproject, ignore_cache=True)
|
|
@@ -1114,8 +1112,6 @@ class TestDataModel(unittest.TestCase):
|
|
|
1114
1112
|
file = project_root / 'oldaplib' / 'testdata' / 'objectfactory_test.trig'
|
|
1115
1113
|
self._connection.upload_turtle(file)
|
|
1116
1114
|
|
|
1117
|
-
sleep(1) # upload may take a while...
|
|
1118
|
-
|
|
1119
1115
|
cache = CacheSingletonRedis()
|
|
1120
1116
|
cache.clear()
|
|
1121
1117
|
dm1 = DataModel.read(self._connection, self._project, ignore_cache=False)
|
|
@@ -1123,3 +1119,4 @@ class TestDataModel(unittest.TestCase):
|
|
|
1123
1119
|
dm2 = DataModel.read(self._connection, self._project, ignore_cache=False)
|
|
1124
1120
|
|
|
1125
1121
|
pass
|
|
1122
|
+
|
|
@@ -51,7 +51,6 @@ class TestexternalOntologies(unittest.TestCase):
|
|
|
51
51
|
cls._connection.upload_turtle(file)
|
|
52
52
|
file = project_root / 'oldaplib' / 'ontologies' / 'admin-testing.trig'
|
|
53
53
|
cls._connection.upload_turtle(file)
|
|
54
|
-
sleep(1) # upload may take a while...
|
|
55
54
|
|
|
56
55
|
project = Project(con=cls._connection,
|
|
57
56
|
projectIri=Iri("http://extonto.test.org/test"),
|
|
@@ -52,7 +52,6 @@ class TestHasProperty(unittest.TestCase):
|
|
|
52
52
|
|
|
53
53
|
file = project_root / 'oldaplib' / 'testdata' / 'connection_test.trig'
|
|
54
54
|
cls._connection.upload_turtle(file)
|
|
55
|
-
sleep(1) # upload may take a while...
|
|
56
55
|
cls._project = Project.read(cls._connection, "test")
|
|
57
56
|
|
|
58
57
|
@classmethod
|
|
@@ -108,8 +108,6 @@ class TestObjectFactory(unittest.TestCase):
|
|
|
108
108
|
file = project_root / 'oldaplib' / 'testdata' / 'instances_test.trig'
|
|
109
109
|
cls._connection.upload_turtle(file)
|
|
110
110
|
|
|
111
|
-
sleep(1) # upload may take a while...
|
|
112
|
-
|
|
113
111
|
user = User.read(cls._connection, "rosenth")
|
|
114
112
|
user.hasPermissions.add(Iri('oldap:GenericUpdate')) # TODO: SHOULD WORK WITH Xsd_QName
|
|
115
113
|
user.update()
|
|
@@ -362,6 +360,7 @@ class TestObjectFactory(unittest.TestCase):
|
|
|
362
360
|
factory = ResourceInstanceFactory(con=self._connection, project='test')
|
|
363
361
|
MO = factory.createObjectInstance('shared:MediaObject')
|
|
364
362
|
mo = MO(originalName='Cat.tif',
|
|
363
|
+
type='dcmitype:StillImage',
|
|
365
364
|
originalMimeType='image/tiff',
|
|
366
365
|
serverUrl='http://iiif.oldap.org/iiif/3/',
|
|
367
366
|
imageId='cat.tif',
|
|
@@ -547,7 +546,7 @@ class TestObjectFactory(unittest.TestCase):
|
|
|
547
546
|
givenName="Max",
|
|
548
547
|
grantsPermission={Iri('oldap:GenericView'), Iri('oldap:GenericUpdate')})
|
|
549
548
|
p.create()
|
|
550
|
-
|
|
549
|
+
|
|
551
550
|
obj1 = Person.read(con=self._connection,
|
|
552
551
|
iri=p.iri)
|
|
553
552
|
with self.assertRaises(OldapErrorValue):
|
|
@@ -719,6 +718,7 @@ class TestObjectFactory(unittest.TestCase):
|
|
|
719
718
|
factory = ResourceInstanceFactory(con=self._connection, project='test')
|
|
720
719
|
MLE = factory.createObjectInstance('test:MediaLibraryEntry')
|
|
721
720
|
mle = MLE(originalName='MyCarnivalImagetif',
|
|
721
|
+
type='dcmitype:StillImage',
|
|
722
722
|
originalMimeType='image/tiff',
|
|
723
723
|
imageId='x_34dbY4.tif',
|
|
724
724
|
serverUrl='http://iiif.oldap.org/iiif/3/',
|
oldaplib/test/test_oldaplist.py
CHANGED
|
@@ -80,7 +80,7 @@ class TestOldapList(unittest.TestCase):
|
|
|
80
80
|
|
|
81
81
|
file = cls._project_root / 'oldaplib' / 'testdata' / 'connection_test.trig'
|
|
82
82
|
cls._connection.upload_turtle(file)
|
|
83
|
-
|
|
83
|
+
|
|
84
84
|
cls._project = Project.read(cls._connection, "test")
|
|
85
85
|
LangString.defaultLanguage = Language.EN
|
|
86
86
|
|
|
@@ -66,7 +66,7 @@ class OldapListHelperTestCase(unittest.TestCase):
|
|
|
66
66
|
cls._connection.clear_graph(Xsd_QName('hyha:data'))
|
|
67
67
|
file = project_root / 'oldaplib' / 'testdata' / 'connection_test.trig'
|
|
68
68
|
cls._connection.upload_turtle(file)
|
|
69
|
-
|
|
69
|
+
|
|
70
70
|
cls._project = Project.read(cls._connection, "test")
|
|
71
71
|
LangString.defaultLanguage = Language.EN
|
|
72
72
|
|
|
@@ -84,7 +84,6 @@ class TestOldapListNode(unittest.TestCase):
|
|
|
84
84
|
|
|
85
85
|
file = cls._project_root / 'oldaplib' / 'testdata' / 'connection_test.trig'
|
|
86
86
|
cls._connection.upload_turtle(file)
|
|
87
|
-
sleep(1)
|
|
88
87
|
|
|
89
88
|
cls._project = Project.read(cls._connection, "test")
|
|
90
89
|
cls._dmproject = Project.read(cls._connection, "dmtest", ignore_cache=True)
|
|
@@ -78,7 +78,7 @@ class TestPermissionSet(unittest.TestCase):
|
|
|
78
78
|
cls._connection.clear_graph(Xsd_QName('test:data'))
|
|
79
79
|
file = cls._project_root / 'oldaplib' / 'testdata' / 'connection_test.trig'
|
|
80
80
|
cls._connection.upload_turtle(file)
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
cls._project = Project.read(cls._connection, "test")
|
|
83
83
|
LangString.defaultLanguage = Language.EN
|
|
84
84
|
|
|
@@ -347,6 +347,7 @@ class TestPermissionSet(unittest.TestCase):
|
|
|
347
347
|
ps.update()
|
|
348
348
|
ps = PermissionSet.read(con=self._connection, permissionSetId=psId, definedByProject=Iri('oldap:SystemProject'))
|
|
349
349
|
self.assertEqual(ps.givesPermission, DataPermission.DATA_VIEW)
|
|
350
|
+
self.assertEqual(ps.givesPermission, DataPermission.DATA_VIEW)
|
|
350
351
|
self.assertEqual(ps.label, LangString("testUpdatePerm@en", "testVerändernPerm@de", "testeModificationPerm@fr"))
|
|
351
352
|
del ps.comment
|
|
352
353
|
ps.update()
|
oldaplib/test/test_project.py
CHANGED
|
@@ -56,7 +56,6 @@ class Testproject(unittest.TestCase):
|
|
|
56
56
|
cls._connection.upload_turtle(file)
|
|
57
57
|
file = project_root / 'oldaplib' / 'ontologies' / 'admin-testing.trig'
|
|
58
58
|
cls._connection.upload_turtle(file)
|
|
59
|
-
sleep(1) # upload may take a while...
|
|
60
59
|
|
|
61
60
|
@classmethod
|
|
62
61
|
def tearDownClass(cls):
|
|
@@ -70,7 +70,6 @@ class TestPropertyClass(unittest.TestCase):
|
|
|
70
70
|
cls._connection.clear_graph(Xsd_QName('test:onto'))
|
|
71
71
|
file = project_root / 'oldaplib' / 'testdata' / 'connection_test.trig'
|
|
72
72
|
cls._connection.upload_turtle(file)
|
|
73
|
-
sleep(1) # upload may take a while...
|
|
74
73
|
cls._project = Project.read(cls._connection, "test")
|
|
75
74
|
cls._sysproject = Project.read(cls._connection, "oldap")
|
|
76
75
|
|
|
@@ -137,7 +137,7 @@ class TestResourceClass(unittest.TestCase):
|
|
|
137
137
|
|
|
138
138
|
file = project_root / 'oldaplib' / 'testdata' / 'connection_test.trig'
|
|
139
139
|
cls._connection.upload_turtle(file)
|
|
140
|
-
|
|
140
|
+
|
|
141
141
|
cls._project = Project.read(cls._connection, "test")
|
|
142
142
|
cls._sysproject = Project.read(cls._connection, "oldap", ignore_cache=True)
|
|
143
143
|
|
oldaplib/test/test_user.py
CHANGED
|
@@ -281,7 +281,7 @@ class TestXsdDatatypes(unittest.TestCase):
|
|
|
281
281
|
self.assertEqual(hash(val1), hash(val2))
|
|
282
282
|
with self.assertRaises(OldapErrorValue) as ex:
|
|
283
283
|
val = Xsd_anyURI('waseliwas', validate=True)
|
|
284
|
-
self.assertEqual(str(ex.exception), 'Invalid string "waseliwas" for anyURI')
|
|
284
|
+
self.assertEqual(str(ex.exception), 'Invalid string "waseliwas" for anyURI (no urn:/http:)')
|
|
285
285
|
|
|
286
286
|
def test_xsd_base64binary(self):
|
|
287
287
|
data = base64.b64encode(b'Waseliwas soll den das sein?')
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
oldaplib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
oldaplib/apps/load_list.py,sha256=Dr0oLPUMoJkAD55_flAt6y8hjx_ci7uuOQzYBUOr8Sc,1840
|
|
3
2
|
oldaplib/ontologies/admin-testing.trig,sha256=O1_WateUvdouG0zEdnNG0BWkIIMdoTGaTqb1wAD8njs,5694
|
|
4
3
|
oldaplib/ontologies/admin.trig,sha256=ByxFYdI9rh-RhLnSpkdZHMMWgXCSTi2YMJc1QgBHFhE,8963
|
|
5
4
|
oldaplib/ontologies/example.trig,sha256=MdRrFBZZ1L6aUDiT6aX4cnXiy-RoZHczF3Exn7aBSmU,1518
|
|
6
5
|
oldaplib/ontologies/oldap.trig,sha256=i2XanqKlhWSIdD17fLu5g0Luq2GORQCcyIfLn9Kummk,60241
|
|
7
6
|
oldaplib/ontologies/oldap.ttl,sha256=qdA0uiSjzVhkc1d5IN2y5ioK1QMzwl-TTnn3M_D1Kh8,29446
|
|
8
|
-
oldaplib/ontologies/shared.trig,sha256=
|
|
7
|
+
oldaplib/ontologies/shared.trig,sha256=8BMbhsqmnGAFUotc1bGc6morWhJqU0pCGy9TlkiEKIY,27550
|
|
9
8
|
oldaplib/ontologies/standard/.gitsave,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
9
|
oldaplib/src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
10
|
oldaplib/src/cachesingleton.py,sha256=WGhuFER-mTnOJmwaN17fXPAg7zn7GJBm-XadShNUBBk,3687
|
|
12
|
-
oldaplib/src/connection.py,sha256=
|
|
13
|
-
oldaplib/src/datamodel.py,sha256=
|
|
11
|
+
oldaplib/src/connection.py,sha256=CmQWJgsLx1mTOUV_uSGamA8OoyomfsABR7wM2UX_muY,27549
|
|
12
|
+
oldaplib/src/datamodel.py,sha256=Fn9IkU-niOFq7Ih1km9BPHHnCd_klEqU3-6uMGwPKZY,35343
|
|
14
13
|
oldaplib/src/dtypes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
14
|
oldaplib/src/dtypes/bnode.py,sha256=7Swl77PJlzahov7d7ijJExmoVsTkR5JFOvFQf1jDmEg,1555
|
|
16
15
|
oldaplib/src/dtypes/languagein.py,sha256=6h3VrTH8IcTN6mvnWuGvzDoKX_Jh6h9w3wWrLuAWfVc,8593
|
|
@@ -41,7 +40,7 @@ oldaplib/src/hasproperty.py,sha256=w2rNuhqyWdJYAXnGROFLZUyafCpznPv-h_XuQSFWbqs,1
|
|
|
41
40
|
oldaplib/src/helpers/Notify.py,sha256=9zzO93F4V4lj-xF6b3hpRg1QkI4TR_GYEh3ptsohlfQ,2008
|
|
42
41
|
oldaplib/src/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
43
42
|
oldaplib/src/helpers/attributechange.py,sha256=aQ5Q9s6U3bVd1WSNQcBpkr5UQVxeP4z_uz0K5_31ZVc,256
|
|
44
|
-
oldaplib/src/helpers/context.py,sha256=
|
|
43
|
+
oldaplib/src/helpers/context.py,sha256=HyI7GG3D67xdurBYGqd0Uyzy8yFuBXjaVwf1dykBzbo,11766
|
|
45
44
|
oldaplib/src/helpers/convert2datatype.py,sha256=jLhcOBfsGQVwYjzvQBUbFrFWoIquS44kU81aJ5BhMaA,6447
|
|
46
45
|
oldaplib/src/helpers/irincname.py,sha256=XZoV6eEsWVssvhQE9w1TD0cYDX1EYQnhN8PiU9gjvng,2473
|
|
47
46
|
oldaplib/src/helpers/json_encoder.py,sha256=c78h9uf58zfLaK8X7S1KCK4otY3iEltGnPBy_5ryiCk,2135
|
|
@@ -59,23 +58,23 @@ oldaplib/src/helpers/tools.py,sha256=sNbiOLucTGNFzZmiWwPLFOb80VTXQH0Zd9uCGubhzAk
|
|
|
59
58
|
oldaplib/src/iconnection.py,sha256=XlOc2Kh4tK_UOHydLQwlWjUFLUze-Aq_vEZpf9KS1-s,3677
|
|
60
59
|
oldaplib/src/in_project.py,sha256=2KuhHPj8DNveFRBeImrRfxlCOYhBK-mcxXYUp6s--j8,10672
|
|
61
60
|
oldaplib/src/model.py,sha256=VACR3T6zJYFaE5J1PFFdP0OSwhbu4sahoLMWg6_L_rE,19267
|
|
62
|
-
oldaplib/src/objectfactory.py,sha256=
|
|
63
|
-
oldaplib/src/oldaplist.py,sha256=
|
|
61
|
+
oldaplib/src/objectfactory.py,sha256=0kKYh48JJbFRrhAvrMy65E_7seKFg1bGPBlgD6xo0Z4,67554
|
|
62
|
+
oldaplib/src/oldaplist.py,sha256=s5afrHtUnvDfMUFoZTt-jMxlBlmK2c0tLeTMp0KiIfg,43077
|
|
64
63
|
oldaplib/src/oldaplist_helpers.py,sha256=1Gur0nS1PCKb9iUtCKPUFDOYjw6vvAwYpe-G3DdxlEc,14213
|
|
65
64
|
oldaplib/src/oldaplistnode.py,sha256=NnC2juEGTtEkDO6OlB9PjSw_zTF-wSsRUgEk-6VV9DA,87344
|
|
66
65
|
oldaplib/src/oldaplogging.py,sha256=IDSOylms9OSTInYPC4Y2QrTTEzRL0T5I2QssCevOhTU,1242
|
|
67
|
-
oldaplib/src/permissionset.py,sha256=
|
|
68
|
-
oldaplib/src/project.py,sha256=
|
|
66
|
+
oldaplib/src/permissionset.py,sha256=JU9cwgAEf3ppHvSzPZEgKxhYcYVxZoN1mqP96lexOSA,32912
|
|
67
|
+
oldaplib/src/project.py,sha256=ic0cIYYcPk--7XsfbymuGkFbiUFmFJqNgjTWY2Rws7Q,35266
|
|
69
68
|
oldaplib/src/propertyclass.py,sha256=OuzCSCRp8Qfz-PolmoH7FARfTEvWJd42ghLgvPsgT78,97213
|
|
70
69
|
oldaplib/src/resourceclass.py,sha256=_WEyZRlt_sA_q8vzoOP8PdkBtjje8khiVHyvr_-1_ro,102817
|
|
71
|
-
oldaplib/src/user.py,sha256=
|
|
70
|
+
oldaplib/src/user.py,sha256=fJVTbKjFi2WvnEzyDt77_Yh9s1X1Er3JkWHBQd-hF20,51805
|
|
72
71
|
oldaplib/src/userdataclass.py,sha256=FbZkcRt0pKbOeqsZ7HbpwoKE-XPWH2AqpHG1GcsrBPo,12364
|
|
73
|
-
oldaplib/src/version.py,sha256=
|
|
72
|
+
oldaplib/src/version.py,sha256=giDvISHbc4E1R9Lm3V5loYL-rswle56sCcNX9JTtpF4,22
|
|
74
73
|
oldaplib/src/xsd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
75
74
|
oldaplib/src/xsd/floatingpoint.py,sha256=rDReKqh0mXyc4F5wslgTUxbeGf3-PGERyughj5_62YI,8852
|
|
76
75
|
oldaplib/src/xsd/iri.py,sha256=w1Dr0z-REi7yPe3GPGnyzGrLVMvLY03kEeK-AmZ9sxw,8383
|
|
77
76
|
oldaplib/src/xsd/xsd.py,sha256=KiAIhqE7y5s7rPZWxA8eP-1Spf_saFOndNznaWOKSbM,1550
|
|
78
|
-
oldaplib/src/xsd/xsd_anyuri.py,sha256=
|
|
77
|
+
oldaplib/src/xsd/xsd_anyuri.py,sha256=tsZfOpIlsomQubywMmXzgoX-LvtQ7hBdfP7TrGpW7Xk,6244
|
|
79
78
|
oldaplib/src/xsd/xsd_base64binary.py,sha256=beHouGagNdqTxH7MHh03YKuErlHx4qSjmBrKdGB6sTU,3930
|
|
80
79
|
oldaplib/src/xsd/xsd_boolean.py,sha256=fzV_szKf2bq3E-p0mgARSOcuGWdH1T1LGVGkeD4E36A,2901
|
|
81
80
|
oldaplib/src/xsd/xsd_byte.py,sha256=LTE210keT1O78MnhNdAp4E1F-UhzNX4UYAnUVLopHxA,1017
|
|
@@ -115,30 +114,31 @@ oldaplib/src/xsd/xsd_unsignedbyte.py,sha256=Nro864cBM_Su7dwY_UXvGBwItsqy9jwuZffy
|
|
|
115
114
|
oldaplib/src/xsd/xsd_unsignedint.py,sha256=q4qN706kocmMoQemg1ayig3tM26emvK8crFphZPZzqs,1041
|
|
116
115
|
oldaplib/src/xsd/xsd_unsignedlong.py,sha256=5fGH8_SAV1x6b0YGiIR44ZlJXjUiCUW6XHhCWbGgcVA,1008
|
|
117
116
|
oldaplib/src/xsd/xsd_unsignedshort.py,sha256=M1E8SDR33rPJ0jUpRkzcDCcJYg17YfVbaItTuJeEibc,1013
|
|
117
|
+
oldaplib/test/XXX_test_fasnacht.py,sha256=BH_0osp1LpyXNWjU_OPXvpT7RyF9aeYMrPIa1JiQKiA,573
|
|
118
118
|
oldaplib/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
119
119
|
oldaplib/test/test_cache.py,sha256=6TGukPUruuj5BsZaPGZdIx9L7v39qB9jIKZkg_GkbW4,702
|
|
120
|
-
oldaplib/test/test_connection.py,sha256=
|
|
121
|
-
oldaplib/test/test_context.py,sha256=
|
|
122
|
-
oldaplib/test/test_datamodel.py,sha256=
|
|
120
|
+
oldaplib/test/test_connection.py,sha256=wM2AWcwcNcd1_W857by_QKmdnEabsOcjOec-8JrfHdc,13339
|
|
121
|
+
oldaplib/test/test_context.py,sha256=3tjZ8r4ieePs3CTqKxWVMynWBo_bpna_VYYRsthRH7w,4888
|
|
122
|
+
oldaplib/test/test_datamodel.py,sha256=Ju0PWCoT3ZqleEYNRJFaznuE4vRlhlaCxa_Fw_WgG4c,58942
|
|
123
123
|
oldaplib/test/test_dtypes.py,sha256=ifXWUc6ExAKGukyM1ziku7Xd9eehg4J7HZy9B63-aPo,8601
|
|
124
|
-
oldaplib/test/test_externalontologies.py,sha256=
|
|
125
|
-
oldaplib/test/test_hasproperty.py,sha256=
|
|
124
|
+
oldaplib/test/test_externalontologies.py,sha256=WUPjTbklMmrM4OucPXOChyNmwFD9qdYVKkZyo0WHlP0,7797
|
|
125
|
+
oldaplib/test/test_hasproperty.py,sha256=jVagmFXjfEfdbfzkD_KZjjNIVoSr06feWlO9I4NuT90,11525
|
|
126
126
|
oldaplib/test/test_in_project.py,sha256=DYT-guwRQ9crnfEt7cQZxoEMxThin7QeymNce3jaZx4,7779
|
|
127
127
|
oldaplib/test/test_langstring.py,sha256=37BeKiQzj63G-SyS_paK_SEG7ulRbGrE89Mz40UB_bE,15146
|
|
128
128
|
oldaplib/test/test_language_in.py,sha256=ELqHO-YIsZSCPF3E3rWde4J7rERL7En7sV_pzQ00zgs,8826
|
|
129
|
-
oldaplib/test/test_objectfactory.py,sha256=
|
|
129
|
+
oldaplib/test/test_objectfactory.py,sha256=VeQJBWH-DVqg1K5XTwlVMOqkXy-OYSUXF0LsVAG4vh8,39281
|
|
130
130
|
oldaplib/test/test_observable_dict.py,sha256=GxD0sM0nsVfVRBu92SFGkJ6--YXq4ibBWI4IpjZZzDU,1396
|
|
131
131
|
oldaplib/test/test_observable_set.py,sha256=JWZSoAsr8XIEBXPVgSVJjQQEEc8uSAme5IrFYLYVVXw,6313
|
|
132
|
-
oldaplib/test/test_oldaplist.py,sha256=
|
|
133
|
-
oldaplib/test/test_oldaplist_helpers.py,sha256=
|
|
134
|
-
oldaplib/test/test_oldaplistnode.py,sha256=
|
|
135
|
-
oldaplib/test/test_permissionset.py,sha256=
|
|
136
|
-
oldaplib/test/test_project.py,sha256=
|
|
137
|
-
oldaplib/test/test_propertyclass.py,sha256=
|
|
138
|
-
oldaplib/test/test_resourceclass.py,sha256=
|
|
132
|
+
oldaplib/test/test_oldaplist.py,sha256=jMM3HiSFs7YcS2ltEvot6637EhK-fMV0W5DSUlFdTRI,20098
|
|
133
|
+
oldaplib/test/test_oldaplist_helpers.py,sha256=sxCPOAYt8JyS-otAMYOiwNMygDX8NXTRe16alkPufQY,24423
|
|
134
|
+
oldaplib/test/test_oldaplistnode.py,sha256=H3Y-DdFfJqk9OzvB0M2jlaMfXHJCVfiFZYuu8P4fa4g,149417
|
|
135
|
+
oldaplib/test/test_permissionset.py,sha256=f43ndsPSZK4yqwxUXDjPgNdQvowJ7b4wfPELqj0zU1Y,23423
|
|
136
|
+
oldaplib/test/test_project.py,sha256=uwMjeYBEnkqmApqxPYPPvCO3XtYn_IFMP_h2ut_u_Tg,25243
|
|
137
|
+
oldaplib/test/test_propertyclass.py,sha256=MaHoTy7o6b3c44whYWTqG0mCOaNvZqL0Mzf7v3ru-Us,61810
|
|
138
|
+
oldaplib/test/test_resourceclass.py,sha256=c4x7Py3a6zTKypGPfW-KgZNRXT4jeikARq3290jZ-GE,96575
|
|
139
139
|
oldaplib/test/test_semantic_version.py,sha256=OSJYHWDpKBqk-HsxJ2nFpSr14a4OEZTFCogzEni8mcE,3392
|
|
140
|
-
oldaplib/test/test_user.py,sha256=
|
|
141
|
-
oldaplib/test/test_xsd_datatypes.py,sha256=
|
|
140
|
+
oldaplib/test/test_user.py,sha256=w_Ud7kh5nWjnsvnCYj7pP1mH7Fp2rP-nUCDAN5Lrz64,72086
|
|
141
|
+
oldaplib/test/test_xsd_datatypes.py,sha256=Ey2RMMs9a3cNlFe4PHTGcLl5MRlkPBxJTid1NLSe-yg,67959
|
|
142
142
|
oldaplib/testdata/Gender.yaml,sha256=54ohJWToiuO2rMOUJ85JOsZf2TSrIuPLarHriXa6Lww,235
|
|
143
143
|
oldaplib/testdata/collections_type.yaml,sha256=03MNQVUoLlq7A1OOtSvACeRs32VfP5eS8av-mPLGoEI,2737
|
|
144
144
|
oldaplib/testdata/connection_test.trig,sha256=LFTGLEae7SaTU67rwvgvg_epi09O7oPZwfarvBVbhho,23078
|
|
@@ -158,6 +158,6 @@ oldaplib/testdata/source_type.yaml,sha256=dSihKikw3O-IlGf6anj5KWMoBYLaweLVF1Zojm
|
|
|
158
158
|
oldaplib/testdata/test_move_left_of_toL.yaml,sha256=2m1OSQrQFlsCQxeJrjzBAO74LMprNDo_HuyrYGsOeXI,787
|
|
159
159
|
oldaplib/testdata/testlist.yaml,sha256=AT11nXEG81Sfyb-tr1gQV0H_dZBrOCcFuHf7YtL8P2g,1994
|
|
160
160
|
oldaplib/testit.http,sha256=qW7mnr6aNLXFG6lQdLgyhXILOPN6qc5iFVZclLyVvkY,303
|
|
161
|
-
oldaplib-0.3.
|
|
162
|
-
oldaplib-0.3.
|
|
163
|
-
oldaplib-0.3.
|
|
161
|
+
oldaplib-0.3.28.dist-info/METADATA,sha256=F5M8jRtM6Rdj0zA8sDJ57lnkjkjMA4yUa8XlZ31XE5U,3010
|
|
162
|
+
oldaplib-0.3.28.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
163
|
+
oldaplib-0.3.28.dist-info/RECORD,,
|
oldaplib/apps/load_list.py
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
from argparse import ArgumentParser
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
|
|
5
|
-
from oldaplib.src.connection import Connection
|
|
6
|
-
from oldaplib.src.helpers.oldaperror import OldapError
|
|
7
|
-
from oldaplib.src.oldaplist_helpers import load_list_from_yaml, print_sublist
|
|
8
|
-
from oldaplib.src.project import Project
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def load_list():
|
|
12
|
-
parser = ArgumentParser(prog="load_list",
|
|
13
|
-
description="Loads YAML file with hierarchical list.")
|
|
14
|
-
parser.add_argument("file", help="YAML file with hierarchical list")
|
|
15
|
-
parser.add_argument('-v', '--verbose', action='store_true', help="Show some informational output")
|
|
16
|
-
parser.add_argument('-u', '--user', required=True, help="Username")
|
|
17
|
-
parser.add_argument('-p', '--password', required=True, help="Password")
|
|
18
|
-
parser.add_argument('--project', required=True, help="Project ID")
|
|
19
|
-
#parser.add_argument('-h', '--help', help="Show help information")
|
|
20
|
-
args = parser.parse_args()
|
|
21
|
-
|
|
22
|
-
try:
|
|
23
|
-
connection = Connection(server='http://localhost:7200',
|
|
24
|
-
repo="oldap",
|
|
25
|
-
userId=args.user,
|
|
26
|
-
credentials=args.password,
|
|
27
|
-
context_name="DEFAULT")
|
|
28
|
-
project = Project.read(connection, args.project)
|
|
29
|
-
path = Path(args.file)
|
|
30
|
-
listnodes = load_list_from_yaml(con=connection,
|
|
31
|
-
project=args.project,
|
|
32
|
-
filepath=path)
|
|
33
|
-
if args.verbose:
|
|
34
|
-
listnode = listnodes[0]
|
|
35
|
-
print_sublist(listnode.nodes)
|
|
36
|
-
except OldapError as error:
|
|
37
|
-
print(f'ERROR: {error}!', file=sys.stderr)
|
|
38
|
-
exit(-1)
|
|
39
|
-
except FileNotFoundError as error:
|
|
40
|
-
print(f'ERROR: {error}!', file=sys.stderr)
|
|
41
|
-
exit(-1)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if __name__ == '__main__':
|
|
45
|
-
load_list()
|
|
File without changes
|