tripper 0.5.2__tar.gz → 0.5.4__tar.gz

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 (197) hide show
  1. {tripper-0.5.2 → tripper-0.5.4}/PKG-INFO +23 -23
  2. {tripper-0.5.2 → tripper-0.5.4}/pyproject.toml +22 -23
  3. {tripper-0.5.2 → tripper-0.5.4}/tripper/__init__.py +1 -1
  4. {tripper-0.5.2 → tripper-0.5.4}/tripper/backends/rdflib.py +6 -4
  5. {tripper-0.5.2 → tripper-0.5.4}/tripper/convert/convert.py +1 -1
  6. {tripper-0.5.2 → tripper-0.5.4}/tripper/datadoc/clitool.py +14 -3
  7. {tripper-0.5.2 → tripper-0.5.4}/tripper/datadoc/context.py +79 -16
  8. {tripper-0.5.2 → tripper-0.5.4}/tripper/datadoc/dataaccess.py +6 -4
  9. {tripper-0.5.2 → tripper-0.5.4}/tripper/datadoc/dataset.py +160 -29
  10. {tripper-0.5.2 → tripper-0.5.4}/tripper/datadoc/keywords.py +21 -8
  11. {tripper-0.5.2 → tripper-0.5.4}/tripper/datadoc/tabledoc.py +65 -9
  12. {tripper-0.5.2 → tripper-0.5.4}/tripper/datadoc/utils.py +3 -1
  13. {tripper-0.5.2 → tripper-0.5.4}/tripper/triplestore.py +2 -4
  14. {tripper-0.5.2 → tripper-0.5.4}/tripper/units/units.py +2 -4
  15. {tripper-0.5.2 → tripper-0.5.4}/tripper/utils.py +67 -6
  16. tripper-0.5.2/.github/dependabot.yml +0 -11
  17. tripper-0.5.2/.github/pull_request_template.md +0 -19
  18. tripper-0.5.2/.github/workflows/cd_release.yml +0 -58
  19. tripper-0.5.2/.github/workflows/ci_automerge_dependency_prs.yml +0 -13
  20. tripper-0.5.2/.github/workflows/ci_cd_updated_main.yml +0 -32
  21. tripper-0.5.2/.github/workflows/ci_check_dependencies.yml +0 -22
  22. tripper-0.5.2/.github/workflows/ci_tests.yml +0 -139
  23. tripper-0.5.2/.github/workflows/ci_update_dependencies.yml +0 -25
  24. tripper-0.5.2/.gitignore +0 -26
  25. tripper-0.5.2/.hooks/generate-context-and-doc.sh +0 -23
  26. tripper-0.5.2/.hooks/markdown-doctest.sh +0 -8
  27. tripper-0.5.2/.pre-commit-config.yaml +0 -116
  28. tripper-0.5.2/CHANGELOG.md +0 -649
  29. tripper-0.5.2/MANIFEST.in +0 -1
  30. tripper-0.5.2/docs/CHANGELOG.md +0 -1
  31. tripper-0.5.2/docs/LICENSE.md +0 -1
  32. tripper-0.5.2/docs/api_reference/.pages +0 -1
  33. tripper-0.5.2/docs/api_reference/backends/.pages +0 -1
  34. tripper-0.5.2/docs/api_reference/backends/collection.md +0 -3
  35. tripper-0.5.2/docs/api_reference/backends/ontopy.md +0 -3
  36. tripper-0.5.2/docs/api_reference/backends/rdflib.md +0 -3
  37. tripper-0.5.2/docs/api_reference/backends/sparqlwrapper.md +0 -3
  38. tripper-0.5.2/docs/api_reference/convert/.pages +0 -1
  39. tripper-0.5.2/docs/api_reference/convert/convert.md +0 -3
  40. tripper-0.5.2/docs/api_reference/datadoc/.pages +0 -1
  41. tripper-0.5.2/docs/api_reference/datadoc/clitool.md +0 -3
  42. tripper-0.5.2/docs/api_reference/datadoc/context.md +0 -3
  43. tripper-0.5.2/docs/api_reference/datadoc/dataaccess.md +0 -3
  44. tripper-0.5.2/docs/api_reference/datadoc/dataset.md +0 -3
  45. tripper-0.5.2/docs/api_reference/datadoc/errors.md +0 -3
  46. tripper-0.5.2/docs/api_reference/datadoc/keywords.md +0 -3
  47. tripper-0.5.2/docs/api_reference/datadoc/prefixes.md +0 -3
  48. tripper-0.5.2/docs/api_reference/datadoc/tabledoc.md +0 -3
  49. tripper-0.5.2/docs/api_reference/datadoc/utils.md +0 -3
  50. tripper-0.5.2/docs/api_reference/errors.md +0 -3
  51. tripper-0.5.2/docs/api_reference/interface.md +0 -3
  52. tripper-0.5.2/docs/api_reference/literal.md +0 -3
  53. tripper-0.5.2/docs/api_reference/mappings/.pages +0 -1
  54. tripper-0.5.2/docs/api_reference/mappings/mappings.md +0 -3
  55. tripper-0.5.2/docs/api_reference/namespace.md +0 -3
  56. tripper-0.5.2/docs/api_reference/session.md +0 -3
  57. tripper-0.5.2/docs/api_reference/triplestore.md +0 -3
  58. tripper-0.5.2/docs/api_reference/triplestore_extend.md +0 -3
  59. tripper-0.5.2/docs/api_reference/units/.pages +0 -1
  60. tripper-0.5.2/docs/api_reference/units/units.md +0 -3
  61. tripper-0.5.2/docs/api_reference/utils.md +0 -3
  62. tripper-0.5.2/docs/backend_discovery.md +0 -74
  63. tripper-0.5.2/docs/css/reference.css +0 -9
  64. tripper-0.5.2/docs/datadoc/classdoc.md +0 -60
  65. tripper-0.5.2/docs/datadoc/customisation.md +0 -362
  66. tripper-0.5.2/docs/datadoc/documenting-a-resource.md +0 -304
  67. tripper-0.5.2/docs/datadoc/fetching-resources-from-a-triplestore.md +0 -122
  68. tripper-0.5.2/docs/datadoc/introduction.md +0 -54
  69. tripper-0.5.2/docs/datadoc/keywords-process.md +0 -573
  70. tripper-0.5.2/docs/datadoc/keywords.md +0 -585
  71. tripper-0.5.2/docs/datadoc/prefixes-process.md +0 -37
  72. tripper-0.5.2/docs/datadoc/prefixes.md +0 -37
  73. tripper-0.5.2/docs/developers.md +0 -103
  74. tripper-0.5.2/docs/figs/.gitignore +0 -1
  75. tripper-0.5.2/docs/figs/basic_relations.png +0 -0
  76. tripper-0.5.2/docs/figs/dataset-Consumer.png +0 -0
  77. tripper-0.5.2/docs/figs/dataset-Consumer1.png +0 -0
  78. tripper-0.5.2/docs/figs/dataset-Consumer2.png +0 -0
  79. tripper-0.5.2/docs/figs/dataset-Dataset.png +0 -0
  80. tripper-0.5.2/docs/figs/dataset-Provider.png +0 -0
  81. tripper-0.5.2/docs/figs/dataset.drawio +0 -3913
  82. tripper-0.5.2/docs/figs/dataset.png +0 -0
  83. tripper-0.5.2/docs/figs/semdata.png +0 -0
  84. tripper-0.5.2/docs/figs/tripper_logo.png +0 -0
  85. tripper-0.5.2/docs/figs/tripper_logo.svg +0 -210
  86. tripper-0.5.2/docs/figs/tripper_logo_w_name.png +0 -0
  87. tripper-0.5.2/docs/figs/tripper_logo_w_name.svg +0 -252
  88. tripper-0.5.2/docs/index.md +0 -156
  89. tripper-0.5.2/docs/known-issues.md +0 -10
  90. tripper-0.5.2/docs/mappings/figs/function_emmo.svg +0 -4
  91. tripper-0.5.2/docs/planned-backends.md +0 -9
  92. tripper-0.5.2/docs/session.md +0 -112
  93. tripper-0.5.2/docs/tools/datadoc.md +0 -432
  94. tripper-0.5.2/docs/tutorial.md +0 -426
  95. tripper-0.5.2/docs/units/units.md +0 -417
  96. tripper-0.5.2/examples/classdoc/mysimulation.py +0 -15
  97. tripper-0.5.2/examples/classdoc/mysimulation.yaml +0 -44
  98. tripper-0.5.2/examples/workflow-mappings/README.md +0 -43
  99. tripper-0.5.2/examples/workflow-mappings/knowledge-base.svg +0 -3
  100. tripper-0.5.2/examples/workflow-mappings/route.svg +0 -162
  101. tripper-0.5.2/examples/workflow-mappings/workflow.svg +0 -3
  102. tripper-0.5.2/examples/workflow-mappings/workflow_mappings.py +0 -54
  103. tripper-0.5.2/examples/workflow-mappings/workflow_w_pipes.svg +0 -3
  104. tripper-0.5.2/mkdocs.yml +0 -123
  105. tripper-0.5.2/tests/backends/__init__.py +0 -0
  106. tripper-0.5.2/tests/backends/datadocumentation_sample.yaml +0 -14
  107. tripper-0.5.2/tests/backends/datadocumentation_sample2.yaml +0 -14
  108. tripper-0.5.2/tests/backends/dummy.py +0 -20
  109. tripper-0.5.2/tests/backends/test_backends_sparql.py +0 -188
  110. tripper-0.5.2/tests/backends/test_collection.py +0 -55
  111. tripper-0.5.2/tests/backends/test_rdflib.py +0 -40
  112. tripper-0.5.2/tests/backends/test_sparqlwrapper.py +0 -45
  113. tripper-0.5.2/tests/conftest.py +0 -127
  114. tripper-0.5.2/tests/convert/test_convert.py +0 -110
  115. tripper-0.5.2/tests/datadoc/dataset_paths.py +0 -13
  116. tripper-0.5.2/tests/datadoc/test_context.py +0 -396
  117. tripper-0.5.2/tests/datadoc/test_dataaccess.py +0 -178
  118. tripper-0.5.2/tests/datadoc/test_datadoc_cli.py +0 -222
  119. tripper-0.5.2/tests/datadoc/test_datadoc_utils.py +0 -162
  120. tripper-0.5.2/tests/datadoc/test_dataset.py +0 -1154
  121. tripper-0.5.2/tests/datadoc/test_keywords.py +0 -807
  122. tripper-0.5.2/tests/datadoc/test_prefixes.py +0 -83
  123. tripper-0.5.2/tests/datadoc/test_tabledoc.py +0 -370
  124. tripper-0.5.2/tests/input/77600-23-001_5kV_400x_m001.tif +0 -0
  125. tripper-0.5.2/tests/input/batchdata.csv +0 -6
  126. tripper-0.5.2/tests/input/custom_context.yaml +0 -42
  127. tripper-0.5.2/tests/input/custom_keywords.yaml +0 -44
  128. tripper-0.5.2/tests/input/invalid_keywords0.yaml +0 -17
  129. tripper-0.5.2/tests/input/invalid_keywords1.yaml +0 -18
  130. tripper-0.5.2/tests/input/invalid_keywords2.yaml +0 -18
  131. tripper-0.5.2/tests/input/invalid_keywords3.yaml +0 -16
  132. tripper-0.5.2/tests/input/invalid_keywords4.yaml +0 -16
  133. tripper-0.5.2/tests/input/invalid_keywords5.yaml +0 -18
  134. tripper-0.5.2/tests/input/invalid_keywords6.yaml +0 -17
  135. tripper-0.5.2/tests/input/invalid_keywords7.yaml +0 -18
  136. tripper-0.5.2/tests/input/invalid_keywords8.yaml +0 -17
  137. tripper-0.5.2/tests/input/invalid_keywords9.yaml +0 -17
  138. tripper-0.5.2/tests/input/keywords.csv +0 -4
  139. tripper-0.5.2/tests/input/mappings.ttl +0 -5
  140. tripper-0.5.2/tests/input/new_keywords.csv +0 -4
  141. tripper-0.5.2/tests/input/openfile.txt +0 -1
  142. tripper-0.5.2/tests/input/semdata-context-ext.json +0 -20
  143. tripper-0.5.2/tests/input/semdata-context.json +0 -17
  144. tripper-0.5.2/tests/input/semdata.csv +0 -5
  145. tripper-0.5.2/tests/input/semdata.yaml +0 -98
  146. tripper-0.5.2/tests/input/session.yaml +0 -22
  147. tripper-0.5.2/tests/input/tem.csv +0 -4
  148. tripper-0.5.2/tests/input/tem.xlsx +0 -0
  149. tripper-0.5.2/tests/input/valid_keywords.yaml +0 -17
  150. tripper-0.5.2/tests/mappings/test_cost.py +0 -33
  151. tripper-0.5.2/tests/mappings/test_function.py +0 -47
  152. tripper-0.5.2/tests/mappings/test_mappings.py +0 -54
  153. tripper-0.5.2/tests/ontologies/family.ttl +0 -201
  154. tripper-0.5.2/tests/ontologies/food-more.ttl +0 -14
  155. tripper-0.5.2/tests/ontologies/food.ttl +0 -118
  156. tripper-0.5.2/tests/output/.gitignore +0 -13
  157. tripper-0.5.2/tests/paths.py +0 -12
  158. tripper-0.5.2/tests/test_add_function.py +0 -125
  159. tripper-0.5.2/tests/test_custom_backend.py +0 -16
  160. tripper-0.5.2/tests/test_eval_function.py +0 -56
  161. tripper-0.5.2/tests/test_get_data.py +0 -78
  162. tripper-0.5.2/tests/test_literals.py +0 -477
  163. tripper-0.5.2/tests/test_markdown_doctest.py +0 -49
  164. tripper-0.5.2/tests/test_namespace.py +0 -154
  165. tripper-0.5.2/tests/test_session.py +0 -45
  166. tripper-0.5.2/tests/test_sparql.py +0 -243
  167. tripper-0.5.2/tests/test_triplestore.py +0 -625
  168. tripper-0.5.2/tests/test_utils.py +0 -598
  169. tripper-0.5.2/tests/units/test_units.py +0 -425
  170. {tripper-0.5.2 → tripper-0.5.4}/LICENSE +0 -0
  171. {tripper-0.5.2 → tripper-0.5.4}/README.md +0 -0
  172. {tripper-0.5.2 → tripper-0.5.4}/tripper/backends/__init__.py +0 -0
  173. {tripper-0.5.2 → tripper-0.5.4}/tripper/backends/collection.py +0 -0
  174. {tripper-0.5.2 → tripper-0.5.4}/tripper/backends/ontopy.py +0 -0
  175. {tripper-0.5.2 → tripper-0.5.4}/tripper/backends/sparqlwrapper.py +0 -0
  176. {tripper-0.5.2 → tripper-0.5.4}/tripper/context/0.2/context.json +0 -0
  177. {tripper-0.5.2 → tripper-0.5.4}/tripper/context/0.3/context.json +0 -0
  178. {tripper-0.5.2 → tripper-0.5.4}/tripper/context/0.3/keywords.yaml +0 -0
  179. {tripper-0.5.2 → tripper-0.5.4}/tripper/context/0.3/prefixes.yaml +0 -0
  180. {tripper-0.5.2 → tripper-0.5.4}/tripper/context/datadoc.ttl +0 -0
  181. {tripper-0.5.2 → tripper-0.5.4}/tripper/context/owl-restrictions.json +0 -0
  182. {tripper-0.5.2 → tripper-0.5.4}/tripper/context/process/0.1/context.json +0 -0
  183. {tripper-0.5.2 → tripper-0.5.4}/tripper/context/process/0.1/keywords.yaml +0 -0
  184. {tripper-0.5.2 → tripper-0.5.4}/tripper/convert/__init__.py +0 -0
  185. {tripper-0.5.2 → tripper-0.5.4}/tripper/datadoc/__init__.py +0 -0
  186. {tripper-0.5.2 → tripper-0.5.4}/tripper/datadoc/errors.py +0 -0
  187. {tripper-0.5.2 → tripper-0.5.4}/tripper/datadoc/prefixes.py +0 -0
  188. {tripper-0.5.2 → tripper-0.5.4}/tripper/errors.py +0 -0
  189. {tripper-0.5.2 → tripper-0.5.4}/tripper/interface.py +0 -0
  190. {tripper-0.5.2 → tripper-0.5.4}/tripper/literal.py +0 -0
  191. {tripper-0.5.2 → tripper-0.5.4}/tripper/mappings/__init__.py +0 -0
  192. {tripper-0.5.2 → tripper-0.5.4}/tripper/mappings/mappings.py +0 -0
  193. {tripper-0.5.2 → tripper-0.5.4}/tripper/namespace.py +0 -0
  194. {tripper-0.5.2 → tripper-0.5.4}/tripper/session.py +0 -0
  195. {tripper-0.5.2 → tripper-0.5.4}/tripper/triplestore_extend.py +0 -0
  196. {tripper-0.5.2 → tripper-0.5.4}/tripper/units/.gitignore +0 -0
  197. {tripper-0.5.2 → tripper-0.5.4}/tripper/units/__init__.py +0 -0
