oldaplib 0.3.24__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.
@@ -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
 
@@ -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.24"
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.24
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
@@ -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=YN5GqWD4WOD0Gd1K5f-cVluka46MuFHi3-_1f9uYI5Y,64302
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=1G7BOgQ-rE-g6H87Yl9LN077_pZ80Fv28EhfaF3IHQ0,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.24.dist-info/METADATA,sha256=VAkTUWPAvqiY0q_RffzIKPdE3JsShrMZh5Nlh5wbdlk,3010
162
- oldaplib-0.3.24.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
163
- oldaplib-0.3.24.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,,