data2rdf 2.2.1__tar.gz → 2.4.0.dev0__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 (80) hide show
  1. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/PKG-INFO +2 -2
  2. data2rdf-2.4.0.dev0/README.md +98 -0
  3. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/data2rdf/config.py +7 -0
  4. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/data2rdf/models/base.py +10 -8
  5. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/data2rdf/models/graph.py +112 -10
  6. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/data2rdf/models/mapping.py +45 -4
  7. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/data2rdf/parsers/base.py +51 -10
  8. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/data2rdf/parsers/excel.py +53 -13
  9. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/data2rdf/parsers/json.py +72 -29
  10. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/data2rdf/parsers/utils.py +39 -0
  11. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/data2rdf/pipelines/main.py +9 -0
  12. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/data2rdf/qudt/utils.py +42 -0
  13. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/data2rdf/utils.py +16 -0
  14. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/data2rdf/warnings.py +4 -0
  15. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/data2rdf.egg-info/PKG-INFO +2 -2
  16. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/data2rdf.egg-info/SOURCES.txt +1 -0
  17. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/setup.cfg +1 -1
  18. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/csv_empty_rows/test_parser.py +2 -2
  19. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/csv_empty_rows/test_pipeline.py +2 -2
  20. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/csv_pipeline_test/test_parser.py +140 -22
  21. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/csv_pipeline_test/test_pipeline.py +139 -22
  22. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/csv_without_header/test_parser.py +2 -2
  23. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/csv_without_header/test_pipeline.py +2 -3
  24. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/json_custom_relations/test_json_custom_relations.py +174 -0
  25. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/json_pipeline_test/test_parser.py +29 -4
  26. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/json_pipeline_test/test_pipeline.py +29 -4
  27. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/test_models.py +15 -0
  28. data2rdf-2.4.0.dev0/tests/abox/utils.py +49 -0
  29. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/xls_custom_relations/test_xlsx_custom_relations.py +117 -0
  30. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/xls_pipeline_test/test_parser.py +103 -16
  31. data2rdf-2.4.0.dev0/tests/abox/xls_pipeline_test/test_pipeline.py +430 -0
  32. data2rdf-2.2.1/README.md +0 -98
  33. data2rdf-2.2.1/tests/abox/xls_pipeline_test/test_pipeline.py +0 -206
  34. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/LICENSE +0 -0
  35. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/data2rdf/__init__.py +0 -0
  36. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/data2rdf/models/__init__.py +0 -0
  37. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/data2rdf/models/utils.py +0 -0
  38. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/data2rdf/modes/__init__.py +0 -0
  39. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/data2rdf/parsers/__init__.py +0 -0
  40. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/data2rdf/parsers/csv.py +0 -0
  41. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/data2rdf/pipelines/__init__.py +0 -0
  42. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/data2rdf/qudt/__init__.py +0 -0
  43. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/data2rdf.egg-info/dependency_links.txt +0 -0
  44. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/data2rdf.egg-info/requires.txt +0 -0
  45. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/data2rdf.egg-info/top_level.txt +0 -0
  46. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/setup.py +0 -0
  47. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/__init__.py +0 -0
  48. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/__init__.py +0 -0
  49. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/csv_empty_rows/__init__.py +0 -0
  50. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/csv_empty_rows/output/__init__.py +0 -0
  51. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/csv_pipeline_test/__init__.py +0 -0
  52. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/csv_pipeline_test/input/__init__.py +0 -0
  53. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/csv_without_header/__init__.py +0 -0
  54. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/csv_without_header/input/__init__.py +0 -0
  55. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/csv_without_header/input/data/__init__.py +0 -0
  56. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/csv_without_header/input/data/test.csv +0 -0
  57. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/csv_without_header/input/mapping/__init__.py +0 -0
  58. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/csv_without_header/output/__init__.py +0 -0
  59. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/dict_custom_properties/__init__.py +0 -0
  60. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/dict_custom_properties/test_pipeline.py +0 -0
  61. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/json_custom_relations/__init__.py +0 -0
  62. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/json_multiple_iris/__init__.py +0 -0
  63. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/json_multiple_iris/test_multiple_iris.py +0 -0
  64. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/json_pipeline_test/__init__.py +0 -0
  65. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/xls_custom_relations/__init__.py +0 -0
  66. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/abox/xls_pipeline_test/__init__.py +0 -0
  67. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/tbox/__init__.py +0 -0
  68. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/tbox/csv_pipeline_test/__init__.py +0 -0
  69. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/tbox/csv_pipeline_test/test_parser.py +0 -0
  70. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/tbox/csv_pipeline_test/test_pipeline.py +0 -0
  71. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/tbox/explicit_datatypes/__init__.py +0 -0
  72. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/tbox/explicit_datatypes/test_explicit_datatypes.py +0 -0
  73. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/tbox/json_pipeline_test/__init__.py +0 -0
  74. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/tbox/json_pipeline_test/test_parser.py +0 -0
  75. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/tbox/json_pipeline_test/test_pipeline.py +0 -0
  76. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/tbox/json_pipeline_test/test_title_exclusion.py +0 -0
  77. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/tbox/xls_pipeline_test/__init__.py +0 -0
  78. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/tbox/xls_pipeline_test/test_parser.py +0 -0
  79. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/tbox/xls_pipeline_test/test_pipeline.py +0 -0
  80. {data2rdf-2.2.1 → data2rdf-2.4.0.dev0}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: data2rdf