@@ -1,16 +1,14 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: tripper
3
- Version: 0.5.2
3
+ Version: 0.5.4
4
4
  Summary: A triplestore wrapper for Python.
5
5
  Keywords: triplestore,ontology,RDF
6
6
  Author-email: SINTEF <TEAM4.0@sintef.no>
7
- Requires-Python: >=3.8
7
+ Requires-Python: >=3.9
8
8
  Description-Content-Type: text/markdown
9
9
  Classifier: Development Status :: 5 - Production/Stable
10
10
  Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.8
13
- Classifier: Programming Language :: Python :: 3.9
14
12
  Classifier: Programming Language :: Python :: 3.10
15
13
  Classifier: Programming Language :: Python :: 3.11
16
14
  Classifier: Programming Language :: Python :: 3.12
@@ -20,38 +18,39 @@ Classifier: Environment :: Plugins
20
18
  Classifier: Natural Language :: English
21
19
  Classifier: Operating System :: OS Independent
22
20
  License-File: LICENSE
23
- Requires-Dist: typing-extensions>=4.7.0,<4.13.1; python_version < '3.9'
24
21
  Requires-Dist: dlite-python>=0.5.27 ; extra == "backends"
25
- Requires-Dist: emmontopy>=0.5.0,<=0.8.1 ; extra == "backends"
26
- Requires-Dist: graphviz>=0.20.1,<0.20.2 ; extra == "backends"
22
+ Requires-Dist: emmontopy>=0.5.0,<=0.11.3 ; extra == "backends"
23
+ Requires-Dist: graphviz>=0.20.1,<0.20.4 ; extra == "backends"
27
24
  Requires-Dist: numpy<2.1.0 ; extra == "backends" and ( python_version=='3.13')
