oldaplib 0.3.23__py3-none-any.whl → 0.3.25__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.
@@ -123,7 +123,7 @@ shared:shacl {
123
123
  sh:property [
124
124
  sh:path rdf:type ;
125
125
  ] ;
126
- sh:property [ # >>PropertyClass.property_node_shacl()
126
+ sh:property [
127
127
  sh:path shared:originalName ;
128
128
  schema:version "0.1.0"^^xsd:string ;
129
129
  dcterms:creator <https://orcid.org/0000-0003-1681-4036> ;
@@ -138,7 +138,7 @@ shared:shacl {
138
138
  sh:maxCount "1"^^xsd:integer ;
139
139
  sh:order "1.0"^^xsd:decimal ;
140
140
  ] ;
141
- sh:property [ # >>PropertyClass.property_node_shacl()
141
+ sh:property [
142
142
  sh:path shared:originalMimeType ;
143
143
  schema:version "0.1.0"^^xsd:string ;
144
144
  dcterms:creator <https://orcid.org/0000-0003-1681-4036> ;
@@ -153,7 +153,7 @@ shared:shacl {
153
153
  sh:maxCount "1"^^xsd:integer ;
154
154
  sh:order "2.0"^^xsd:decimal ;
155
155
  ] ;
156
- sh:property [ # >>PropertyClass.property_node_shacl()
156
+ sh:property [
157
157
  sh:path shared:serverUrl ;
158
158
  schema:version "0.1.0"^^xsd:string ;
159
159
  dcterms:creator <https://orcid.org/0000-0003-1681-4036> ;
@@ -168,7 +168,7 @@ shared:shacl {
168
168
  sh:maxCount "1"^^xsd:integer ;
169
169
  sh:order "3.0"^^xsd:decimal ;
170
170
  ] ;
171
- sh:property [ # >>PropertyClass.property_node_shacl()
171
+ sh:property [
172
172
  sh:path shared:imageId ;
173
173
  schema:version "0.1.0"^^xsd:string ;
174
174
  dcterms:creator <https://orcid.org/0000-0003-1681-4036> ;
@@ -182,6 +182,27 @@ shared:shacl {
182
182
  sh:minCount "1"^^xsd:integer ;
183
183
  sh:maxCount "1"^^xsd:integer ;
184
184
  sh:order "3.0"^^xsd:decimal ;
185
+ ] ;
186
+ sh:property [
187
+ sh:path shared:protocol ;
188
+ dcterms:creator <https://orcid.org/0000-0003-1681-4036> ;
189
+ dcterms:created "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime ;
190
+ dcterms:contributor <https://orcid.org/0000-0003-1681-4036> ;
191
+ dcterms:modified "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime ;
192
+ oldap:statementProperty "false"^^xsd:boolean ;
193
+ oldap:externalOntology "false"^^xsd:boolean ;
194
+ sh:datatype xsd:string ;
195
+ sh:in ( 'iiif' 'http' 'custom') ;
196
+ ] ;
197
+ sh:property [
198
+ sh:path shared:path ;
199
+ dcterms:creator <https://orcid.org/0000-0003-1681-4036> ;
200
+ dcterms:created "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime ;
201
+ dcterms:contributor <https://orcid.org/0000-0003-1681-4036> ;
202
+ dcterms:modified "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime ;
203
+ oldap:statementProperty "false"^^xsd:boolean ;
204
+ oldap:externalOntology "false"^^xsd:boolean ;
205
+ sh:datatype xsd:string ;
185
206
  ] .
186
207
  }
187
208
 
@@ -349,6 +370,22 @@ shared:onto {
349
370
  dcterms:contributor <https://orcid.org/0000-0003-1681-4036> ;
350
371
  dcterms:modified "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime .
351
372
 
373
+ shared:protocol rdf:type owl:DatatypeProperty ;
374
+ rdfs:domain shared:MediaObject ;
375
+ rdfs:range xsd:string ;
376
+ dcterms:creator <https://orcid.org/0000-0003-1681-4036> ;
377
+ dcterms:created "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime ;
378
+ dcterms:contributor <https://orcid.org/0000-0003-1681-4036> ;
379
+ dcterms:modified "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime .
380
+
381
+ shared:path rdf:type owl:DatatypeProperty ;
382
+ rdfs:domain shared:MediaObject ;
383
+ rdfs:range xsd:string ;
384
+ dcterms:creator <https://orcid.org/0000-0003-1681-4036> ;
385
+ dcterms:created "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime ;
386
+ dcterms:contributor <https://orcid.org/0000-0003-1681-4036> ;
387
+ dcterms:modified "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime .
388
+
352
389
  shared:MediaObject rdf:type owl:Class ;
353
390
  schema:version "0.1.0"^^xsd:string ;
354
391
  dcterms:created "2025-11-21T00:15:09.037880+01:00"^^xsd:dateTime ;
@@ -381,6 +418,18 @@ shared:onto {
381
418
  owl:onProperty shared:imageId ;
382
419
  owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ;
383
420
  owl:onDataRange xsd:string ;
421
+ ],
422
+ [
423
+ rdf:type owl:Restriction ;
424
+ owl:onProperty shared:protocol ;
425
+ owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ;
426
+ owl:onDataRange xsd:string ;
427
+ ],
428
+ [
429
+ rdf:type owl:Restriction ;
430
+ owl:onProperty shared:path ;
431
+ owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger ;
432
+ owl:onDataRange xsd:string ;
384
433
  ] .
385
434
 
386
435
  }
@@ -29,6 +29,7 @@ from oldaplib.src.xsd.xsd_datetimestamp import Xsd_dateTimeStamp
29
29
  from oldaplib.src.xsd.xsd_integer import Xsd_integer
30
30
  from oldaplib.src.xsd.xsd_ncname import Xsd_NCName
31
31
  from oldaplib.src.xsd.xsd_qname import Xsd_QName
32
+ from oldaplib.src.xsd.xsd_string import Xsd_string
32
33
 
33
34
  ValueType = LangString | ObservableSet | Xsd
34
35
 
@@ -229,9 +230,9 @@ class ResourceInstance:
229
230
  if property.get(PropClassAttr.UNIQUE_LANG):
230
231
  return # TODO: LangString does not yet allow multiple entries of the same language...
231
232
  if property.get(PropClassAttr.IN):
232
- for val in values:
233
- if not val in property[PropClassAttr.IN]:
234
- raise OldapErrorValue(f'Property {property} with IN={property[PropClassAttr.IN]} has invalid value "{val}"')
233
+ #for val in values:
234
+ if not values in property[PropClassAttr.IN]:
235
+ raise OldapErrorValue(f'Property {property} with IN={property[PropClassAttr.IN]} has invalid value "{val}"')
235
236
  if property.get(PropClassAttr.MIN_LENGTH):
236
237
  for val in values:
237
238
  l = 0
@@ -1142,6 +1143,42 @@ class ResourceInstance:
1142
1143
  result[r['s']] = tmp
1143
1144
  return result
1144
1145
 
1146
+ @staticmethod
1147
+ def get_media_object_by_id(con: IConnection, mediaObjectId: Xsd_string | str) -> dict[str, Xsd] | None:
1148
+ if not isinstance(mediaObjectId, Xsd_string):
1149
+ mediaObjectId = Xsd_string(mediaObjectId, validate=True)
1150
+ blank = ''
1151
+ context = Context(name=con.context_name)
1152
+ sparql = context.sparql_context
1153
+
1154
+ sparql += f"""
1155
+ SELECT ?subject ?graph ?path ?permval
1156
+ WHERE {{
1157
+ VALUES ?inputImageId {{ {mediaObjectId.toRdf} }}
1158
+
1159
+ GRAPH ?graph {{
1160
+ ?subject shared:imageId ?inputImageId .
1161
+ ?subject rdf:type shared:MediaObject .
1162
+ ?subject shared:path ?path .
1163
+ ?subject oldap:grantsPermission ?permset .
1164
+ }}
1165
+ GRAPH oldap:admin {{
1166
+ {con.userIri.toRdf} oldap:hasPermissions ?permset .
1167
+ ?permset oldap:givesPermission ?DataPermission .
1168
+ ?DataPermission oldap:permissionValue ?permval .
1169
+ }}
1170
+ }}
1171
+ """
1172
+ try:
1173
+ jsonres = con.query(sparql)
1174
+ except OldapError:
1175
+ print(sparql)
1176
+ raise
1177
+ res = QueryProcessor(context, jsonres)
1178
+ if len(res) == 0 or len(res) > 1:
1179
+ return None
1180
+ return {'iri': res[0]['subject'], 'graph': res[0]['graph'], 'path': res[0]['path'], 'permval': res[0]['permval']}
1181
+
1145
1182
 
1146
1183
  def toJsonObject(self) -> dict[str, list[str] | str]:
1147
1184
  result = {'iri': str(self._iri)}
oldaplib/src/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.3.23"
1
+ __version__ = "0.3.25"
@@ -700,6 +700,11 @@ class TestObjectFactory(unittest.TestCase):
700
700
  resClass='test:Page')
701
701
  self.assertEqual(len(res), 8)
702
702
 
703
+ @unittest.skip('Work in progress')
704
+ def test_media_object(self):
705
+ res = ResourceInstance.get_media_object_by_id(con=self._connection,mediaObjectId='Nn3Epw1LMTNS.tif')
706
+ print(res)
707
+
703
708
 
704
709
  if __name__ == '__main__':
705
710
  unittest.main()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: oldaplib
3
- Version: 0.3.23
3
+ Version: 0.3.25
4
4
  Summary: Open Media Access Server Library (Linked Open Data middleware/RESTApi)
5
5
  License: GNU Affero General Public License version 3
6
6
  Author: Lukas Rosenthaler
@@ -5,7 +5,7 @@ oldaplib/ontologies/admin.trig,sha256=ByxFYdI9rh-RhLnSpkdZHMMWgXCSTi2YMJc1QgBHFh
5
5
  oldaplib/ontologies/example.trig,sha256=MdRrFBZZ1L6aUDiT6aX4cnXiy-RoZHczF3Exn7aBSmU,1518
6
6
  oldaplib/ontologies/oldap.trig,sha256=i2XanqKlhWSIdD17fLu5g0Luq2GORQCcyIfLn9Kummk,60241
7
7
  oldaplib/ontologies/oldap.ttl,sha256=qdA0uiSjzVhkc1d5IN2y5ioK1QMzwl-TTnn3M_D1Kh8,29446
8
- oldaplib/ontologies/shared.trig,sha256=p9UE8mT8Ye8JKyZpfjH65VDJM8ho5jGXkX-jA5IS9sI,19329
8
+ oldaplib/ontologies/shared.trig,sha256=rrXGUT9HycOwDr2SKaN33KF3bkr4JtvUdxvfSTocs1Q,21605
9
9
  oldaplib/ontologies/standard/.gitsave,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  oldaplib/src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  oldaplib/src/cachesingleton.py,sha256=WGhuFER-mTnOJmwaN17fXPAg7zn7GJBm-XadShNUBBk,3687
@@ -59,7 +59,7 @@ oldaplib/src/helpers/tools.py,sha256=sNbiOLucTGNFzZmiWwPLFOb80VTXQH0Zd9uCGubhzAk
59
59
  oldaplib/src/iconnection.py,sha256=XlOc2Kh4tK_UOHydLQwlWjUFLUze-Aq_vEZpf9KS1-s,3677
60
60
  oldaplib/src/in_project.py,sha256=2KuhHPj8DNveFRBeImrRfxlCOYhBK-mcxXYUp6s--j8,10672
61
61
  oldaplib/src/model.py,sha256=VACR3T6zJYFaE5J1PFFdP0OSwhbu4sahoLMWg6_L_rE,19267
62
- oldaplib/src/objectfactory.py,sha256=pZ_5D3LpwfsvMVr6Rftwa3AlV84wNQcDDPs5USFNn0k,64306
62
+ oldaplib/src/objectfactory.py,sha256=_TldnQE6UzLAX0DKEGaRI9C-0RuZllFsfidGx4F-r5c,65746
63
63
  oldaplib/src/oldaplist.py,sha256=sGAvEEJukRCjM70G0NFaR-L9YPleQTOtdWGExj3oYL8,42933
64
64
  oldaplib/src/oldaplist_helpers.py,sha256=1Gur0nS1PCKb9iUtCKPUFDOYjw6vvAwYpe-G3DdxlEc,14213
65
65
  oldaplib/src/oldaplistnode.py,sha256=NnC2juEGTtEkDO6OlB9PjSw_zTF-wSsRUgEk-6VV9DA,87344
@@ -70,7 +70,7 @@ oldaplib/src/propertyclass.py,sha256=OuzCSCRp8Qfz-PolmoH7FARfTEvWJd42ghLgvPsgT78
70
70
  oldaplib/src/resourceclass.py,sha256=uzPhwTBdWmB228R1FUddB4XaZcOfBAPAPYn-ZPZkeF0,102551
71
71
  oldaplib/src/user.py,sha256=Z4GXPRkaHXx3glUpPXQdFqYMxQPOuqayDwkTAE5RGjU,48820
72
72
  oldaplib/src/userdataclass.py,sha256=FbZkcRt0pKbOeqsZ7HbpwoKE-XPWH2AqpHG1GcsrBPo,12364
73
- oldaplib/src/version.py,sha256=ovPlsd5alU9FtB_D6PMNL3UQU7LKO_8BAOVb9xu2uuk,22
73
+ oldaplib/src/version.py,sha256=3BcbLW1PvJr1pHJXu16ey11RhnsbUa0Urjh-utnL6WE,22
74
74
  oldaplib/src/xsd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
75
75
  oldaplib/src/xsd/floatingpoint.py,sha256=rDReKqh0mXyc4F5wslgTUxbeGf3-PGERyughj5_62YI,8852
76
76
  oldaplib/src/xsd/iri.py,sha256=w1Dr0z-REi7yPe3GPGnyzGrLVMvLY03kEeK-AmZ9sxw,8383
@@ -126,7 +126,7 @@ oldaplib/test/test_hasproperty.py,sha256=r991g8kBTfv1CGs9Hf0fli-AUp7Ob7rOHWYD74h
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=jYNCaGkGXGoIo0mVsMPen3pWFx1xVbHq-nGgzDisf9w,36572
129
+ oldaplib/test/test_objectfactory.py,sha256=SWwMmynHsYfRh86u8PDQsO8g4q7K4UR0LSb7zxZ1D1s,36773
130
130
  oldaplib/test/test_observable_dict.py,sha256=GxD0sM0nsVfVRBu92SFGkJ6--YXq4ibBWI4IpjZZzDU,1396
131
131
  oldaplib/test/test_observable_set.py,sha256=JWZSoAsr8XIEBXPVgSVJjQQEEc8uSAme5IrFYLYVVXw,6313
132
132
  oldaplib/test/test_oldaplist.py,sha256=9wo3tEOHt5bIuXyvSSyTzjhtdKrQHiiAA6EfVBuq4wI,20114
@@ -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.23.dist-info/METADATA,sha256=sviKAfMZrAR-Ev-cYC6M4hXwa5tbayDaOvJpIMRLqiU,3010
162
- oldaplib-0.3.23.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
163
- oldaplib-0.3.23.dist-info/RECORD,,
161
+ oldaplib-0.3.25.dist-info/METADATA,sha256=Pk52qbLPhmiiAnrbT-g8G1a1g5JElyTE7VT2tIRYMoU,3010
162
+ oldaplib-0.3.25.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
163
+ oldaplib-0.3.25.dist-info/RECORD,,