3
- Version: 2.2.1
3
+ Version: 2.4.0.dev0
4
4
  Summary: A generic pipeline that can be used to map raw data to RDF.
5
5
  Home-page: https://github.com/MI-FraunhoferIWM/data2rdf
6
6
  Author: Paul Zierep, Yoav Nahshon, Pablo de Andres, Deepu Krishnareddy, Matthias Büschelberger
@@ -52,7 +52,7 @@ A pipeline for generating data representation in RDF out of raw data given in AS
52
52
  https://data2rdf.readthedocs.io/en/latest/
53
53
 
54
54
  <!-- Pytest Coverage Comment:Begin -->
55
- <a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/README.md"><img alt="Coverage" src="https://img.shields.io/badge/Coverage-88%25-green.svg" /></a><details><summary>Coverage Report </summary><table><tr><th>File</th><th>Stmts</th><th>Miss</th><th>Cover</th><th>Missing</th></tr><tbody><tr><td colspan="5"><b>data2rdf</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/__init__.py">__init__.py</a></td><td>5</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/config.py">config.py</a></td><td>19</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/utils.py">utils.py</a></td><td>8</td><td>1</td><td>1</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/utils.py#L 88%"> 88%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/warnings.py">warnings.py</a></td><td>2</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td colspan="5"><b>data2rdf/models</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/__init__.py">__init__.py</a></td><td>3</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/base.py">base.py</a></td><td>54</td><td>5</td><td>5</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/base.py#L 91%"> 91%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/graph.py">graph.py</a></td><td>100</td><td>7</td><td>7</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/graph.py#L 93%"> 93%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/mapping.py">mapping.py</a></td><td>39</td><td>1</td><td>1</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/mapping.py#L 97%"> 97%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/utils.py">utils.py</a></td><td>58</td><td>14</td><td>14</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/utils.py#L 76%"> 76%</a></td></tr><tr><td colspan="5"><b>data2rdf/modes</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/modes/__init__.py">__init__.py</a></td><td>4</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td colspan="5"><b>data2rdf/parsers</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/__init__.py">__init__.py</a></td><td>6</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/base.py">base.py</a></td><td>135</td><td>11</td><td>11</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/base.py#L 92%"> 92%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/csv.py">csv.py</a></td><td>168</td><td>20</td><td>20</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/csv.py#L 88%"> 88%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/excel.py">excel.py</a></td><td>174</td><td>17</td><td>17</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/excel.py#L 90%"> 90%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/json.py">json.py</a></td><td>205</td><td>37</td><td>37</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/json.py#L 82%"> 82%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/utils.py">utils.py</a></td><td>88</td><td>10</td><td>10</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/utils.py#L 89%"> 89%</a></td></tr><tr><td colspan="5"><b>data2rdf/pipelines</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/pipelines/__init__.py">__init__.py</a></td><td>2</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/pipelines/main.py">main.py</a></td><td>82</td><td>9</td><td>9</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/pipelines/main.py#L 89%"> 89%</a></td></tr><tr><td colspan="5"><b>data2rdf/qudt</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/qudt/__init__.py">__init__.py</a></td><td>0</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/qudt/utils.py">utils.py</a></td><td>42</td><td>12</td><td>12</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/qudt/utils.py#L 71%"> 71%</a></td></tr><tr><td><b>TOTAL</b></td><td><b>1194</b></td><td><b>144</b></td><td><b>88%</b></td><td>&nbsp;</td></tr></tbody></table></details>
55
+ <a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/README.md"><img alt="Coverage" src="https://img.shields.io/badge/Coverage-88%25-green.svg" /></a><details><summary>Coverage Report </summary><table><tr><th>File</th><th>Stmts</th><th>Miss</th><th>Cover</th><th>Missing</th></tr><tbody><tr><td colspan="5"><b>data2rdf</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/__init__.py">__init__.py</a></td><td>5</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/config.py">config.py</a></td><td>26</td><td>1</td><td>1</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/config.py#L 96%"> 96%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/utils.py">utils.py</a></td><td>8</td><td>1</td><td>1</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/utils.py#L 88%"> 88%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/warnings.py">warnings.py</a></td><td>2</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td colspan="5"><b>data2rdf/models</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/__init__.py">__init__.py</a></td><td>3</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/base.py">base.py</a></td><td>54</td><td>5</td><td>5</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/base.py#L 91%"> 91%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/graph.py">graph.py</a></td><td>119</td><td>7</td><td>7</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/graph.py#L 94%"> 94%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/mapping.py">mapping.py</a></td><td>45</td><td>1</td><td>1</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/mapping.py#L 98%"> 98%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/utils.py">utils.py</a></td><td>58</td><td>14</td><td>14</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/utils.py#L 76%"> 76%</a></td></tr><tr><td colspan="5"><b>data2rdf/modes</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/modes/__init__.py">__init__.py</a></td><td>4</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td colspan="5"><b>data2rdf/parsers</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/__init__.py">__init__.py</a></td><td>6</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/base.py">base.py</a></td><td>135</td><td>11</td><td>11</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/base.py#L 92%"> 92%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/csv.py">csv.py</a></td><td>168</td><td>20</td><td>20</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/csv.py#L 88%"> 88%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/excel.py">excel.py</a></td><td>183</td><td>17</td><td>17</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/excel.py#L 91%"> 91%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/json.py">json.py</a></td><td>216</td><td>37</td><td>37</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/json.py#L 83%"> 83%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/utils.py">utils.py</a></td><td>90</td><td>10</td><td>10</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/utils.py#L 89%"> 89%</a></td></tr><tr><td colspan="5"><b>data2rdf/pipelines</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/pipelines/__init__.py">__init__.py</a></td><td>2</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/pipelines/main.py">main.py</a></td><td>82</td><td>9</td><td>9</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/pipelines/main.py#L 89%"> 89%</a></td></tr><tr><td colspan="5"><b>data2rdf/qudt</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/qudt/__init__.py">__init__.py</a></td><td>0</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/qudt/utils.py">utils.py</a></td><td>42</td><td>12</td><td>12</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/qudt/utils.py#L 71%"> 71%</a></td></tr><tr><td><b>TOTAL</b></td><td><b>1248</b></td><td><b>145</b></td><td><b>88%</b></td><td>&nbsp;</td></tr></tbody></table></details>
56
56
  <!-- Pytest Coverage Comment:End -->