28
- Requires-Dist: rdflib>=6.3.0,<7.0.0 ; extra == "backends"
25
+ Requires-Dist: rdflib>=6.3.0,<=7.6.0 ; extra == "backends"
29
26
  Requires-Dist: tripper[mappings] ; extra == "datadoc"
30
27
  Requires-Dist: keyring>=22.0.0,<25.6.1 ; extra == "datadoc"
31
- Requires-Dist: PyLD>=2.0.0,<2.0.5 ; extra == "datadoc"
32
- Requires-Dist: PyYaml>=3.0.0,<6.0.3 ; extra == "datadoc"
28
+ Requires-Dist: PyLD>=2.0.0,<3.0.0 ; extra == "datadoc" and ( python_version<'3.10')
29
+ Requires-Dist: PyLD>=2.0.0,<3.0.1 ; extra == "datadoc" and ( python_version>='3.10')
30
+ Requires-Dist: PyYaml>=3.0.0,<6.0.4 ; extra == "datadoc"
33
31
  Requires-Dist: requests>=2.0.0,<3.4.1 ; extra == "datadoc"
34
32
  Requires-Dist: sparqlwrapper>=2.0.0,<2.0.1 ; extra == "datadoc"
33
+ Requires-Dist: openpyxl ~= 3.0 ; extra == "datadoc"
35
34
  Requires-Dist: tripper[pre-commit, docs] ; extra == "dev"
