dsp-tools 0.9.13__py3-none-any.whl → 18.3.0.post13__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.
Files changed (348) hide show
  1. dsp_tools/__init__.py +5 -0
  2. dsp_tools/cli/args.py +47 -0
  3. dsp_tools/cli/call_action.py +85 -0
  4. dsp_tools/cli/call_action_files_only.py +101 -0
  5. dsp_tools/cli/call_action_with_network.py +207 -0
  6. dsp_tools/cli/create_parsers.py +479 -0
  7. dsp_tools/cli/entry_point.py +322 -0
  8. dsp_tools/cli/utils.py +87 -0
  9. dsp_tools/clients/CLAUDE.md +420 -0
  10. dsp_tools/clients/authentication_client.py +14 -0
  11. dsp_tools/clients/authentication_client_live.py +66 -0
  12. dsp_tools/clients/connection.py +35 -0
  13. dsp_tools/clients/connection_live.py +233 -0
  14. dsp_tools/clients/fuseki_metrics.py +60 -0
  15. dsp_tools/clients/group_user_clients.py +35 -0
  16. dsp_tools/clients/group_user_clients_live.py +181 -0
  17. dsp_tools/clients/legal_info_client.py +23 -0
  18. dsp_tools/clients/legal_info_client_live.py +132 -0
  19. dsp_tools/clients/list_client.py +49 -0
  20. dsp_tools/clients/list_client_live.py +166 -0
  21. dsp_tools/clients/metadata_client.py +24 -0
  22. dsp_tools/clients/metadata_client_live.py +47 -0
  23. dsp_tools/clients/ontology_clients.py +49 -0
  24. dsp_tools/clients/ontology_create_client_live.py +166 -0
  25. dsp_tools/clients/ontology_get_client_live.py +80 -0
  26. dsp_tools/clients/permissions_client.py +68 -0
  27. dsp_tools/clients/project_client.py +16 -0
  28. dsp_tools/clients/project_client_live.py +66 -0
  29. dsp_tools/commands/create/communicate_problems.py +24 -0
  30. dsp_tools/commands/create/create.py +134 -0
  31. dsp_tools/commands/create/create_on_server/cardinalities.py +111 -0
  32. dsp_tools/commands/create/create_on_server/classes.py +99 -0
  33. dsp_tools/commands/create/create_on_server/complete_ontologies.py +116 -0
  34. dsp_tools/commands/create/create_on_server/default_permissions.py +134 -0
  35. dsp_tools/commands/create/create_on_server/group_users.py +165 -0
  36. dsp_tools/commands/create/create_on_server/lists.py +163 -0
  37. dsp_tools/commands/create/create_on_server/mappers.py +12 -0
  38. dsp_tools/commands/create/create_on_server/onto_utils.py +74 -0
  39. dsp_tools/commands/create/create_on_server/ontology.py +52 -0
  40. dsp_tools/commands/create/create_on_server/project.py +68 -0
  41. dsp_tools/commands/create/create_on_server/properties.py +119 -0
  42. dsp_tools/commands/create/exceptions.py +29 -0
  43. dsp_tools/commands/create/lists_only.py +66 -0
  44. dsp_tools/commands/create/models/create_problems.py +87 -0
  45. dsp_tools/commands/create/models/parsed_ontology.py +88 -0
  46. dsp_tools/commands/create/models/parsed_project.py +81 -0
  47. dsp_tools/commands/create/models/rdf_ontology.py +12 -0
  48. dsp_tools/commands/create/models/server_project_info.py +100 -0
  49. dsp_tools/commands/create/parsing/parse_lists.py +45 -0
  50. dsp_tools/commands/create/parsing/parse_ontology.py +243 -0
  51. dsp_tools/commands/create/parsing/parse_project.py +149 -0
  52. dsp_tools/commands/create/parsing/parsing_utils.py +40 -0
  53. dsp_tools/commands/create/project_validate.py +595 -0
  54. dsp_tools/commands/create/serialisation/ontology.py +119 -0
  55. dsp_tools/commands/create/serialisation/project.py +44 -0
  56. dsp_tools/commands/excel2json/CLAUDE.md +101 -0
  57. dsp_tools/commands/excel2json/json_header.py +321 -0
  58. dsp_tools/commands/excel2json/lists/__init__.py +0 -0
  59. dsp_tools/commands/excel2json/lists/compliance_checks.py +292 -0
  60. dsp_tools/commands/excel2json/lists/make_lists.py +247 -0
  61. dsp_tools/commands/excel2json/lists/models/__init__.py +0 -0
  62. dsp_tools/commands/excel2json/lists/models/deserialise.py +30 -0
  63. dsp_tools/commands/excel2json/lists/models/input_error.py +216 -0
  64. dsp_tools/commands/excel2json/lists/models/serialise.py +57 -0
  65. dsp_tools/commands/excel2json/lists/utils.py +81 -0
  66. dsp_tools/commands/excel2json/models/__init__.py +0 -0
  67. dsp_tools/commands/excel2json/models/input_error.py +416 -0
  68. dsp_tools/commands/excel2json/models/json_header.py +175 -0
  69. dsp_tools/commands/excel2json/models/list_node_name.py +16 -0
  70. dsp_tools/commands/excel2json/models/ontology.py +76 -0
  71. dsp_tools/commands/excel2json/old_lists.py +328 -0
  72. dsp_tools/commands/excel2json/project.py +280 -0
  73. dsp_tools/commands/excel2json/properties.py +370 -0
  74. dsp_tools/commands/excel2json/resources.py +336 -0
  75. dsp_tools/commands/excel2json/utils.py +352 -0
  76. dsp_tools/commands/excel2xml/__init__.py +7 -0
  77. dsp_tools/commands/excel2xml/excel2xml_cli.py +523 -0
  78. dsp_tools/commands/excel2xml/excel2xml_lib.py +1953 -0
  79. dsp_tools/commands/excel2xml/propertyelement.py +47 -0
  80. dsp_tools/commands/get/__init__.py +0 -0
  81. dsp_tools/commands/get/get.py +166 -0
  82. dsp_tools/commands/get/get_permissions.py +257 -0
  83. dsp_tools/commands/get/get_permissions_legacy.py +89 -0
  84. dsp_tools/commands/get/legacy_models/__init__.py +0 -0
  85. dsp_tools/commands/get/legacy_models/context.py +318 -0
  86. dsp_tools/commands/get/legacy_models/group.py +241 -0
  87. dsp_tools/commands/get/legacy_models/helpers.py +47 -0
  88. dsp_tools/commands/get/legacy_models/listnode.py +390 -0
  89. dsp_tools/commands/get/legacy_models/model.py +12 -0
  90. dsp_tools/commands/get/legacy_models/ontology.py +324 -0
  91. dsp_tools/commands/get/legacy_models/project.py +366 -0
  92. dsp_tools/commands/get/legacy_models/propertyclass.py +417 -0
  93. dsp_tools/commands/get/legacy_models/resourceclass.py +676 -0
  94. dsp_tools/commands/get/legacy_models/user.py +438 -0
  95. dsp_tools/commands/get/models/__init__.py +0 -0
  96. dsp_tools/commands/get/models/permissions_models.py +10 -0
  97. dsp_tools/commands/id2iri.py +258 -0
  98. dsp_tools/commands/ingest_xmlupload/__init__.py +0 -0
  99. dsp_tools/commands/ingest_xmlupload/bulk_ingest_client.py +178 -0
  100. dsp_tools/commands/ingest_xmlupload/create_resources/__init__.py +0 -0
  101. dsp_tools/commands/ingest_xmlupload/create_resources/apply_ingest_id.py +69 -0
  102. dsp_tools/commands/ingest_xmlupload/create_resources/upload_xml.py +166 -0
  103. dsp_tools/commands/ingest_xmlupload/create_resources/user_information.py +121 -0
  104. dsp_tools/commands/ingest_xmlupload/ingest_files/__init__.py +0 -0
  105. dsp_tools/commands/ingest_xmlupload/ingest_files/ingest_files.py +64 -0
  106. dsp_tools/commands/ingest_xmlupload/upload_files/__init__.py +0 -0
  107. dsp_tools/commands/ingest_xmlupload/upload_files/filechecker.py +20 -0
  108. dsp_tools/commands/ingest_xmlupload/upload_files/input_error.py +57 -0
  109. dsp_tools/commands/ingest_xmlupload/upload_files/upload_failures.py +66 -0
  110. dsp_tools/commands/ingest_xmlupload/upload_files/upload_files.py +67 -0
  111. dsp_tools/commands/resume_xmlupload/__init__.py +0 -0
  112. dsp_tools/commands/resume_xmlupload/resume_xmlupload.py +96 -0
  113. dsp_tools/commands/start_stack.py +428 -0
  114. dsp_tools/commands/update_legal/CLAUDE.md +344 -0
  115. dsp_tools/commands/update_legal/__init__.py +0 -0
  116. dsp_tools/commands/update_legal/core.py +182 -0
  117. dsp_tools/commands/update_legal/csv_operations.py +135 -0
  118. dsp_tools/commands/update_legal/models.py +87 -0
  119. dsp_tools/commands/update_legal/xml_operations.py +247 -0
  120. dsp_tools/commands/validate_data/CLAUDE.md +159 -0
  121. dsp_tools/commands/validate_data/__init__.py +0 -0
  122. dsp_tools/commands/validate_data/constants.py +59 -0
  123. dsp_tools/commands/validate_data/mappers.py +143 -0
  124. dsp_tools/commands/validate_data/models/__init__.py +0 -0
  125. dsp_tools/commands/validate_data/models/api_responses.py +45 -0
  126. dsp_tools/commands/validate_data/models/input_problems.py +119 -0
  127. dsp_tools/commands/validate_data/models/rdf_like_data.py +117 -0
  128. dsp_tools/commands/validate_data/models/validation.py +106 -0
  129. dsp_tools/commands/validate_data/prepare_data/__init__.py +0 -0
  130. dsp_tools/commands/validate_data/prepare_data/get_rdf_like_data.py +296 -0
  131. dsp_tools/commands/validate_data/prepare_data/make_data_graph.py +91 -0
  132. dsp_tools/commands/validate_data/prepare_data/prepare_data.py +184 -0
  133. dsp_tools/commands/validate_data/process_validation_report/__init__.py +0 -0
  134. dsp_tools/commands/validate_data/process_validation_report/get_user_validation_message.py +358 -0
  135. dsp_tools/commands/validate_data/process_validation_report/query_validation_result.py +507 -0
  136. dsp_tools/commands/validate_data/process_validation_report/reformat_validation_results.py +150 -0
  137. dsp_tools/commands/validate_data/shacl_cli_validator.py +70 -0
  138. dsp_tools/commands/validate_data/sparql/__init__.py +0 -0
  139. dsp_tools/commands/validate_data/sparql/cardinality_shacl.py +209 -0
  140. dsp_tools/commands/validate_data/sparql/construct_shacl.py +92 -0
  141. dsp_tools/commands/validate_data/sparql/legal_info_shacl.py +36 -0
  142. dsp_tools/commands/validate_data/sparql/value_shacl.py +357 -0
  143. dsp_tools/commands/validate_data/utils.py +59 -0
  144. dsp_tools/commands/validate_data/validate_data.py +283 -0
  145. dsp_tools/commands/validate_data/validation/__init__.py +0 -0
  146. dsp_tools/commands/validate_data/validation/check_duplicate_files.py +55 -0
  147. dsp_tools/commands/validate_data/validation/check_for_unknown_classes.py +67 -0
  148. dsp_tools/commands/validate_data/validation/get_validation_report.py +94 -0
  149. dsp_tools/commands/validate_data/validation/validate_ontology.py +107 -0
  150. dsp_tools/commands/xmlupload/CLAUDE.md +292 -0
  151. dsp_tools/commands/xmlupload/__init__.py +0 -0
  152. dsp_tools/commands/xmlupload/iri_resolver.py +21 -0
  153. dsp_tools/commands/xmlupload/make_rdf_graph/__init__.py +0 -0
  154. dsp_tools/commands/xmlupload/make_rdf_graph/constants.py +63 -0
  155. dsp_tools/commands/xmlupload/make_rdf_graph/jsonld_utils.py +44 -0
  156. dsp_tools/commands/xmlupload/make_rdf_graph/make_file_value.py +77 -0
  157. dsp_tools/commands/xmlupload/make_rdf_graph/make_resource_and_values.py +114 -0
  158. dsp_tools/commands/xmlupload/make_rdf_graph/make_values.py +262 -0
  159. dsp_tools/commands/xmlupload/models/__init__.py +0 -0
  160. dsp_tools/commands/xmlupload/models/bitstream_info.py +18 -0
  161. dsp_tools/commands/xmlupload/models/formatted_text_value.py +10 -0
  162. dsp_tools/commands/xmlupload/models/ingest.py +143 -0
  163. dsp_tools/commands/xmlupload/models/input_problems.py +58 -0
  164. dsp_tools/commands/xmlupload/models/lookup_models.py +21 -0
  165. dsp_tools/commands/xmlupload/models/permission.py +45 -0
  166. dsp_tools/commands/xmlupload/models/permissions_parsed.py +93 -0
  167. dsp_tools/commands/xmlupload/models/processed/__init__.py +0 -0
  168. dsp_tools/commands/xmlupload/models/processed/file_values.py +29 -0
  169. dsp_tools/commands/xmlupload/models/processed/res.py +27 -0
  170. dsp_tools/commands/xmlupload/models/processed/values.py +101 -0
  171. dsp_tools/commands/xmlupload/models/rdf_models.py +26 -0
  172. dsp_tools/commands/xmlupload/models/upload_clients.py +14 -0
  173. dsp_tools/commands/xmlupload/models/upload_state.py +20 -0
  174. dsp_tools/commands/xmlupload/prepare_xml_input/__init__.py +0 -0
  175. dsp_tools/commands/xmlupload/prepare_xml_input/ark2iri.py +55 -0
  176. dsp_tools/commands/xmlupload/prepare_xml_input/get_processed_resources.py +252 -0
  177. dsp_tools/commands/xmlupload/prepare_xml_input/iiif_uri_validator.py +50 -0
  178. dsp_tools/commands/xmlupload/prepare_xml_input/list_client.py +120 -0
  179. dsp_tools/commands/xmlupload/prepare_xml_input/prepare_xml_input.py +67 -0
  180. dsp_tools/commands/xmlupload/prepare_xml_input/read_validate_xml_file.py +58 -0
  181. dsp_tools/commands/xmlupload/prepare_xml_input/transform_input_values.py +118 -0
  182. dsp_tools/commands/xmlupload/resource_create_client.py +25 -0
  183. dsp_tools/commands/xmlupload/richtext_id2iri.py +37 -0
  184. dsp_tools/commands/xmlupload/stash/__init__.py +0 -0
  185. dsp_tools/commands/xmlupload/stash/analyse_circular_reference_graph.py +236 -0
  186. dsp_tools/commands/xmlupload/stash/create_info_for_graph.py +53 -0
  187. dsp_tools/commands/xmlupload/stash/graph_models.py +87 -0
  188. dsp_tools/commands/xmlupload/stash/stash_circular_references.py +68 -0
  189. dsp_tools/commands/xmlupload/stash/stash_models.py +109 -0
  190. dsp_tools/commands/xmlupload/stash/upload_stashed_resptr_props.py +106 -0
  191. dsp_tools/commands/xmlupload/stash/upload_stashed_xml_texts.py +196 -0
  192. dsp_tools/commands/xmlupload/upload_config.py +76 -0
  193. dsp_tools/commands/xmlupload/write_diagnostic_info.py +27 -0
  194. dsp_tools/commands/xmlupload/xmlupload.py +516 -0
  195. dsp_tools/config/__init__.py +0 -0
  196. dsp_tools/config/logger_config.py +69 -0
  197. dsp_tools/config/warnings_config.py +32 -0
  198. dsp_tools/error/__init__.py +0 -0
  199. dsp_tools/error/custom_warnings.py +39 -0
  200. dsp_tools/error/exceptions.py +204 -0
  201. dsp_tools/error/problems.py +10 -0
  202. dsp_tools/error/xmllib_errors.py +20 -0
  203. dsp_tools/error/xmllib_warnings.py +54 -0
  204. dsp_tools/error/xmllib_warnings_util.py +159 -0
  205. dsp_tools/error/xsd_validation_error_msg.py +19 -0
  206. dsp_tools/legacy_models/__init__.py +0 -0
  207. dsp_tools/legacy_models/datetimestamp.py +81 -0
  208. dsp_tools/legacy_models/langstring.py +253 -0
  209. dsp_tools/legacy_models/projectContext.py +49 -0
  210. dsp_tools/py.typed +0 -0
  211. dsp_tools/resources/schema/data.xsd +648 -0
  212. dsp_tools/resources/schema/lists-only.json +72 -0
  213. dsp_tools/resources/schema/project.json +1258 -0
  214. dsp_tools/resources/schema/properties-only.json +874 -0
  215. dsp_tools/resources/schema/resources-only.json +140 -0
  216. dsp_tools/resources/start-stack/docker-compose.override-host.j2 +11 -0
  217. dsp_tools/resources/start-stack/docker-compose.override.yml +11 -0
  218. dsp_tools/resources/start-stack/docker-compose.yml +88 -0
  219. dsp_tools/resources/start-stack/dsp-app-config.json +45 -0
  220. dsp_tools/resources/start-stack/dsp-app-config.override-host.j2 +26 -0
  221. dsp_tools/resources/validate_data/api-shapes-resource-cardinalities.ttl +191 -0
  222. dsp_tools/resources/validate_data/api-shapes.ttl +804 -0
  223. dsp_tools/resources/validate_data/shacl-cli-image.yml +4 -0
  224. dsp_tools/resources/validate_data/validate-ontology.ttl +99 -0
  225. dsp_tools/utils/__init__.py +0 -0
  226. dsp_tools/utils/ansi_colors.py +32 -0
  227. dsp_tools/utils/data_formats/__init__.py +0 -0
  228. dsp_tools/utils/data_formats/date_util.py +166 -0
  229. dsp_tools/utils/data_formats/iri_util.py +30 -0
  230. dsp_tools/utils/data_formats/shared.py +81 -0
  231. dsp_tools/utils/data_formats/uri_util.py +76 -0
  232. dsp_tools/utils/fuseki_bloating.py +63 -0
  233. dsp_tools/utils/json_parsing.py +22 -0
  234. dsp_tools/utils/rdf_constants.py +42 -0
  235. dsp_tools/utils/rdflib_utils.py +10 -0
  236. dsp_tools/utils/replace_id_with_iri.py +66 -0
  237. dsp_tools/utils/request_utils.py +238 -0
  238. dsp_tools/utils/xml_parsing/__init__.py +0 -0
  239. dsp_tools/utils/xml_parsing/get_lookups.py +32 -0
  240. dsp_tools/utils/xml_parsing/get_parsed_resources.py +325 -0
  241. dsp_tools/utils/xml_parsing/models/__init__.py +0 -0
  242. dsp_tools/utils/xml_parsing/models/parsed_resource.py +76 -0
  243. dsp_tools/utils/xml_parsing/parse_clean_validate_xml.py +137 -0
  244. dsp_tools/xmllib/CLAUDE.md +302 -0
  245. dsp_tools/xmllib/__init__.py +49 -0
  246. dsp_tools/xmllib/general_functions.py +877 -0
  247. dsp_tools/xmllib/internal/__init__.py +0 -0
  248. dsp_tools/xmllib/internal/checkers.py +162 -0
  249. dsp_tools/xmllib/internal/circumvent_circular_imports.py +36 -0
  250. dsp_tools/xmllib/internal/constants.py +46 -0
  251. dsp_tools/xmllib/internal/input_converters.py +155 -0
  252. dsp_tools/xmllib/internal/serialise_file_value.py +57 -0
  253. dsp_tools/xmllib/internal/serialise_resource.py +177 -0
  254. dsp_tools/xmllib/internal/serialise_values.py +152 -0
  255. dsp_tools/xmllib/internal/type_aliases.py +11 -0
  256. dsp_tools/xmllib/models/__init__.py +0 -0
  257. dsp_tools/xmllib/models/config_options.py +28 -0
  258. dsp_tools/xmllib/models/date_formats.py +48 -0
  259. dsp_tools/xmllib/models/dsp_base_resources.py +1542 -0
  260. dsp_tools/xmllib/models/internal/__init__.py +0 -0
  261. dsp_tools/xmllib/models/internal/file_values.py +172 -0
  262. dsp_tools/xmllib/models/internal/geometry.py +162 -0
  263. dsp_tools/xmllib/models/internal/migration_metadata.py +55 -0
  264. dsp_tools/xmllib/models/internal/serialise_permissions.py +66 -0
  265. dsp_tools/xmllib/models/internal/values.py +342 -0
  266. dsp_tools/xmllib/models/licenses/__init__.py +0 -0
  267. dsp_tools/xmllib/models/licenses/other.py +59 -0
  268. dsp_tools/xmllib/models/licenses/recommended.py +107 -0
  269. dsp_tools/xmllib/models/permissions.py +41 -0
  270. dsp_tools/xmllib/models/res.py +1782 -0
  271. dsp_tools/xmllib/models/root.py +348 -0
  272. dsp_tools/xmllib/value_checkers.py +434 -0
  273. dsp_tools/xmllib/value_converters.py +777 -0
  274. dsp_tools-18.3.0.post13.dist-info/METADATA +90 -0
  275. dsp_tools-18.3.0.post13.dist-info/RECORD +286 -0
  276. dsp_tools-18.3.0.post13.dist-info/WHEEL +4 -0
  277. dsp_tools-18.3.0.post13.dist-info/entry_points.txt +3 -0
  278. dsp_tools-0.9.13.dist-info/LICENSE +0 -674
  279. dsp_tools-0.9.13.dist-info/METADATA +0 -144
  280. dsp_tools-0.9.13.dist-info/RECORD +0 -71
  281. dsp_tools-0.9.13.dist-info/WHEEL +0 -5
  282. dsp_tools-0.9.13.dist-info/entry_points.txt +0 -3
  283. dsp_tools-0.9.13.dist-info/top_level.txt +0 -1
  284. dsplib/models/connection.py +0 -272
  285. dsplib/models/group.py +0 -296
  286. dsplib/models/helpers.py +0 -505
  287. dsplib/models/langstring.py +0 -277
  288. dsplib/models/listnode.py +0 -578
  289. dsplib/models/model.py +0 -20
  290. dsplib/models/ontology.py +0 -448
  291. dsplib/models/permission.py +0 -112
  292. dsplib/models/project.py +0 -547
  293. dsplib/models/propertyclass.py +0 -505
  294. dsplib/models/resource.py +0 -366
  295. dsplib/models/resourceclass.py +0 -810
  296. dsplib/models/sipi.py +0 -30
  297. dsplib/models/user.py +0 -731
  298. dsplib/models/value.py +0 -1000
  299. dsplib/utils/knora-data-schema.xsd +0 -454
  300. dsplib/utils/knora-schema-lists.json +0 -83
  301. dsplib/utils/knora-schema.json +0 -434
  302. dsplib/utils/onto_commons.py +0 -24
  303. dsplib/utils/onto_create_lists.py +0 -73
  304. dsplib/utils/onto_create_ontology.py +0 -442
  305. dsplib/utils/onto_get.py +0 -58
  306. dsplib/utils/onto_validate.py +0 -33
  307. dsplib/utils/xml_upload.py +0 -539
  308. dsplib/widgets/doublepassword.py +0 -80
  309. knora/MLS-import-libraries.py +0 -84
  310. knora/dsp_tools.py +0 -96
  311. knora/dsplib/models/connection.py +0 -272
  312. knora/dsplib/models/group.py +0 -296
  313. knora/dsplib/models/helpers.py +0 -506
  314. knora/dsplib/models/langstring.py +0 -277
  315. knora/dsplib/models/listnode.py +0 -578
  316. knora/dsplib/models/model.py +0 -20
  317. knora/dsplib/models/ontology.py +0 -448
  318. knora/dsplib/models/permission.py +0 -112
  319. knora/dsplib/models/project.py +0 -583
  320. knora/dsplib/models/propertyclass.py +0 -505
  321. knora/dsplib/models/resource.py +0 -416
  322. knora/dsplib/models/resourceclass.py +0 -811
  323. knora/dsplib/models/sipi.py +0 -35
  324. knora/dsplib/models/user.py +0 -731
  325. knora/dsplib/models/value.py +0 -1000
  326. knora/dsplib/utils/knora-data-schema.xsd +0 -464
  327. knora/dsplib/utils/knora-schema-lists.json +0 -83
  328. knora/dsplib/utils/knora-schema.json +0 -444
  329. knora/dsplib/utils/onto_commons.py +0 -24
  330. knora/dsplib/utils/onto_create_lists.py +0 -73
  331. knora/dsplib/utils/onto_create_ontology.py +0 -451
  332. knora/dsplib/utils/onto_get.py +0 -58
  333. knora/dsplib/utils/onto_validate.py +0 -33
  334. knora/dsplib/utils/xml_upload.py +0 -540
  335. knora/dsplib/widgets/doublepassword.py +0 -80
  336. knora/knora.py +0 -2108
  337. knora/test.py +0 -99
  338. knora/testit.py +0 -76
  339. knora/xml2knora.py +0 -633
  340. {dsplib → dsp_tools/cli}/__init__.py +0 -0
  341. {dsplib/models → dsp_tools/clients}/__init__.py +0 -0
  342. {dsplib/utils → dsp_tools/commands}/__init__.py +0 -0
  343. {dsplib/widgets → dsp_tools/commands/create}/__init__.py +0 -0
  344. {knora → dsp_tools/commands/create/create_on_server}/__init__.py +0 -0
  345. {knora/dsplib → dsp_tools/commands/create/models}/__init__.py +0 -0
  346. {knora/dsplib/models → dsp_tools/commands/create/parsing}/__init__.py +0 -0
  347. {knora/dsplib/utils → dsp_tools/commands/create/serialisation}/__init__.py +0 -0
  348. {knora/dsplib/widgets → dsp_tools/commands/excel2json}/__init__.py +0 -0