57
57
 
58
58
  # Installation
@@ -0,0 +1,98 @@
1
+ # data2rdf
2
+
3
+ A pipeline for generating data representation in RDF out of raw data given in ASCII, CSV, JSON or EXCEL format.
4
+
5
+ https://data2rdf.readthedocs.io/en/latest/
6
+
7
+ <!-- Pytest Coverage Comment:Begin -->
8
+ <a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/README.md"><img alt="Coverage" src="https://img.shields.io/badge/Coverage-88%25-green.svg" /></a><details><summary>Coverage Report </summary><table><tr><th>File</th><th>Stmts</th><th>Miss</th><th>Cover</th><th>Missing</th></tr><tbody><tr><td colspan="5"><b>data2rdf</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/__init__.py">__init__.py</a></td><td>5</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/config.py">config.py</a></td><td>26</td><td>1</td><td>1</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/config.py#L 96%"> 96%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/utils.py">utils.py</a></td><td>8</td><td>1</td><td>1</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/utils.py#L 88%"> 88%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/warnings.py">warnings.py</a></td><td>2</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td colspan="5"><b>data2rdf/models</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/__init__.py">__init__.py</a></td><td>3</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/base.py">base.py</a></td><td>54</td><td>5</td><td>5</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/base.py#L 91%"> 91%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/graph.py">graph.py</a></td><td>119</td><td>7</td><td>7</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/graph.py#L 94%"> 94%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/mapping.py">mapping.py</a></td><td>45</td><td>1</td><td>1</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/mapping.py#L 98%"> 98%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/utils.py">utils.py</a></td><td>58</td><td>14</td><td>14</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/models/utils.py#L 76%"> 76%</a></td></tr><tr><td colspan="5"><b>data2rdf/modes</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/modes/__init__.py">__init__.py</a></td><td>4</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td colspan="5"><b>data2rdf/parsers</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/__init__.py">__init__.py</a></td><td>6</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/base.py">base.py</a></td><td>135</td><td>11</td><td>11</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/base.py#L 92%"> 92%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/csv.py">csv.py</a></td><td>168</td><td>20</td><td>20</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/csv.py#L 88%"> 88%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/excel.py">excel.py</a></td><td>183</td><td>17</td><td>17</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/excel.py#L 91%"> 91%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/json.py">json.py</a></td><td>216</td><td>37</td><td>37</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/json.py#L 83%"> 83%</a></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/utils.py">utils.py</a></td><td>90</td><td>10</td><td>10</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/parsers/utils.py#L 89%"> 89%</a></td></tr><tr><td colspan="5"><b>data2rdf/pipelines</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/pipelines/__init__.py">__init__.py</a></td><td>2</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/pipelines/main.py">main.py</a></td><td>82</td><td>9</td><td>9</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/pipelines/main.py#L 89%"> 89%</a></td></tr><tr><td colspan="5"><b>data2rdf/qudt</b></td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/qudt/__init__.py">__init__.py</a></td><td>0</td><td>0</td><td>100%</td><td>&nbsp;</td></tr><tr><td>&nbsp; &nbsp;<a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/qudt/utils.py">utils.py</a></td><td>42</td><td>12</td><td>12</td><td><a href="https://github.com/MI-FraunhoferIWM/data2rdf/blob/main/data2rdf/qudt/utils.py#L 71%"> 71%</a></td></tr><tr><td><b>TOTAL</b></td><td><b>1248</b></td><td><b>145</b></td><td><b>88%</b></td><td>&nbsp;</td></tr></tbody></table></details>
9
+ <!-- Pytest Coverage Comment:End -->
10
+
11
+ # Installation
12
+
13
+ ## Install for using the package
14
+
15
+ Either install the package from the pypi
16
+
17
+ ```bash
18
+ pip install data2rdf
19
+ ```
20
+
21
+
22
+ ## Install for development
23
+ Install the package from the source code:
24
+ ```bash
25
+ git clone git@github.com:MI-FraunhoferIWM/data2rdf.git
26
+ cd data2rdf
27
+ pip install -e .
28
+ ```
29
+
30
+ # Unit tests
31
+
32
+ Before running the unit tests, please install the needed packages:
33
+
34
+ ```{bash}
35
+ pip install data2rdf[tests]
36
+ ```
37
+
38
+ Afterwards, run the unittest with:
39
+
40
+ ```{bash}
41
+ pytest
42
+ ```
43
+
44
+ # Building the docs locally
45
+ ### HTML
46
+
47
+ A server will start, generate the docs and listen for changes in the source files.
48
+ This can be done by using docker or installing the development environment directly on the you machine. Next are installation guides for Docker and Linux OS.
49
+
50
+ #### Docker
51
+
52
+ First, build the Docker image by running the following command:
53
+
54
+ ```shell
55
+ $ docker build -f docs.Dockerfile -t data2rdf-docs .
56
+ ```
57
+
58
+ Then, start the program by running:
59
+
60
+ ```shell
61
+ $ docker run -it --rm -v $PWD:/app -p 8000:8000 data2rdf-docs
62
+ ```
63
+
64
+ #### Linux
65
+
66
+ At an OS level (these commands work on Linux Debian):
67
+
68
+ ```shell
69
+ $ sudo apt install pandoc graphviz default-jre
70
+ $ sudo apt-get install texlive-latex-recommended \
71
+ texlive-latex-extra \
72
+ texlive-fonts-recommended \
73
+ latexmk
74
+ ```
75
+
76
+ The python dependencies:
77
+
78
+ ```shell
79
+ $ pip install .[docs]
80
+ ```
81
+
82
+ Now you can start the server and render the docs:
83
+
84
+ ```
85
+ $ sphinx-autobuild docs/source docs/build/html
86
+ ```
87
+
88
+ The documentation will be available on [`http://127.0.0.1:8000`](http://127.0.0.1:8000).
89
+
90
+ ### PDF (LaTeX)
91
+
92
+ To generate a PDF of the documentation, simply run (from the root project folder):
93
+
94
+ ```sh
95
+ make -C docs latexpdf
96
+ ```
97
+
98
+ The generated PDF can be found under docs/build/latex/data2rdf_docs.pdf
@@ -20,6 +20,8 @@ class Config(BaseSettings):
20
20
  description="URI to QUDT quantity kind ontology for unit conversion",
21
21
  )