36
35
  Requires-Dist: virtualenvwrapper>=4.0.0 ; extra == "dev"
37
36
  Requires-Dist: tripper[testing] ; extra == "docs"
38
- Requires-Dist: mike==2.1.3 ; extra == "docs"
37
+ Requires-Dist: mike==2.2.0 ; extra == "docs"
39
38
  Requires-Dist: mkdocs==1.6.1 ; extra == "docs"
40
- Requires-Dist: mkdocs-autorefs==1.4.1 ; extra == "docs"
39
+ Requires-Dist: mkdocs-autorefs==1.4.4 ; extra == "docs"
41
40
  Requires-Dist: mkdocs-awesome-pages-plugin==2.10.1 ; extra == "docs"
42
- Requires-Dist: mkdocs-github-admonitions-plugin==0.0.3 ; extra == "docs"
43
- Requires-Dist: mkdocs-material==9.6.11 ; extra == "docs"
44
- Requires-Dist: mkdocstrings==0.27.0 ; extra == "docs"
45
- Requires-Dist: mkdocstrings-python-legacy==0.2.4 ; extra == "docs"
41
+ Requires-Dist: mkdocs-get-deps==0.2.0 ; extra == "docs"
42
+ Requires-Dist: mkdocs-github-admonitions-plugin==0.1.1 ; extra == "docs"
43
+ Requires-Dist: mkdocs-material==9.7.7 ; extra == "docs"
44
+ Requires-Dist: mkdocs-material-extensions==1.3.1 ; extra == "docs"
45
+ Requires-Dist: mkdocstrings==1.0.6 ; extra == "docs"
46
+ Requires-Dist: mkdocstrings-python-legacy==0.2.7 ; extra == "docs"
46
47
  Requires-Dist: tripper[units] ; extra == "mappings"