@@ -0,0 +1,804 @@
1
+ @prefix sh: <http://www.w3.org/ns/shacl#> .
2
+ @prefix dash: <http://datashapes.org/dash#> .
3
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
4
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
5
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
6
+ @prefix owl: <http://www.w3.org/2002/07/owl#> .
7
+ @prefix knora-api: <http://api.knora.org/ontology/knora-api/v2#> .
8
+
9
+ @prefix api-shapes: <http://api.knora.org/ontology/knora-api/shapes/v2#> .
10
+
11
+ #########################################
12
+ # GENERAL SHAPES
13
+ #########################################
14
+
15
+ # Cardinalities for the Resources are validated through designated shapes for the cardinality violations.
16
+ # Adding cardinalities to properties here would lead to duplication of the error message,
17
+ # therefore only the content is validated with the shapes for the resources.
18
+
19
+ ########################
20
+ # UNIQUE VALUE SHAPE
21
+ ########################
22
+
23
+ api-shapes:UniqueValue_Shape
24
+ a sh:NodeShape ;
25
+ sh:targetClass knora-api:Resource ;
26
+ sh:sparql [
27
+ a sh:SPARQLConstraint ;
28
+ sh:select """
29
+ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
30
+ PREFIX knora-api: <http://api.knora.org/ontology/knora-api/v2#>
31
+ PREFIX api-shapes: <http://api.knora.org/ontology/knora-api/shapes/v2#>
32
+
33
+ SELECT $this ?path ?value WHERE {
34
+
35
+ $this ?path ?valueClass .
36
+
37
+ {
38
+ ?prop rdfs:subPropertyOf knora-api:valueHas .
39
+ ?valueClass ?prop ?value .
40
+ }
41
+ UNION
42
+ {
43
+ ?valueClass knora-api:valueAsString|api-shapes:linkValueHasTargetID ?value .
44
+ }
45
+ FILTER NOT EXISTS { ?valueClass knora-api:valueHasComment ?value }
46
+ }
47
+ GROUP BY $this ?path ?value
48
+ HAVING (COUNT(?value) > 1)
49
+ """ ;
50
+ sh:severity sh:Violation ;
51
+ sh:message "A resource may not have the same property and value more than one time." ;
52
+ ] .
53
+
54
+
55
+ ########################
56
+ # GENERIC RESOURCE SHAPE
57
+ ########################
58
+
59
+ api-shapes:Resource_Shape
60
+ a sh:NodeShape ;
61
+ sh:targetClass knora-api:Resource ;
62
+ sh:name "Validates generic properties of all Resources" ;
63
+ sh:property [
64
+ a sh:PropertyShape ;
65
+ sh:path rdfs:label ;
66
+ sh:datatype xsd:string ;
67
+ sh:pattern "\\s*\\S+\\s*" ;
68
+ dash:singleLine true ;
69
+ sh:severity sh:Violation ;
70
+ sh:message "The label must be a non-empty string without newlines."
71
+ ] ,
72
+ [
73
+ # Currently StandOff are attached directly to the resource and not in a LinkValue,
74
+ # therefore we do not validate it like a normal link with a LinkValue
75
+ a sh:PropertyShape ;
76
+ sh:path knora-api:hasStandoffLinkTo ;
77
+ sh:class knora-api:Resource ;
78
+ sh:severity sh:Violation ;
79
+ sh:message "A stand-off link must target an existing resource."
80
+ ] .
81
+
82
+
83
+ ########################
84
+ # USER FACING VALUES
85
+ ########################
86
+
87
+ # Cardinalities for Values are not evaluated separately and they can be included in this file.
88
+ # This however, will only work as long as the shapes for the knora-api:Value are not closed.
89
+
90
+ api-shapes:Value_ClassShape
91
+ a sh:NodeShape ;
92
+ sh:targetClass knora-api:Value ;
93
+ sh:property [
94
+ a sh:PropertyShape ;
95
+ sh:path knora-api:valueHasComment ;
96
+ sh:datatype xsd:string ;
97
+ sh:pattern "\\s*\\S+\\s*" ;
98
+ sh:minCount 0 ;
99
+ sh:maxCount 1 ;
100
+ sh:severity sh:Violation ;
101
+ sh:message "The comment on the value must be a non-empty string"
102
+ ] .
103
+
104
+
105
+ api-shapes:BooleanValue_ClassShape
106
+ a sh:NodeShape ;
107
+ sh:name "Validates the properties used with this targetClass" ;
108
+ sh:targetClass knora-api:BooleanValue ;
109
+ sh:property [
110
+ a sh:PropertyShape ;
111
+ sh:path knora-api:booleanValueAsBoolean ;
112
+ sh:datatype xsd:boolean ;
113
+ sh:minCount 1 ;
114
+ sh:maxCount 1 ;
115
+ sh:severity sh:Violation ;
116
+ sh:message "A BooleanValue requires exactly one valid boolean"
117
+ ] .
118
+
119
+ api-shapes:ColorValue_ClassShape
120
+ a sh:NodeShape ;
121
+ sh:name "Validates the properties used with this targetClass" ;
122
+ sh:targetClass knora-api:ColorValue ;
123
+ sh:property [
124
+ a sh:PropertyShape ;
125
+ sh:path knora-api:colorValueAsColor ;
126
+ sh:datatype xsd:string ;
127
+ sh:pattern "^#([0-9a-fA-F]{3}){1,2}$" ;
128
+ sh:minCount 1 ;
129
+ sh:maxCount 1 ;
130
+ sh:severity sh:Violation ;
131
+ sh:message "A ColorValue requires exactly one valid color"
132
+ ] .
133
+
134
+ api-shapes:DateValue_ClassShape
135
+ a sh:NodeShape ;
136
+ sh:name "Validates the properties used with this targetClass" ;
137
+ sh:targetClass knora-api:DateValue ;
138
+ sh:property [
139
+ a sh:PropertyShape ;
140
+ sh:path knora-api:valueAsString ;
141
+ sh:datatype xsd:string ;
142
+ sh:pattern "\\s*\\S+\\s*" ;
143
+ sh:minCount 1 ;
144
+ sh:maxCount 1 ;
145
+ sh:severity sh:Violation ;
146
+ sh:message "A DateValue requires a valid Date"
147
+ ] ,
148
+ [
149
+ a sh:PropertyShape ;
150
+ sh:path api-shapes:dateHasStart ;
151
+ sh:or (
152
+ [ sh:datatype xsd:gYear ]
153
+ [ sh:datatype xsd:gYearMonth ]
154
+ [ sh:datatype xsd:date ]
155
+ ) ;
156
+ sh:severity sh:Violation ;
157
+ sh:message "The entered date cannot be parsed into a valid date. It may have issues with the month and/or day number."
158
+ ] ,
159
+ [
160
+ a sh:PropertyShape ;
161
+ sh:path api-shapes:dateHasEnd ;
162
+ sh:or (
163
+ [ sh:datatype xsd:gYear ]
164
+ [ sh:datatype xsd:gYearMonth ]
165
+ [ sh:datatype xsd:date ]
166
+ ) ;
167
+ sh:severity sh:Violation ;
168
+ sh:message "The entered date cannot be parsed into a valid date. It may have issues with the month and/or day number."
169
+ ] ,
170
+ [
171
+ a sh:PropertyShape ;
172
+ sh:path api-shapes:dateHasStart ;
173
+ sh:lessThanOrEquals api-shapes:dateHasEnd ;
174
+ sh:severity sh:Violation ;
175
+ sh:message "The end date must be equal or later than the start date."
176
+ ] ,
177
+ [
178
+ a sh:PropertyShape ;
179
+ sh:path api-shapes:dateHasStart ;
180
+ dash:coExistsWith api-shapes:dateHasEnd ;
181
+ sh:severity sh:Violation ;
182
+ sh:message "The start date may not be later than the end date. Please take a look if your eras are correct."
183
+ ] .
184
+
185
+ api-shapes:DecimalValue_ClassShape
186
+ a sh:NodeShape ;
187
+ sh:name "Validates the properties used with this targetClass" ;
188
+ sh:targetClass knora-api:DecimalValue ;
189
+ sh:property [
190
+ a sh:PropertyShape ;
191
+ sh:path knora-api:decimalValueAsDecimal ;
192
+ sh:datatype xsd:decimal ;
193
+ sh:minCount 1 ;
194
+ sh:maxCount 1 ;
195
+ sh:severity sh:Violation ;
196
+ sh:message "A DecimalValue requires exactly one valid decimal"
197
+ ] .
198
+
199
+ api-shapes:GeonameValue_ClassShape
200
+ a sh:NodeShape ;
201
+ sh:name "Validates the properties used with this targetClass" ;
202
+ sh:targetClass knora-api:GeonameValue ;
203
+ sh:property [
204
+ a sh:PropertyShape ;
205
+ sh:path knora-api:geonameValueAsGeonameCode ;
206
+ sh:datatype xsd:string ;
207
+ sh:pattern "^\\d+$" ;
208
+ sh:minCount 1 ;
209
+ sh:maxCount 1 ;
210
+ sh:severity sh:Violation ;
211
+ sh:message "The value must be a valid geoname code"
212
+ ] .
213
+
214
+ api-shapes:GeomValue_ClassShape
215
+ a sh:NodeShape ;
216
+ sh:name "Validates the properties used with this targetClass" ;
217
+ sh:targetClass knora-api:GeomValue ;
218
+ sh:property [
219
+ a sh:PropertyShape ;
220
+ sh:path knora-api:geometryValueAsGeometry ;
221
+ sh:datatype xsd:string ;
222
+ sh:pattern "\\s*\\S+\\s*" ;
223
+ sh:minCount 1 ;
224
+ sh:maxCount 1 ;
225
+ sh:severity sh:Violation ;
226
+ sh:message "The value must be a valid geometry JSON object"
227
+ ] .
228
+
229
+ api-shapes:IntervalValue_ClassShape
230
+ a sh:NodeShape ;
231
+ sh:name "Validates the properties used with this targetClass" ;
232
+ sh:targetClass knora-api:IntervalValue ;
233
+ sh:property [
234
+ a sh:PropertyShape ;
235
+ sh:path knora-api:intervalValueHasStart ;
236
+ sh:datatype xsd:decimal ;
237
+ sh:minInclusive 0 ;
238
+ sh:minCount 1 ;
239
+ sh:maxCount 1 ;
240
+ sh:severity sh:Violation ;
241
+ sh:message "The interval start must be a non-negative integer or decimal."
242
+ ] ,
243
+ [
244
+ a sh:PropertyShape ;
245
+ sh:path knora-api:intervalValueHasEnd ;
246
+ sh:datatype xsd:decimal ;
247
+ sh:minExclusive 0 ;
248
+ sh:minCount 1 ;
249
+ sh:maxCount 1 ;
250
+ sh:severity sh:Violation ;
251
+ sh:message "The interval end must be an integer or decimal that is larger than 0."
252
+ ] ,
253
+
254
+ [
255
+ sh:path knora-api:intervalValueHasStart ;
256
+ sh:lessThan knora-api:intervalValueHasEnd ;
257
+ sh:severity sh:Violation ;
258
+ sh:message "The start of the interval must be smaller than the end."
259
+ ] .
260
+
261
+ api-shapes:IntValue_ClassShape
262
+ a sh:NodeShape ;
263
+ sh:name "Validates the properties used with this targetClass" ;
264
+ sh:targetClass knora-api:IntValue ;
265
+ sh:property [
266
+ a sh:PropertyShape ;
267
+ sh:path knora-api:intValueAsInt ;
268
+ sh:minCount 1 ;
269
+ sh:maxCount 1 ;
270
+ sh:severity sh:Violation ;
271
+ sh:message "An IntValue requires exactly one valid integer"
272
+ ] ,
273
+ [
274
+ a sh:PropertyShape ;
275
+ sh:path knora-api:intValueAsInt ;
276
+ sh:datatype xsd:int ;
277
+ sh:severity sh:Violation ;
278
+ sh:message "The integer must be within the range of -2'147'483'648 and 2'147'483'647."
279
+ ] .
280
+
281
+ ##############
282
+ # LinkValue
283
+ # The target of the LinkValue is ontology specific.
284
+ # The Shape is constructed through the SPARQL queries
285
+
286
+ ##############
287
+ # ListValue
288
+ # The target of the ListValue is ontology specific.
289
+ # The Shape is constructed through the SPARQL queries
290
+
291
+
292
+ api-shapes:SimpleTextValue_ClassShape
293
+ a sh:NodeShape ;
294
+ sh:name "Ensures that the properties for a simple text value are used" ;
295
+ sh:property [
296
+ # Because it is not a separate class we have to check the cardinality of the property
297
+ a sh:PropertyShape ;
298
+ sh:path knora-api:valueAsString ;
299
+ sh:datatype xsd:string ;
300
+ sh:minCount 1 ;
301
+ sh:maxCount 1 ;
302
+ sh:severity sh:Violation ;
303
+ sh:message "TextValue without formatting"
304
+ ] ,
305
+ [
306
+ a sh:PropertyShape ;
307
+ sh:path knora-api:valueAsString ;
308
+ sh:datatype xsd:string ;
309
+ sh:pattern "\\s*\\S+\\s*" ;
310
+ dash:singleLine true ;
311
+ sh:severity sh:Violation ;
312
+ sh:message "The value must be a non-empty string without newlines."
313
+ ] .
314
+
315
+ api-shapes:TextareaTextValue_ClassShape
316
+ a sh:NodeShape ;
317
+ sh:name "Ensures that the properties for a simple text value are used" ;
318
+ sh:property [
319
+ # Because it is not a separate class we have to check the cardinality of the property
320
+ a sh:PropertyShape ;
321
+ sh:path knora-api:valueAsString ;
322
+ sh:datatype xsd:string ;
323
+ sh:minCount 1 ;
324
+ sh:maxCount 1 ;
325
+ sh:severity sh:Violation ;
326
+ sh:message "TextValue without formatting"
327
+ ] ,
328
+ [
329
+ a sh:PropertyShape ;
330
+ sh:path knora-api:valueAsString ;
331
+ sh:datatype xsd:string ;
332
+ sh:pattern "\\s*\\S+\\s*" ;
333
+ sh:severity sh:Violation ;
334
+ sh:message "The value must be a non-empty string"
335
+ ] .
336
+
337
+ api-shapes:FormattedTextValue_ClassShape
338
+ a sh:NodeShape ;
339
+ sh:name "Ensures that the properties for a formatted text value are used" ;
340
+ sh:property [
341
+ # Because it is not a separate class we have to check the cardinality of the property
342
+ a sh:PropertyShape ;
343
+ sh:path knora-api:textValueAsXml ;
344
+ sh:datatype xsd:string ;
345
+ sh:minCount 1 ;
346
+ sh:maxCount 1 ;
347
+ sh:severity sh:Violation ;
348
+ sh:message "TextValue with formatting"
349
+ ] ,
350
+ [
351
+ a sh:PropertyShape ;
352
+ sh:path knora-api:textValueAsXml ;
353
+ sh:datatype xsd:string ;
354
+ sh:pattern "\\s*\\S+\\s*" ;
355
+ sh:severity sh:Violation ;
356
+ sh:message "The value must be a non-empty string"
357
+ ] .
358
+
359
+ api-shapes:TimeValue_ClassShape
360
+ a sh:NodeShape ;
361
+ sh:name "Validates the properties used with this targetClass" ;
362
+ sh:targetClass knora-api:TimeValue ;
363
+ sh:property [
364
+ a sh:PropertyShape ;
365
+ sh:path knora-api:timeValueAsTimeStamp ;
366
+ sh:datatype xsd:dateTimeStamp ;
367
+ sh:minCount 1 ;
368
+ sh:maxCount 1 ;
369
+ sh:severity sh:Violation ;
370
+ sh:message "A TimeValue requires exactly one valid xsd:dateTimeStamp"
371
+ ] .
372
+
373
+ api-shapes:UriValue_ClassShape
374
+ a sh:NodeShape ;
375
+ sh:name "Validates the properties used with this targetClass" ;
376
+ sh:targetClass knora-api:UriValue ;
377
+ sh:property [
378
+ a sh:PropertyShape ;
379
+ sh:path knora-api:uriValueAsUri ;
380
+ sh:datatype xsd:anyURI ;
381
+ sh:minCount 1 ;
382
+ sh:maxCount 1 ;
383
+ sh:severity sh:Violation ;
384
+ sh:message "A UriValue requires exactly one valid xsd:anyURI"
385
+ ] .
386
+
387
+
388
+ #########################################
389
+ # FILEVALUE
390
+ #########################################
391
+
392
+ api-shapes:FileValue_ClassShape
393
+ a sh:NodeShape ;
394
+ sh:targetClass knora-api:FileValue ;
395
+ sh:property [
396
+ a sh:PropertyShape ;
397
+ sh:path knora-api:hasPermissions ;
398
+ sh:minCount 0 ;
399
+ sh:maxCount 1 ;
400
+ sh:severity sh:Violation ;
401
+ sh:message "A FileValue may have at most one permission."
402
+ ] ,
403
+ [
404
+ a sh:PropertyShape ;
405
+ sh:path knora-api:hasLicense ;
406
+ sh:minCount 1 ;
407
+ sh:maxCount 1 ;
408
+ sh:severity sh:Warning ;
409
+ sh:message "Files and IIIF-URIs require a reference to a license."
410
+ ] ,
411
+ [
412
+ a sh:PropertyShape ;
413
+ sh:path knora-api:hasAuthorship ;
414
+ sh:datatype xsd:string ;
415
+ sh:minCount 1 ;
416
+ sh:severity sh:Warning ;
417
+ sh:message "Files and IIIF-URIs require at least one authorship."
418
+ ] ,
419
+ [
420
+ a sh:PropertyShape ;
421
+ sh:path knora-api:hasAuthorship ;
422
+ sh:datatype xsd:string ;
423
+ sh:pattern "\\s*\\S+\\s*" ;
424
+ dash:singleLine true ;
425
+ sh:severity sh:Violation ;
426
+ sh:message "The authorship must be a non-empty string without newlines."
427
+ ] ,
428
+ [
429
+ a sh:PropertyShape ;
430
+ sh:path knora-api:hasCopyrightHolder ;
431
+ sh:datatype xsd:string ;
432
+ sh:minCount 1 ;
433
+ sh:maxCount 1 ;
434
+ sh:severity sh:Warning ;
435
+ sh:message "Files and IIIF-URIs require a copyright holder."
436
+ ] ,
437
+ [
438
+ a sh:PropertyShape ;
439
+ sh:path knora-api:hasCopyrightHolder ;
440
+ sh:datatype xsd:string ;
441
+ sh:pattern "\\s*\\S+\\s*" ;
442
+ dash:singleLine true ;
443
+ sh:severity sh:Violation ;
444
+ sh:message "The copyright holder must be a non-empty string without newlines."
445
+ ] .
446
+
447
+
448
+ api-shapes:ArchiveFileValue_ClassShape
449
+ a sh:NodeShape ;
450
+ sh:name "Validates the class type" ;
451
+ sh:targetClass knora-api:ArchiveFileValue ;
452
+ sh:property [
453
+ a sh:PropertyShape ;
454
+ sh:path knora-api:fileValueHasFilename ;
455
+ sh:datatype xsd:string ;
456
+ sh:pattern ".+\\.(zip|tar|gz|z|tgz|gzip|7z)$" ;
457
+ sh:flags "i" ; # case insensitive
458
+ sh:minCount 1 ;
459
+ sh:maxCount 1 ;
460
+ sh:severity sh:Violation ;
461
+ sh:message """
462
+ An ArchiveRepresentation requires a file with one of the following extensions
463
+ 'zip', 'tar', 'gz', 'z', 'tgz', 'gzip', '7z'.
464
+ """
465
+ ] .
466
+
467
+ api-shapes:AudioFileValue_ClassShape
468
+ a sh:NodeShape ;
469
+ sh:name "Validates the class type" ;
470
+ sh:targetClass knora-api:AudioFileValue ;
471
+ sh:property [
472
+ a sh:PropertyShape ;
473
+ sh:path knora-api:fileValueHasFilename ;
474
+ sh:datatype xsd:string ;
475
+ sh:pattern ".+\\.(mp3|wav)$" ;
476
+ sh:flags "i" ; # case insensitive
477
+ sh:minCount 1 ;
478
+ sh:maxCount 1 ;
479
+ sh:severity sh:Violation ;
480
+ sh:message "An AudioRepresentation requires a file with one of the following extensions 'mp3', 'wav'."
481
+ ] .
482
+
483
+ api-shapes:DocumentFileValue_ClassShape
484
+ a sh:NodeShape ;
485
+ sh:name "Validates the class type" ;
486
+ sh:targetClass knora-api:DocumentFileValue ;
487
+ sh:property [
488
+ a sh:PropertyShape ;
489
+ sh:path knora-api:fileValueHasFilename ;
490
+ sh:datatype xsd:string ;
491
+ sh:pattern ".+\\.(pdf|doc|docx|xls|xlsx|ppt|pptx|epub)$" ;
492
+ sh:flags "i" ; # case insensitive
493
+ sh:minCount 1 ;
494
+ sh:maxCount 1 ;
495
+ sh:severity sh:Violation ;
496
+ sh:message """
497
+ A DocumentRepresentation requires a file with one of the following extensions
498
+ 'pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'epub'.
499
+ """
500
+ ] .
501
+
502
+ api-shapes:MovingImageFileValue_ClassShape
503
+ a sh:NodeShape ;
504
+ sh:name "Validates the class type" ;
505
+ sh:targetClass knora-api:MovingImageFileValue ;
506
+ sh:property [
507
+ a sh:PropertyShape ;
508
+ sh:path knora-api:fileValueHasFilename ;
509
+ sh:datatype xsd:string ;
510
+ sh:pattern ".+\\.mp4$" ;
511
+ sh:flags "i" ; # case insensitive
512
+ sh:minCount 1 ;
513
+ sh:maxCount 1 ;
514
+ sh:severity sh:Violation ;
515
+ sh:message "A MovingImageRepresentation requires a file with the extension 'mp4'."
516
+ ] .
517
+
518
+ api-shapes:StillImageFileValue_ClassShape
519
+ a sh:NodeShape ;
520
+ sh:name "Validates the class type" ;
521
+ sh:targetClass knora-api:StillImageFileValue ;
522
+ sh:property [
523
+ a sh:PropertyShape ;
524
+ sh:path knora-api:fileValueHasFilename ;
525
+ sh:datatype xsd:string ;
526
+ sh:pattern ".+\\.(jpg|jpeg|png|tif|tiff|jp2|jpx)$" ; # jpx is the extension of the files returned by dsp-ingest
527
+ sh:flags "i" ; # case insensitive
528
+ sh:minCount 1 ;
529
+ sh:maxCount 1 ;
530
+ sh:severity sh:Violation ;
531
+ sh:message """
532
+ A StillImageFileValue requires a file with one of the extensions:
533
+ 'jpg', 'jpeg', 'png', 'tif', 'tiff', 'jp2'.
534
+ """
535
+ ] .
536
+
537
+ api-shapes:StillImageExternalFileValue_ClassShape
538
+ a sh:NodeShape ;
539
+ sh:name "Validates the class type" ;
540
+ sh:targetClass knora-api:StillImageExternalFileValue ;
541
+ sh:property [
542
+ a sh:PropertyShape ;
543
+ sh:path knora-api:stillImageFileValueHasExternalUrl ;
544
+ sh:minCount 1 ;
545
+ sh:maxCount 1 ;
546
+ sh:severity sh:Violation ;
547
+ sh:message "StillImageExternalFileValue requires an external IIIF-URI"
548
+ ] ,
549
+ [
550
+ a sh:PropertyShape ;
551
+ sh:path knora-api:stillImageFileValueHasExternalUrl ;
552
+ sh:datatype xsd:anyURI ;
553
+ sh:severity sh:Violation ;
554
+ sh:message "Your IIIF-URI contains characters that are not allowed in a URI."
555
+ ] .
556
+
557
+ api-shapes:TextFileValue_ClassShape
558
+ a sh:NodeShape ;
559
+ sh:name "Validates the class type" ;
560
+ sh:targetClass knora-api:TextFileValue ;
561
+ sh:property [
562
+ a sh:PropertyShape ;
563
+ sh:path knora-api:fileValueHasFilename ;
564
+ sh:datatype xsd:string ;
565
+ sh:pattern ".+\\.(odd|rng|txt|xml|htm|html|xsd|xsl|csv|json)$" ;
566
+ sh:flags "i" ; # case insensitive
567
+ sh:minCount 1 ;
568
+ sh:maxCount 1 ;
569
+ sh:severity sh:Violation ;
570
+ sh:message """
571
+ A TextRepresentation requires a file with one of the following extensions
572
+ 'odd', 'rng', 'txt', 'xml', 'htm', 'html', 'xsd', 'xsl', 'csv', 'json'.
573
+ """
574
+ ] .
575
+
576
+
577
+ #########################################
578
+ # KNORA-API IN-BUILT PROPERTIES
579
+ #########################################
580
+
581
+ # The following shapes are for properties that are used by several resources.
582
+ # Property shapes only used with one specific resource are defined with the shape for the resource.
583
+
584
+ api-shapes:hasComment_PropertyShape
585
+ a sh:PropertyShape ;
586
+ sh:path knora-api:hasComment ;
587
+ sh:node api-shapes:FormattedTextValue_ClassShape .
588
+
589
+ # dash:coExistsWith ensures that isPartOf also needs seqnum. There is no need for a second shape.
590
+ api-shapes:seqnum_PropShape
591
+ a sh:PropertyShape ;
592
+ sh:path knora-api:seqnum ;
593
+ dash:coExistsWith knora-api:isPartOf ;
594
+ sh:severity sh:Violation ;
595
+ sh:message """
596
+ The property seqnum and isPartOf (or sub-properties of them) must be used together.
597
+ This resource only used one of the properties.
598
+ """ .
599
+
600
+
601
+ #########################################
602
+ # DSP BUILT IN RESOURCES
603
+ #########################################
604
+
605
+ ###########################
606
+ # LinkObj
607
+
608
+ api-shapes:LinkObj_ResourceShape
609
+ a sh:NodeShape ;
610
+ sh:name "Validates the LinkObj resource" ;
611
+ sh:targetClass knora-api:LinkObj ;
612
+ sh:property [
613
+ a sh:PropertyShape ;
614
+ sh:path knora-api:hasLinkTo ;
615
+ sh:class knora-api:LinkValue ;
616
+ sh:severity sh:Violation ;
617
+ sh:message "This property requires a LinkValue"
618
+ ] ,
619
+ [
620
+ a sh:PropertyShape ;
621
+ sh:path knora-api:hasLinkTo ;
622
+ sh:node api-shapes:hasLinkTo_NodeShape
623
+ ] ,
624
+ api-shapes:hasComment_PropertyShape .
625
+
626
+
627
+ api-shapes:hasLinkTo_NodeShape
628
+ a sh:NodeShape ;
629
+ sh:name "This ensures that the target of the property is of type Resource, i.e. exists in the graph." ;
630
+ sh:property [
631
+ a sh:PropertyShape ;
632
+ sh:path api-shapes:linkValueHasTargetID ;
633
+ sh:class knora-api:Resource ;
634
+ sh:severity sh:Violation ;
635
+ sh:message "Range is knora-api:Resource or a subclass."
636
+ ] .
637
+
638
+
639
+ ###########################
640
+ # Region
641
+
642
+ api-shapes:Region_ResourceShape
643
+ a sh:NodeShape ;
644
+ sh:name "Validates the Region resource" ;
645
+ sh:targetClass knora-api:Region ;
646
+ sh:property [
647
+ a sh:PropertyShape ;
648
+ sh:path knora-api:isRegionOf ;
649
+ sh:class knora-api:LinkValue ;
650
+ sh:severity sh:Violation ;
651
+ sh:message "This property requires a LinkValue"
652
+ ] ,
653
+ [
654
+ a sh:PropertyShape ;
655
+ sh:path knora-api:isRegionOf ;
656
+ sh:node api-shapes:isRegionOf_NodeShape
657
+ ] ,
658
+ [
659
+ a sh:PropertyShape ;
660
+ sh:path knora-api:hasColor ;
661
+ sh:class knora-api:ColorValue ;
662
+ sh:message "This property requires a ColorValue"
663
+ ] ,
664
+ [
665
+ a sh:PropertyShape ;
666
+ sh:path knora-api:hasGeometry ;
667
+ sh:class knora-api:GeomValue ;
668
+ sh:message "This property requires a GeomValue"
669
+ ] ,
670
+ api-shapes:hasComment_PropertyShape .
671
+
672
+ api-shapes:isRegionOf_NodeShape
673
+ a sh:NodeShape ;
674
+ sh:name "This ensures that the target of the property is of type Representation and exists in the graph." ;
675
+ sh:property [
676
+ a sh:PropertyShape ;
677
+ sh:path api-shapes:linkValueHasTargetID ;
678
+ sh:class knora-api:Representation ;
679
+ sh:severity sh:Violation ;
680
+ sh:message "http://api.knora.org/ontology/knora-api/v2#Representation"
681
+ ] .
682
+
683
+
684
+ ###########################
685
+ # Segment
686
+
687
+ # These shapes validate the generic properties of the Audio and Video Segment
688
+ # and need not be repeated for each segment type.
689
+
690
+ api-shapes:Segment_ResourceShape
691
+ a sh:NodeShape ;
692
+ sh:name "Validates the Region resource" ;
693
+ sh:targetClass knora-api:Segment ;
694
+ sh:property [
695
+ a sh:PropertyShape ;
696
+ sh:path knora-api:hasSegmentBounds ;
697
+ sh:class knora-api:IntervalValue ;
698
+ sh:severity sh:Violation ;
699
+ sh:message "This property requires an IntervalValue"
700
+ ] ,
701
+ [
702
+ a sh:PropertyShape ;
703
+ sh:path knora-api:hasDescription ;
704
+ sh:node api-shapes:FormattedTextValue_ClassShape
705
+ ] ,
706
+ [
707
+ a sh:PropertyShape ;
708
+ sh:path knora-api:hasTitle ;
709
+ sh:node api-shapes:SimpleTextValue_ClassShape
710
+ ] ,
711
+ [
712
+ a sh:PropertyShape ;
713
+ sh:path knora-api:hasKeyword ;
714
+ sh:node api-shapes:SimpleTextValue_ClassShape
715
+ ] ,
716
+ [
717
+ a sh:PropertyShape ;
718
+ sh:path knora-api:relatesTo ;
719
+ sh:class knora-api:LinkValue ;
720
+ sh:node api-shapes:relatesTo_NodeShape ;
721
+ sh:severity sh:Violation ;
722
+ sh:message "This property requires an LinkValue"
723
+ ] ,
724
+ [
725
+ a sh:PropertyShape ;
726
+ sh:path knora-api:relatesTo ;
727
+ sh:node api-shapes:relatesTo_NodeShape
728
+ ] ,
729
+ api-shapes:hasComment_PropertyShape .
730
+
731
+ api-shapes:relatesTo_NodeShape
732
+ a sh:NodeShape ;
733
+ sh:name "This ensures that the target of the property is of type Resource, i.e. exists in the graph." ;
734
+ sh:property [
735
+ a sh:PropertyShape ;
736
+ sh:path api-shapes:linkValueHasTargetID ;
737
+ sh:class knora-api:Resource ;
738
+ sh:severity sh:Violation ;
739
+ sh:message "Range is knora-api:Resource or a subclass."
740
+ ] .
741
+
742
+
743
+ ###########################
744
+ # AudioSegment
745
+
746
+ api-shapes:AudioSegment_ResourceShape
747
+ a sh:NodeShape ;
748
+ sh:name "Validates the AudioSegment resource" ;
749
+ sh:targetClass knora-api:AudioSegment ;
750
+ sh:property [
751
+ a sh:PropertyShape ;
752
+ sh:path knora-api:isAudioSegmentOf ;
753
+ sh:class knora-api:LinkValue ;
754
+ sh:severity sh:Violation ;
755
+ sh:message "This property requires a LinkValue"
756
+ ] ,
757
+ [
758
+ a sh:PropertyShape ;
759
+ sh:path knora-api:isAudioSegmentOf ;
760
+ sh:node api-shapes:isAudioSegmentOf_NodeShape
761
+ ] .
762
+
763
+ api-shapes:isAudioSegmentOf_NodeShape
764
+ a sh:NodeShape ;
765
+ sh:name "This ensures that the target of the property is of type AudioRepresentation and exists in the graph." ;
766
+ sh:property [
767
+ a sh:PropertyShape ;
768
+ sh:path api-shapes:linkValueHasTargetID ;
769
+ sh:class knora-api:AudioRepresentation ;
770
+ sh:severity sh:Violation ;
771
+ sh:message "http://api.knora.org/ontology/knora-api/v2#AudioRepresentation"
772
+ ] .
773
+
774
+
775
+ ###########################
776
+ # VideoSegment
777
+
778
+ api-shapes:VideoSegment_ResourceShape
779
+ a sh:NodeShape ;
780
+ sh:name "Validates the VideoSegment resource" ;
781
+ sh:targetClass knora-api:VideoSegment ;
782
+ sh:property [
783
+ a sh:PropertyShape ;
784
+ sh:path knora-api:isVideoSegmentOf ;
785
+ sh:class knora-api:LinkValue ;
786
+ sh:severity sh:Violation ;
787
+ sh:message "This property requires a LinkValue"
788
+ ] ,
789
+ [
790
+ a sh:PropertyShape ;
791
+ sh:path knora-api:isVideoSegmentOf ;
792
+ sh:node api-shapes:isVideoSegmentOf_NodeShape
793
+ ] .
794
+
795
+ api-shapes:isVideoSegmentOf_NodeShape
796
+ a sh:NodeShape ;
797
+ sh:name "This ensures that the target of the property is of type MovingImageRepresentation and exists in the graph." ;
798
+ sh:property [
799
+ a sh:PropertyShape ;
800
+ sh:path api-shapes:linkValueHasTargetID ;
801
+ sh:class knora-api:MovingImageRepresentation ;
802
+ sh:severity sh:Violation ;
803
+ sh:message "http://api.knora.org/ontology/knora-api/v2#MovingImageRepresentation"
804
+ ] .