22
22
 
23
+ language: str = Field("en", description="Language for the unit labels")
24
+
23
25
  base_iri: Union[str, AnyUrl] = Field(
24
26
  "https://www.example.org", description="Base IRI for individuals."
25
27
  )
@@ -77,6 +79,11 @@ class Config(BaseSettings):
77
79
  description="In TBox mode, exclude the title of the ontology in the graph.",
78
80
  )
79
81
 
82
+ dsms_schema_default: bool = Field(
83
+ True,
84
+ description="""Default value for the `dsms_schema` parameter of the `to_dict` method.""",
85
+ )
86
+
80
87
  model_config = ConfigDict(extra="ignore")
81
88
 
82
89
  @model_validator(mode="after")
@@ -10,8 +10,8 @@ from pydantic import (
10
10
  BaseModel,
11
11
  ConfigDict,
12
12
  Field,
13
- ValidationInfo,
14
13
  field_validator,
14
+ model_validator,
15
15
  )
16
16
  from rdflib import Graph
17
17
 
@@ -106,16 +106,18 @@ class BasicSuffixModel(BaseConfigModel):
106
106
  value = [AnyUrl(str(iterable).strip()) for iterable in value]
107
107
  return value
108
108
 
109
- @field_validator("suffix")
109
+ @model_validator(mode="after")
110
110
  @classmethod