47
48
  Requires-Dist: pre-commit==4.0.1 ; extra == "pre-commit"
48
- Requires-Dist: pylint==3.3.4 ; extra == "pre-commit" and ( python_version>='3.9')
49
+ Requires-Dist: pylint==3.3.4 ; extra == "pre-commit"
49
50
  Requires-Dist: tripper[datadoc, backends, testing-core] ; extra == "testing"
50
- Requires-Dist: pytest==8.3.4 ; extra == "testing-core"
51
- Requires-Dist: pytest-cov==5.0.0 ; extra == "testing-core" and ( python_version<'3.9')
52
- Requires-Dist: pytest-cov==6.0.0 ; extra == "testing-core" and ( python_version>='3.9')
53
- Requires-Dist: pint>=0.21.1,<0.26 ; extra == "units" and ( python_version<'3.9')
54
- Requires-Dist: pint>=0.24.1,<0.26 ; extra == "units" and ( python_version>='3.9')
51
+ Requires-Dist: pytest==9.1.1 ; extra == "testing-core"
52
+ Requires-Dist: pytest-cov==6.0.0 ; extra == "testing-core"
53
+ Requires-Dist: pint>=0.24.1,<0.26 ; extra == "units"
55
54
  Requires-Dist: rdflib>=6.3.0,<=7.6.0 ; extra == "units"
56
55
  Project-URL: Changelog, https://github.com/EMMC-ASBL/tripper/blob/master/CHANGELOG.md
57
56
  Project-URL: Documentation, https://EMMC-ASBL.github.io/tripper
@@ -68,6 +67,7 @@ Provides-Extra: pre-commit
68
67
  Provides-Extra: testing
69
68
  Provides-Extra: testing-core
70
69
  Provides-Extra: units
70
+ Import-Name: tripper
71
71
 
72
72
  <img src="docs/figs/tripper_logo.svg" alt="Tripper logo" align="right" width="96" height="96">
73
73
 