111
111
  def validate_suffix(
112
- cls, value: Optional[str], info: ValidationInfo
113
- ) -> str:
112
+ cls,
113
+ self: "BasicSuffixModel",
114
+ ) -> "BasicSuffixModel":
114
115
  """Return suffix for individal"""
115
116
 
116
- iri = info.data["iri"]
117
- config = info.data["config"]
118
- if isinstance(iri, list) and value is None:
117
+ if isinstance(self.iri, list) and self.suffix is None:
119
118
  raise TypeError("If the iri is a list, the suffix must be set ")
120
119
 
121
- return value or str(iri).split(config.separator)[-1]
120
+ self.suffix = (
121
+ self.suffix or str(self.iri).split(self.config.separator)[-1]
122
+ )
123
+ return self
@@ -3,18 +3,27 @@
3
3
  import warnings
4
4
  from typing import Any, Dict, List, Optional, Union
5
5
 
6
- from data2rdf.models.utils import apply_datatype, detect_datatype
7
- from data2rdf.qudt.utils import _get_query_match
8
- from data2rdf.utils import make_prefix
6
+ from data2rdf.qudt.utils import _get_qudt_label_and_symbol, _get_query_match
7
+ from data2rdf.utils import make_prefix, split_namespace
8
+ from data2rdf.warnings import ParserWarning
9
+
10
+ from data2rdf.models.utils import ( # isort:skip
11
+ apply_datatype,
12
+ detect_datatype,
13
+ is_float,
14
+ is_integer,
15
+ )
9
16
 
10
17
  from data2rdf.models.base import ( # isort:skip
11
18
  BasicGraphModel,
12
19
  BasicSuffixModel,
13
20
  RelationType,
21
+ BaseConfigModel,
14
22
  )
15
23
 
16
24
  from pydantic import ( # isort:skip
17
25
  AnyUrl,
26
+ AliasChoices,
18
27
  BaseModel,
19
28
  Field,
20
29
  ValidationInfo,
@@ -101,15 +110,48 @@ class ClassTypeGraph(BasicGraphModel):
101
110
  }
102
111
 
103
112
 
113
+ class MeasurementUnit(BaseConfigModel):
114
+ iri: Union[str, AnyUrl] = Field(
115
+ ...,
116
+ description="Ontological IRI related to the measurement unit",
117
+ )
118
+ label: Optional[str] = Field(
119
+ None,
120
+ description="Label of the measurement unit",
121
+ )
122
+ symbol: Optional[str] = Field(
123
+ None,
124
+ description="Symbol of the measurement unit",
125
+ )
126
+ namespace: Optional[str] = Field(
127
+ None,
128
+ description="Namespace of the measurement unit",
129
+ )
130
+
131
+ @model_validator(mode="after")
132
+ @classmethod
133
+ def validate_measurement_unit(cls, self) -> "MeasurementUnit":
134
+ unit = _get_qudt_label_and_symbol(
135
+ self.iri, self.config.qudt_units, self.config.language
136
+ )
137
+ if not self.label and "label" in unit:
138
+ self.label = unit["label"]
139
+ if not self.symbol and "symbol" in unit:
140
+ self.symbol = unit["symbol"]
141
+ if not self.namespace:
142
+ self.namespace = split_namespace(self.iri)
143
+ return self
144
+
145
+
104
146
  class QuantityGraph(BasicGraphModel, BasicSuffixModel):
105
147
  """Quantity with or without a discrete value and a unit
106
148
  E.g. a quantity with a single value and unit _or_
107
149
  a quantity describing a column of a time series or table with a unit."""
108
150
 
109
151
  unit: Optional[Union[str, AnyUrl]] = Field(
110
- ..., description="QUDT Symbol or any other IRI for the unit mapping"
152
+ None, description="QUDT Symbol or any other IRI for the unit mapping"
111
153
  )
112
- value: Optional[Union[int, float]] = Field(
154
+ value: Optional[Union[int, float, str]] = Field(
113
155
  None, description="Value of the quantity"
114
156
  )
115
157
 
@@ -125,6 +167,30 @@ class QuantityGraph(BasicGraphModel, BasicSuffixModel):
125
167
  for mapping the data value to the individual.""",
126
168
  )
127
169
 
170
+ measurement_unit: Optional[MeasurementUnit] = Field(
171
+ None,
172
+ description="Detailed QUDT Measurement Unit specification",
173
+ alias=AliasChoices(
174
+ "measurement_unit", "measurementunit", "measurementUnit"
175
+ ),
176
+ )
177
+
178
+ @field_validator("value", mode="after")
179
+ @classmethod
180
+ def validate_value(
181
+ cls, value: Union[int, float, str]
182
+ ) -> Union[int, float]:
183
+ if isinstance(value, str) and is_integer(value):
184
+ value = int(value)
185
+ elif isinstance(value, str) and is_float(value):
186
+ value = float(value)
187
+ elif isinstance(value, str):
188
+ warnings.warn(
189
+ f"Cannot type case value from str into float or int: {value}",
190
+ ParserWarning,
191
+ )
192
+ return value
193
+
128
194
  @field_validator("unit", mode="after")
129
195
  @classmethod
130
196
  def validate_unit(
@@ -150,6 +216,15 @@ class QuantityGraph(BasicGraphModel, BasicSuffixModel):
150
216
  value = str(value)
151
217
  return value
152
218
 
219
+ @model_validator(mode="after")
220
+ @classmethod
221
+ def validate_quantity_graph(cls, self) -> "QuantityGraph":
222
+ if not self.measurement_unit and self.unit:
223
+ self.measurement_unit = MeasurementUnit(iri=self.unit)
224
+ if self.measurement_unit and not self.unit:
225
+ self.unit = self.measurement_unit.iri
226
+ return self
227
+
153
228
  @property
154
229
  def json_ld(cls) -> Dict[str, Any]:
155
230
  """Return dict of json-ld for graph"""
@@ -200,9 +275,9 @@ class PropertyGraph(BasicGraphModel, BasicSuffixModel):
200
275
  discrete value but can also be a reference to a column in a table or
201
276
  time series."""
202
277
 
203
- value: Optional[Union[str, int, float, bool, AnyUrl]] = Field(
204
- None, description="Value of the property"
205
- )
278
+ value: Optional[
279
+ Union[str, int, float, bool, AnyUrl, "PropertyGraph", "QuantityGraph"]
280
+ ] = Field(None, description="Value of the property")
206
281
  annotation: Optional[Union[str, AnyUrl]] = Field(
207
282
  None, description="Base IRI with which the value shall be concatenated"
208
283
  )
@@ -210,13 +285,24 @@ class PropertyGraph(BasicGraphModel, BasicSuffixModel):
210
285
  "rdfs:label",
211
286
  description="""Data or annotation property
212
287
  for mapping the data value to the individual.""",
288
+ alias=AliasChoices("relation", "value_relation", "valuerelation"),
213
289
  )