@@ -14,8 +14,6 @@ classifiers = [
14
14
  "Development Status :: 5 - Production/Stable",
15
15
  "License :: OSI Approved :: MIT License",
16
16
  "Programming Language :: Python :: 3",
17
- "Programming Language :: Python :: 3.8",
18
- "Programming Language :: Python :: 3.9",
19
17
  "Programming Language :: Python :: 3.10",
20
18
  "Programming Language :: Python :: 3.11",
21
19
  "Programming Language :: Python :: 3.12",
@@ -26,17 +24,15 @@ classifiers = [
26
24
  "Operating System :: OS Independent",
27
25
  ]
28
26
  keywords = ["triplestore", "ontology", "RDF"]
29
- requires-python = ">=3.8"
27
+ requires-python = ">=3.9"
30
28
  dynamic = ["version"]
31
29
 
32
30
  dependencies = [
33
- "typing-extensions>=4.7.0,<4.13.1; python_version < '3.9'",
34
31
  ]
35
32
 
36
33
  [project.optional-dependencies]
37
34
  units = [
38
- "pint>=0.21.1,<0.26; python_version<'3.9'",
39
- "pint>=0.24.1,<0.26; python_version>='3.9'",
35
+ "pint>=0.24.1,<0.26",
40
36
  "rdflib>=6.3.0,<=7.6.0",
41
37
  ]
42
38
  mappings = [
@@ -45,40 +41,43 @@ mappings = [
45
41
  datadoc = [
46
42
  "tripper[mappings]",
47
43
  "keyring>=22.0.0,<25.6.1",
48
- "PyLD>=2.0.0,<2.0.5",
49
- "PyYaml>=3.0.0,<6.0.3", # todo: check lower version
50
- "requests>=2.0.0,<3.4.1", # todo: check lower version
44
+ "PyLD>=2.0.0,<3.0.0; python_version<'3.10'",
45
+ "PyLD>=2.0.0,<3.0.1; python_version>='3.10'",
46
+ "PyYaml>=3.0.0,<6.0.4",
47
+ "requests>=2.0.0,<3.4.1",
51
48
  "sparqlwrapper>=2.0.0,<2.0.1",
49
+ "openpyxl ~= 3.0"
52
50
  ]
53
51
  backends = [
54
52
  "dlite-python>=0.5.27",
55
- "emmontopy>=0.5.0,<=0.8.1",
56
- "graphviz>=0.20.1,<0.20.2",
57
- "numpy<2.1.0; python_version=='3.13'", # todo: relax versions
58
- "rdflib>=6.3.0,<7.0.0",
53
+ "emmontopy>=0.5.0,<=0.11.3",
54
+ "graphviz>=0.20.1,<0.20.4",
55
+ "numpy<2.1.0; python_version=='3.13'",
56
+ "rdflib>=6.3.0,<=7.6.0",
59
57
  ]
60
58
  testing-core = [
61
- "pytest==8.3.4",
62
- "pytest-cov==5.0.0; python_version<'3.9'",
63
- "pytest-cov==6.0.0; python_version>='3.9'",
59
+ "pytest==9.1.1",
60
+ "pytest-cov==6.0.0",
64
61
  ]
65
62
  testing = [
66
63
  "tripper[datadoc,backends,testing-core]",
67
64
  ]
68
65
  docs = [
69
66
  "tripper[testing]",
70
- "mike==2.1.3",
67
+ "mike==2.2.0",
71
68
  "mkdocs==1.6.1",
72
- "mkdocs-autorefs==1.4.1",
69
+ "mkdocs-autorefs==1.4.4",
73
70
  "mkdocs-awesome-pages-plugin==2.10.1",
74
- "mkdocs-github-admonitions-plugin==0.0.3",
75
- "mkdocs-material==9.6.11",
76
- "mkdocstrings==0.27.0",
77
- "mkdocstrings-python-legacy==0.2.4",
71
+ "mkdocs-get-deps==0.2.0",
72
+ "mkdocs-github-admonitions-plugin==0.1.1",
73
+ "mkdocs-material==9.7.7",
74
+ "mkdocs-material-extensions==1.3.1",
75
+ "mkdocstrings==1.0.6",
76
+ "mkdocstrings-python-legacy==0.2.7",
78
77
  ]
79
78
  pre-commit = [
80
79
  "pre-commit==4.0.1",
81
- "pylint==3.3.4; python_version>='3.9'",
80
+ "pylint==3.3.4",
82
81
  ]
83
82
  dev = [
84
83
  "tripper[pre-commit,docs]",
@@ -43,7 +43,7 @@ from .session import Session
43
43
  from .triplestore import Triplestore, backend_packages
44
44
  from .triplestore_extend import Tripper
45
45
 
46
- __version__ = "0.5.2"
46
+ __version__ = "0.5.4"
47
47
 
48
48
  # Pre-defined namespaces
49
49
  EMMO = Namespace(
@@ -55,13 +55,15 @@ def totriple(triple: "Triple"):
55
55
 
56
56
 
57
57
  def fromrdflib(
58
- value: "Union[URIRef, rdflibLiteral, BNode]",
59
- ) -> "Union[str, Literal]":
58
+ value: "Union[URIRef, rdflibLiteral, BNode, None]",
59
+ ) -> "Union[str, Literal, None]":
60
60
  """Help function converting an rdflib value to corresponding tripper value."""
61
61
  if isinstance(value, rdflibLiteral):
62
62
  return parse_literal(value)
63
63
  if isinstance(value, BNode) and not value.startswith("_:"):
64
64
  return f"_:{value}"
65
+ if value is None:
66
+ return value
65
67
  return str(value)
66
68
 
67
69
 
@@ -184,7 +186,7 @@ class RdflibStrategy:
184
186
 
185
187
  def query(
186
188
  self, query_object, **kwargs
187
- ) -> "Union[List[Tuple[str, ...]], bool, Generator[Triple, None, None]]":
189
+ ) -> "Union[List[tuple], bool, Generator[Triple, None, None]]":
188
190
  """SPARQL query.
189
191
 
190
192
  Parameters:
@@ -271,4 +273,4 @@ def _convert_triples_to_tripper(triples) -> "Generator[Triple, None, None]":
271
273
  """Help function that converts a iterator/generator of rdflib triples
272
274
  to tripper triples."""
273
275
  for s, p, o in triples: # pylint: disable=not-an-iterable
274
- yield (fromrdflib(s), str(p), fromrdflib(o))
276
+ yield (fromrdflib(s), str(p), fromrdflib(o)) # type: ignore
@@ -279,7 +279,7 @@ def load_container(
279
279
  return value.value if isinstance(value, Literal) else value
280
280
 
281
281
  if OTEIO.Dictionary in parents:
282
- container = {}
282
+ container: "Dict[str, Any]" = {}
283
283
  for pred, obj in ts.predicate_objects(iri):
284
284
  if pred == OTEIO.hasKeyValuePair:
285
285
  key_iri = ts.value(obj, OTEIO.hasDictionaryKey)
@@ -10,6 +10,7 @@ from pathlib import Path
10
10
 
11
11
  from tripper import Session, Triplestore
12
12
  from tripper.datadoc import (
13
+ Context,
13
14
  TableDoc,
14
15
  acquire,
15
16
  delete,
@@ -29,6 +30,9 @@ def subcommand_add(ts, args):
29
30
  if fmt in ("yml", "yaml"):
30
31
  save_datadoc(ts, infile)
31
32
  elif fmt in ("csv",):
33
+ context = Context(theme=args.theme)
34
+ for ctx in args.context:
35
+ context.add_context(ctx)
32
36
  kw = {}
33
37
  if args.csv_option:
34
38
  for token in args.csv_option:
@@ -38,7 +42,7 @@ def subcommand_add(ts, args):
38
42
  infile,
39
43
  type=args.type,
40
44
  keywords=args.keywords if args.keywords else None,
41
- context=args.context,
45
+ context=context,
42
46
  redefine=args.redefine,
43
47
  baseiri=args.base_iri,
44
48
  **kw,
@@ -182,7 +186,15 @@ def maincommand(argv=None):
182
186
  )
183
187
  parser_add.add_argument(
184
188
  "--context",
185
- help="Path or URL to custom JSON-LD context for the input.",
189
+ action="append",
190
+ help=(
191
+ "Path or URL to custom JSON-LD context for the input. "
192
+ "This option may be provided multiple times."
193
+ ),
194
+ )
195
+ parser_add.add_argument(
196
+ "--theme",
197
+ help="Initialise context from a theme (e.g. ddoc:datadoc).",
186
198
  )
187
199
  parser_add.add_argument(
188
200
  "--dump",
@@ -211,7 +223,6 @@ def maincommand(argv=None):
211
223
  choices=["raise", "allow", "skip"],
212
224
  help="How to handle redifinition of existing keywords.",
213
225
  )
214
-
215
226
  parser_add.add_argument(
216
227
  "--base-iri",
217
228
  help=(
@@ -11,11 +11,17 @@ from typing import TYPE_CHECKING, Sequence
11
11
 
12
12
  from pyld import jsonld
13
13
 
14
- from tripper import OWL, RDF, RDFS, Triplestore
14
+ from tripper import OWL, RDF, RDFS, Namespace, Triplestore
15
15
  from tripper.datadoc.errors import InvalidContextError, PrefixMismatchError
16
16
  from tripper.datadoc.utils import asseq
17
17
  from tripper.errors import NamespaceError, NamespaceWarning
18
- from tripper.utils import MATCH_IRI, MATCH_PREFIXED_IRI, openfile, prefix_iri
18
+ from tripper.utils import (
19
+ MATCH_IRI,
20
+ MATCH_PREFIXED_IRI,
21
+ expand_iri,
22
+ openfile,
23
+ prefix_iri,
24
+ )
19
25
 
20
26
  if TYPE_CHECKING: # pragma: no cover
21
27
  from typing import IO, Optional, Union
@@ -23,7 +29,9 @@ if TYPE_CHECKING: # pragma: no cover
23
29
  from tripper.datadoc.keywords import Keywords
24
30
 
25
31
  # Possible types for a JSON-LD context
26
- ContextType = Union[str, dict, Sequence[Union[str, dict]], "Context"]
32
+ ContextType = Union[
33
+ str, dict, Path, Sequence[Union[str, dict, Path]], "Context"
34
+ ]
27
35
 
28
36
 
29
37
  def get_context(
@@ -36,7 +44,7 @@ def get_context(
36
44
  copy: bool = False,
37
45
  timeout: float = 3,
38
46
  ) -> "Context":
39
- """A convinient function that returns an Context instance.
47
+ """A convenience function that returns a Context instance.
40
48
 
41
49
  Arguments:
42
50
  context: Input context. Several types are supported:
@@ -46,9 +54,12 @@ def get_context(
46
54
  - str: If a valid URI, the context is loaded from this URI,
47
55
  otherwise it is assumed to be a file path to load.
48
56
  - sequence: A sequence of the above.
49
- theme: Load initial context for this theme.
50
- default_theme: Initialise context for this theme if neither
51
- `context` nor `theme` are provided.
57
+ theme: IRI (or list of IRIs) of theme(s) to load initial context
58
+ for. Built-in themes:
59
+ - ``"ddoc:datadoc"`` (default) — basic data documentation.
60
+ - ``"ddoc:process"`` — basic documentation of processes.
61
+ default_theme: Theme used when neither `context`, `theme`, nor
62
+ `keywords` are provided. Defaults to ``"ddoc:datadoc"``.
52
63
  keywords: Initialise from this keywords instance.
53
64
  prefixes: Optional dict with additional prefixes.
54
65
  processingMode: Either "json-ld-1.0" or "json-ld-1.1".
@@ -76,7 +87,7 @@ def get_context(
76
87
  timeout=timeout,
77
88
  )
78
89
  if prefixes:
79
- context.add_context({k: str(v) for k, v in prefixes.items()})
90
+ context.add_prefixes(prefixes)
80
91
  return context
81
92
 
82
93
 
@@ -101,7 +112,12 @@ class Context:
101
112
  - str: If a valid URI, the context is loaded from this URI,
102
113
  otherwise it is assumed to be a file path to load.
103
114
  - sequence: A sequence of the above.
104
- theme: Load initial context for this theme.
115
+ theme: IRI (or list of IRIs) of theme(s) to load initial
116
+ context for. Built-in themes:
117
+ - ``"ddoc:datadoc"`` (default) — basic data documentation.
118
+ - ``"ddoc:process"`` — basic documentation of processes.
119
+ Additional themes can be registered by third-party packages
120
+ via the ``tripper.keywords`` entry-point group.
105
121
  keywords: Initialise from this keywords instance.
106
122
  processingMode: Either "json-ld-1.0" or "json-ld-1.1".
107
123
  timeout: Timeout when accessing remote files.
@@ -118,6 +134,7 @@ class Context:
118
134
  self._expanded: dict = {}
119
135
  self._prefixed: dict = {}
120
136
  self._shortnamed: dict = {}
137
+ self._namespace_prefixes: dict = {}
121
138
 
122
139
  if keywords is not None:
123
140
  if theme:
@@ -157,13 +174,28 @@ class Context:
157
174
  """Return a copy of this context."""
158
175
  copy = Context(theme=None)
159
176
  copy.ctx = self.ctx # frozendict - no need to copy
177
+ # pylint: disable=protected-access
178
+ copy._namespace_prefixes = self._namespace_prefixes.copy()
160
179
  return copy
161
180
 
181
+ def add_prefixes(self, prefixes: dict) -> None:
182
+ """Add prefixes, retaining Namespace objects for label lookup."""
183
+ self._namespace_prefixes.update(
184
+ {
185
+ prefix: namespace
186
+ for prefix, namespace in prefixes.items()
187
+ if isinstance(namespace, Namespace)
188
+ }
189
+ )
190
+ self.add_context(
191
+ {prefix: str(namespace) for prefix, namespace in prefixes.items()}
192
+ )
193
+
162
194
  def add_context(self, context: "ContextType") -> None:
163
195
  """Add a context to this object."""
164
196
  if isinstance(context, Context):
165
197
  context = context.get_context_dict()
166
- elif isinstance(context, str):
198
+ elif isinstance(context, (Path, str)):
167
199
  with openfile(context, "rt", timeout=self.timeout) as f:
168
200
  context = json.load(f)
169
201
  elif isinstance(context, Sequence):
@@ -174,8 +206,8 @@ class Context:
174
206
  pass
175
207
  else:
176
208
  raise TypeError(
177
- "`context` should be a dict, str, Context or a sequence of "
178
- f"these. Got: {type(context)}"
209
+ "`context` should be a dict, str, Path, Context or a sequence "
210
+ f"of these. Got: {type(context)}"
179
211
  )
180
212
 
181
213
  if "@id" in context:
@@ -351,6 +383,13 @@ class Context:
351
383
  'http://www.w3.org/ns/dcat#Dataset'
352
384
 
353
385
  """
386
+ expanded = expand_iri(
387
+ name,
388
+ {**self.get_prefixes(), **self._namespace_prefixes},
389
+ strict=strict,
390
+ )
391
+ if expanded != name:
392
+ return expanded
354
393
  # Check cache
355
394
  if self._expanded and name in self._expanded:
356
395
  return self._expanded[name]
@@ -385,6 +424,7 @@ class Context:
385
424
  'dcat:Dataset'
386
425
 
387
426
  """
427
+ name = self.expand(name, strict=False)
388
428
  if not self._prefixed:
389
429
  self._create_caches()
390
430
  if name in self._prefixed:
@@ -446,10 +486,16 @@ class Context:
446
486
  except NamespaceError:
447
487
  return default
448
488
 
449
- def getdef(self, name: str) -> dict:
450
- """Return JSON-LD definition of `name`."""
451
- shortname = self.shortname(name)
452
- return self.ctx["mappings"][shortname]
489
+ def getdef(self, name: str, strict: bool = True) -> dict:
490
+ """Return JSON-LD definition of `name`.
491
+
492
+ If strict is true, a `NamespaceError` will be raised if `name` is not
493
+ defined in the context. Otherwise, an empty dict will be returned.
494
+ """
495
+ shortname = self.shortname(name, strict=strict)
496
+ if shortname in self.ctx["mappings"]:
497
+ return self.ctx["mappings"][shortname]
498
+ return {}
453
499
 
454
500
  def isref(self, name: str) -> bool:
455
501
  """Return wheter `name` is an object property that refers to a node."""
@@ -495,6 +541,7 @@ class Context:
495
541
 
496
542
  def is_class(self, name: str) -> bool:
497
543
  """Returns whether `name` appears to be a class."""
544
+ name = self.expand(name)
498
545
  return name in self and self.getdef(name).get("@type") in (
499
546
  RDFS.Class,
500
547
  OWL.Class,
@@ -624,9 +671,25 @@ class Context:
624
671
  self._shortnamed[RDF.type] = "@type"
625
672
  self._shortnamed["rdf:type"] = "@type"
626
673
  self._shortnamed["@type"] = "@type"
674
+ # Build a reverse map: IRI -> all prefixed aliases (e.g. both
675
+ # "dcterms:license" and "term:license" when two prefixes share an IRI)
676
+ aliases: "dict[str, list[str]]" = {}
677
+ for pfx, ns in prefixes.items():
678
+ for expanded in mappings.values():
679
+ if expanded.startswith(ns):
680
+ local = expanded[len(ns) :]
681
+ aliases.setdefault(expanded, []).append(f"{pfx}:{local}")
682
+
627
683
  for key, expanded in mappings.items():
628
684
  prefixed = prefix_iri(expanded, prefixes)
629
685
  self._update_caches(key, prefixed, expanded)
686
+ # Also register every alias prefixed form so that e.g.
687
+ # "dcterms:license" is found even when "term" is the canonical
688
+ # prefix for http://purl.org/dc/terms/.
689
+ for alias in aliases.get(expanded, []):
690
+ if alias not in self._shortnamed:
691
+ self._shortnamed[alias] = key
692
+ self._expanded[alias] = expanded
630
693
 
631
694
  def _update_caches(self, shortname, prefixed, expanded):
632
695
  self._expanded[shortname] = expanded
@@ -111,7 +111,6 @@ def save(
111
111
  raise TypeError(
112
112
  "if given, `dataset` should be either a string or dict"
113
113
  )
114
- dataset: dict # Tell mypy that this now is a dict
115
114
 
116
115
  if distribution is None:
117
116
  if "distribution" in dataset:
@@ -146,7 +145,6 @@ def save(
146
145
  raise TypeError(
147
146
  "if given, `distribution` should be either a string or dict"
148
147
  )
149
- distribution: dict # Tell mypy that this now is a dict
150
148
 
151
149
  if isinstance(generator, str):
152
150
  gen = get(distribution, "generator")
@@ -154,7 +152,7 @@ def save(
154
152
  gen = [gen]
155
153
  for g in gen:
156
154
  if isinstance(g, dict):
157
- if gen.get("@id") == generator:
155
+ if g.get("@id") == generator:
158
156
  break
159
157
  else:
160
158
  break # ???
@@ -186,7 +184,11 @@ def save(
186
184
  f"{scheme}://{p.netloc}{p.path}" if p.netloc else f"{scheme}:{p.path}"
187
185
  )
188
186
  options = [p.query] if p.query else []
189
- if gen and "configuration" in gen and "options" in gen.configuration:
187
+ if (
188
+ isinstance(gen, AttrDict)
189
+ and "configuration" in gen
190
+ and "options" in gen.configuration
191
+ ):
190
192
  # __TODO__: allow options to also be a dict
191
193
  options.append(gen.configuration["options"])
192
194
  id = (