214
290
  value_relation_type: Optional[RelationType] = Field(
215
- None, description="Type of the semantic relation used in the mappings"
291
+ None,
292
+ description="Type of the semantic relation used in the mappings",
293
+ alias=AliasChoices(
294
+ "value_relation_type",
295
+ "value_relationtype",
296
+ "relation_type",
297
+ "relationtype",
298
+ ),
216
299
  )
217
300
  value_datatype: Optional[str] = Field(
218
301
  None,
219
302
  description="In case of an annotation or data property, this field indicates the XSD Datatype of the value",
303
+ alias=AliasChoices(
304
+ "value_datatype", "value_data_type", "datatype", "data_type"
305
+ ),
220
306
  )
221
307
 
222
308
  @field_validator("annotation")
@@ -227,6 +313,19 @@ class PropertyGraph(BasicGraphModel, BasicSuffixModel):
227
313
  value = AnyUrl(str(value).strip())
228
314
  return value
229
315
 
316
+ @model_validator(mode="after")
317
+ @classmethod
318
+ def validate_value(cls, self: "PropertyGraph") -> "PropertyGraph":
319
+ """
320
+ Validate value of a property graph.
321
+
322
+ In case the value is a property graph or a quantity graph, make sure that
323
+ the config is set correctly.
324
+ """
325
+ if isinstance(self.value, (PropertyGraph, QuantityGraph)):
326
+ self.value.config = self.config
327
+ return self
328
+
230
329
  @model_validator(mode="after")
231
330
  @classmethod
232
331
  def validate_property_graph(cls, self: "PropertyGraph") -> "PropertyGraph":
@@ -264,7 +363,10 @@ class PropertyGraph(BasicGraphModel, BasicSuffixModel):
264
363
  spec = apply_datatype(self.value, self.value_datatype)
265
364
  response = {self.value_relation: spec}
266
365
  else:
267
- response = {self.value_relation: {"@id": str(self.value)}}
366
+ if isinstance(self.value, (PropertyGraph, QuantityGraph)):
367
+ response = {self.value_relation: self.value.json_ld}
368
+ else:
369
+ response = {self.value_relation: {"@id": str(self.value)}}
268
370
  else:
269
371
  response = {}
270
372
  return response
@@ -3,7 +3,14 @@
3
3
 
4
4
  from typing import List, Optional, Union
5
5
 
6
- from pydantic import AnyUrl, BaseModel, Field, field_validator, model_validator
6
+ from pydantic import (
7
+ AliasChoices,
8
+ AnyUrl,
9
+ BaseModel,
10
+ Field,
11
+ field_validator,
12
+ model_validator,
13
+ )
7
14
 
8
15
  from .base import BasicConceptMapping, BasicSuffixModel, RelationType
9
16
 
@@ -28,7 +35,33 @@ class TBoxBaseMapping(BasicConceptMapping):
28
35
  )
29
36
 
30
37
  datatype: Optional[str] = Field(
31
- None, description="XSD Datatype of the targed value"
38
+ None,
39
+ description="XSD Datatype of the targed value",
40
+ alias=AliasChoices("datatype", "data_type"),
41
+ )
42
+
43
+
44
+ class CustomRelationPropertySubgraph(BasicSuffixModel):
45
+ value_relation: Optional[str] = Field(
46
+ "rdfs:label",
47
+ description="""Object/Data/Annotation property for the value
48
+ resolving from `key` of this model""",
49
+ )
50
+
51
+
52
+ class CustomRelationQuantitySubgraph(BasicSuffixModel):
53
+ unit_relation: Optional[Union[str, AnyUrl]] = Field(
54
+ "qudt:hasUnit",
55
+ description="""Object property for mapping the IRI
56
+ of the unit to the individual.""",
57
+ )
58
+ value_relation: Optional[Union[str, AnyUrl]] = Field(
59
+ "qudt:value",
60
+ description="""Data property
61
+ for mapping the data value to the individual.""",
62
+ )
63
+ unit: Optional[Union[str, AnyUrl]] = Field(
64
+ None, description="Symbol or QUDT IRI for the mapping"
32
65
  )
33
66
 
34
67
 
@@ -44,8 +77,16 @@ class CustomRelation(BaseModel):
44
77
  ...,
45
78
  description="Cell number or Jsonpath to the value of the quantity or property",
46
79
  )
47
- object_data_type: Optional[str] = Field(
48
- None, description="XSD Data type of the object"
80
+ object_data_type: Optional[
81
+ Union[
82
+ str, CustomRelationPropertySubgraph, CustomRelationQuantitySubgraph
83
+ ]
84
+ ] = Field(
85
+ None,
86
+ description="XSD Data type of the object or PropertyGraph-mapping or QuantityGraph-mapping",
87
+ alias=AliasChoices(
88
+ "object_datatype", "object_data_type", "object_type"
89
+ ),
49
90
  )
50
91
  relation_type: Optional[RelationType] = Field(
51
92
  None, description="Type of the semantic relation used in the mappings"
@@ -1,6 +1,7 @@
1
1
  """Data2RDF base model for parsers"""
2
2
 
3
3
  import json
4
+ import warnings
4
5
  from abc import abstractmethod
5
6
  from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
6
7
 
@@ -9,7 +10,7 @@ from rdflib import Graph
9
10
  from data2rdf.config import Config
10
11
  from data2rdf.modes import PipelineMode
11
12
 
12
- from .utils import load_mapping_file
13
+ from .utils import generate_id, load_mapping_file
13
14
 
14
15
  from pydantic import ( # isort:skip
15
16
  BaseModel,
@@ -189,15 +190,46 @@ class ABoxBaseParser(AnyBoxBaseParser):
189
190
  return self._time_series
190
191
 
191
192
  @property
192
- def plain_metadata(self) -> "Dict[str, Any]":
193
- """Metadata as flat json - without units and iris.
194
- Useful e.g. for the custom properties of the DSMS."""
195
- return {
196
- str(metadatum.iri).split(self.config.separator)[
197
- -1
198
- ]: metadatum.value
199
- for metadatum in self.general_metadata
200
- }
193
+ def plain_metadata(self) -> List[Dict[str, Any]]:
194
+ message = """
195
+ `plain_metadata` is deprecated and will be removed in a future version.
196
+ Use the `to_dict()` instead."""
197
+ warnings.warn(message, DeprecationWarning)
198
+ return self.to_dict(dsms_schema=self.config.dsms_schema_default)
199
+
200
+ def to_dict(
201
+ self, dsms_schema: bool = False
202
+ ) -> "Union[Dict[str, Any], List[Dict[str, Any]]]":
203
+ """Return list of general metadata as DSMS custom properties"""
204
+ metadata = []
205
+ for metadatum in self.general_metadata:
206
+ prop = {
207
+ "label": metadatum.suffix,
208
+ "value": metadatum.value,
209
+ }
210
+ if hasattr(metadatum, "measurement_unit"):
211
+ prop[
212
+ "measurement_unit"
213
+ ] = metadatum.measurement_unit.model_dump(exclude={"config"})
214
+ metadata.append(prop)
215
+ if dsms_schema:
216
+ if metadata:
217
+ for metadatum in metadata:
218
+ metadatum["id"] = generate_id()
219
+ metadata = {
220
+ "sections": [
221
+ {
222
+ "id": generate_id(),
223
+ "name": "General",
224
+ "entries": metadata,
225
+ }
226
+ ]
227
+ }
228
+ else:
229
+ metadata = {}
230
+ else:
231
+ metadata = {datum.get("label"): datum for datum in metadata}
232
+ return metadata
201
233
 
202
234
 
203
235
  class BaseFileParser(BaseParser):
@@ -281,6 +313,15 @@ class BaseFileParser(BaseParser):
281
313
  "`plain_metadata` is not available in `tbox`-mode."
282
314
  )
283
315
 
316
+ def to_dict(self, dsms_schema: bool = False) -> "List[Dict[str, Any]]":
317
+ """Return list of general metadata as DSMS custom properties"""
318
+ if self.mode == PipelineMode.ABOX:
319
+ return self.abox.to_dict(dsms_schema=dsms_schema)
320
+ else:
321
+ raise NotImplementedError(
322
+ "`to_dict()` is not available in `tbox`-mode."
323
+ )
324
+
284
325
  @property
285
326
  def general_metadata(cls) -> "List[BasicConceptMapping]":
286
327
  """Return list object with general metadata"""