h5rdmtoolbox 2.1.0__tar.gz → 2.2.1__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 (147) hide show
  1. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/PKG-INFO +56 -38
  2. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/README.md +1 -1
  3. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/__init__.py +36 -28
  4. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/convention/ontology/hdf_datatypes.py +3 -3
  5. h5rdmtoolbox-2.2.1/h5rdmtoolbox/ld/__init__.py +76 -0
  6. h5rdmtoolbox-2.2.1/h5rdmtoolbox/ld/globals.py +3 -0
  7. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/ld/hdf/attributes.py +8 -2
  8. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/ld/hdf/datasets.py +26 -11
  9. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/ld/hdf/file.py +9 -8
  10. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/ld/hdf/groups.py +18 -4
  11. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/ld/rdf.py +1 -1
  12. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/ld/user/attributes.py +14 -14
  13. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/ld/user/file.py +10 -10
  14. h5rdmtoolbox-2.2.1/h5rdmtoolbox/ld/utils.py +124 -0
  15. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/repository/interface.py +6 -36
  16. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/wrapper/core.py +28 -20
  17. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/wrapper/jsonld.py +0 -3
  18. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox.egg-info/PKG-INFO +56 -38
  19. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox.egg-info/SOURCES.txt +1 -0
  20. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox.egg-info/requires.txt +24 -7
  21. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/setup.cfg +10 -8
  22. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/conventions/test_conventions.py +1 -1
  23. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/ld/test_ld.py +78 -34
  24. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/ld/test_user_graph.py +1 -1
  25. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/repository/test_zenodo.py +23 -7
  26. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/test_version.py +7 -1
  27. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/wrapper/test_dump.py +3 -6
  28. h5rdmtoolbox-2.1.0/h5rdmtoolbox/ld/__init__.py +0 -91
  29. h5rdmtoolbox-2.1.0/h5rdmtoolbox/ld/utils.py +0 -77
  30. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/LICENSE +0 -0
  31. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/_cfg.py +0 -0
  32. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/_repr.py +0 -0
  33. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/_version.py +0 -0
  34. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/cli.py +0 -0
  35. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/consts.py +0 -0
  36. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/convention/__init__.py +0 -0
  37. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/convention/cfg.py +0 -0
  38. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/convention/consts.py +0 -0
  39. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/convention/core.py +0 -0
  40. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/convention/errors.py +0 -0
  41. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/convention/generate.py +0 -0
  42. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/convention/ontology/__init__.py +0 -0
  43. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/convention/ontology/h5ontocls.py +0 -0
  44. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/convention/references.py +0 -0
  45. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/convention/standard_attributes.py +0 -0
  46. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/convention/toolbox_validators.py +0 -0
  47. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/convention/utils.py +0 -0
  48. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/data/def_icon.png +0 -0
  49. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/data/fluid-v1.yml +0 -0
  50. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/data/h5tbx.yaml +0 -0
  51. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/data/id_icon.png +0 -0
  52. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/data/iri_icon.png +0 -0
  53. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/data/ld_icon.png +0 -0
  54. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/data/piv-v1.yml +0 -0
  55. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/data/style.css +0 -0
  56. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/data/tutorial_convention.yaml +0 -0
  57. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/data/tutorial_standard_name_table.yaml +0 -0
  58. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/data/type_icon.png +0 -0
  59. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/database/__init__.py +0 -0
  60. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/database/hdfdb/__init__.py +0 -0
  61. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/database/hdfdb/filedb.py +0 -0
  62. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/database/hdfdb/objdb.py +0 -0
  63. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/database/hdfdb/query.py +0 -0
  64. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/database/hdfdb/utils.py +0 -0
  65. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/database/interface.py +0 -0
  66. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/database/lazy.py +0 -0
  67. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/database/mongo.py +0 -0
  68. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/errors.py +0 -0
  69. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/extensions/__init__.py +0 -0
  70. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/extensions/magnitude.py +0 -0
  71. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/extensions/normalize.py +0 -0
  72. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/extensions/onto.py +0 -0
  73. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/extensions/units.py +0 -0
  74. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/extensions/vector.py +0 -0
  75. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/gui/__init__.py +0 -0
  76. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/gui/fairify.py +0 -0
  77. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/gui/src/__init__.py +0 -0
  78. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/gui/src/main.py +0 -0
  79. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/identifiers.py +0 -0
  80. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/layout/__init__.py +0 -0
  81. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/layout/core.py +0 -0
  82. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/ld/hdf/__init__.py +0 -0
  83. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/ld/user/__init__.py +0 -0
  84. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/ld/user/datasets.py +0 -0
  85. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/ld/user/groups.py +0 -0
  86. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/plotting.py +0 -0
  87. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/protected_attributes.py +0 -0
  88. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/protocols.py +0 -0
  89. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/repository/__init__.py +0 -0
  90. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/repository/utils.py +0 -0
  91. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/repository/zenodo/__init__.py +0 -0
  92. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/repository/zenodo/core.py +0 -0
  93. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/repository/zenodo/metadata.py +0 -0
  94. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/repository/zenodo/tokens.py +0 -0
  95. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/repository/zenodo/utils.py +0 -0
  96. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/tutorial.py +0 -0
  97. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/user.py +0 -0
  98. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/utils.py +0 -0
  99. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/wrapper/__init__.py +0 -0
  100. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/wrapper/accessor.py +0 -0
  101. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/wrapper/accessors/__init__.py +0 -0
  102. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/wrapper/accessors/provenance.py +0 -0
  103. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/wrapper/ds_decoder.py +0 -0
  104. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/wrapper/h5attr.py +0 -0
  105. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/wrapper/h5ext.py +0 -0
  106. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/wrapper/h5utils.py +0 -0
  107. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/wrapper/h5yaml.py +0 -0
  108. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox/wrapper/xr2hdf.py +0 -0
  109. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox.egg-info/dependency_links.txt +0 -0
  110. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox.egg-info/entry_points.txt +0 -0
  111. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/h5rdmtoolbox.egg-info/top_level.txt +0 -0
  112. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/pyproject.toml +0 -0
  113. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/setup.py +0 -0
  114. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/__init__.py +0 -0
  115. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/clean_zenodo_sandbox.py +0 -0
  116. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/conventions/__init__.py +0 -0
  117. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/conventions/test_convention_vfuncs.py +0 -0
  118. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/conventions/test_engmeta.py +0 -0
  119. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/conventions/test_references.py +0 -0
  120. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/conventions/test_toolbox_validators.py +0 -0
  121. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/conventions/test_utils.py +0 -0
  122. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/database/__init__.py +0 -0
  123. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/database/test_find_rdf.py +0 -0
  124. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/database/test_hdfDB.py +0 -0
  125. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/database/test_mongo.py +0 -0
  126. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/layouts/__init__.py +0 -0
  127. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/layouts/test_core.py +0 -0
  128. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/layouts/test_docs.py +0 -0
  129. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/ld/__init__.py +0 -0
  130. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/ld/test_rdf.py +0 -0
  131. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/repository/__init__.py +0 -0
  132. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/test_cli.py +0 -0
  133. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/test_config.py +0 -0
  134. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/test_extensions.py +0 -0
  135. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/test_identifiers.py +0 -0
  136. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/test_plotting.py +0 -0
  137. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/test_repr.py +0 -0
  138. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/test_user.py +0 -0
  139. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/test_utils.py +0 -0
  140. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/test_xarray_export.py +0 -0
  141. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/wrapper/__init__.py +0 -0
  142. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/wrapper/test_core.py +0 -0
  143. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/wrapper/test_file.py +0 -0
  144. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/wrapper/test_h5ext.py +0 -0
  145. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/wrapper/test_lazy.py +0 -0
  146. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/wrapper/test_namespaces.py +0 -0
  147. {h5rdmtoolbox-2.1.0 → h5rdmtoolbox-2.2.1}/tests/wrapper/test_xr2df.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: h5rdmtoolbox
3
- Version: 2.1.0
3
+ Version: 2.2.1
4
4
  Summary: Supporting a FAIR Research Data lifecycle using Python and HDF5.
5
5
  Home-page: https://h5rdmtoolbox.readthedocs.io/en/latest/
6
6
  Author: Matthias Probst
@@ -17,21 +17,21 @@ Requires-Python: <3.13,>=3.9
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE
19
19
  Requires-Dist: appdirs>=1.4.4
20
- Requires-Dist: importlib_resources
20
+ Requires-Dist: importlib_resources<7.0.0,>=6.5.2
21
21
  Requires-Dist: numpy<2.0.0,>=1.20
22
- Requires-Dist: h5py>3.7.0
22
+ Requires-Dist: h5py<4.0.0,>=3.8.0
23
23
  Requires-Dist: matplotlib>=3.5.2
24
24
  Requires-Dist: IPython>=7.34.0
25
- Requires-Dist: pyyaml>6.0
25
+ Requires-Dist: pyyaml>=6.0
26
26
  Requires-Dist: xarray>=2022.3.0
27
27
  Requires-Dist: pint==0.21.1
28
- Requires-Dist: pint_xarray>=0.2.1
28
+ Requires-Dist: pint_xarray<=0.4.0,>=0.2.1
29
29
  Requires-Dist: regex>=2020.7.9
30
30
  Requires-Dist: packaging>=24.1
31
- Requires-Dist: ontolutils>=0.13.3
31
+ Requires-Dist: ontolutils<0.20.0,>=0.19.2
32
32
  Requires-Dist: python-forge==18.6.0
33
- Requires-Dist: requests>=2.32.3
34
- Requires-Dist: pydantic>=2.8.2
33
+ Requires-Dist: requests>=2.32.4
34
+ Requires-Dist: pydantic<3.0.0,>=2.8.2
35
35
  Requires-Dist: rdflib>=7.0.0
36
36
  Requires-Dist: click==8.1.7
37
37
  Provides-Extra: database
@@ -111,41 +111,59 @@ Requires-Dist: tabulate<=0.9.0,>=0.8.10; extra == "complete"
111
111
  Requires-Dist: python-gitlab; extra == "complete"
112
112
  Requires-Dist: pypandoc>=1.11; extra == "complete"
113
113
  Requires-Dist: pymongo<=4.10.1,>=4.2.0; extra == "complete"
114
- Requires-Dist: pandas>=1.4.3; extra == "complete"
115
- Requires-Dist: xmltodict<=0.13.0; extra == "complete"
116
- Requires-Dist: tabulate<=0.9.0,>=0.8.10; extra == "complete"
117
- Requires-Dist: python-gitlab; extra == "complete"
118
- Requires-Dist: pypandoc>=1.11; extra == "complete"
119
- Requires-Dist: pymongo<=4.10.1,>=4.2.0; extra == "complete"
120
- Requires-Dist: pytest>=8.3.3; extra == "complete"
121
- Requires-Dist: pytest-cov>=5.0.0; extra == "complete"
122
- Requires-Dist: pylint; extra == "complete"
123
- Requires-Dist: scikit-image; extra == "complete"
124
- Requires-Dist: ssnolib>=1.5.1.2; extra == "complete"
125
- Requires-Dist: mongomock==4.1.2; extra == "complete"
126
- Requires-Dist: xmltodict<=0.13.0; extra == "complete"
127
- Requires-Dist: scipy>=1.10.1; extra == "complete"
128
- Requires-Dist: scikit-image>=0.21.0; extra == "complete"
129
- Requires-Dist: pandas>=1.4.3; extra == "complete"
130
- Requires-Dist: xmltodict<=0.13.0; extra == "complete"
131
- Requires-Dist: tabulate<=0.9.0,>=0.8.10; extra == "complete"
132
- Requires-Dist: python-gitlab; extra == "complete"
133
- Requires-Dist: pypandoc>=1.11; extra == "complete"
134
- Requires-Dist: pymongo<=4.10.1,>=4.2.0; extra == "complete"
135
- Requires-Dist: Sphinx==8.0.0; extra == "complete"
136
- Requires-Dist: sphinx_book_theme==1.1.3; extra == "complete"
137
- Requires-Dist: sphinx-copybutton==0.5.2; extra == "complete"
138
- Requires-Dist: sphinx-design==0.6.1; extra == "complete"
139
- Requires-Dist: myst-nb==1.2.0; extra == "complete"
140
- Requires-Dist: sphinxcontrib-bibtex==2.6.3; extra == "complete"
141
- Requires-Dist: scikit-image>=0.21.0; extra == "complete"
142
- Requires-Dist: scikit-learn; extra == "complete"
114
+ Provides-Extra: complete-with-docs
115
+ Requires-Dist: tabulate<=0.9.0,>=0.8.10; extra == "complete-with-docs"
116
+ Requires-Dist: PyQt5==5.15.10; extra == "complete-with-docs"
117
+ Requires-Dist: pytest>=8.3.3; extra == "complete-with-docs"
118
+ Requires-Dist: pytest-cov>=5.0.0; extra == "complete-with-docs"
119
+ Requires-Dist: pylint; extra == "complete-with-docs"
120
+ Requires-Dist: scikit-image; extra == "complete-with-docs"
121
+ Requires-Dist: ssnolib>=1.5.1.2; extra == "complete-with-docs"
122
+ Requires-Dist: mongomock==4.1.2; extra == "complete-with-docs"
123
+ Requires-Dist: xmltodict<=0.13.0; extra == "complete-with-docs"
124
+ Requires-Dist: scipy>=1.10.1; extra == "complete-with-docs"
125
+ Requires-Dist: scikit-image>=0.21.0; extra == "complete-with-docs"
126
+ Requires-Dist: pandas>=1.4.3; extra == "complete-with-docs"
127
+ Requires-Dist: xmltodict<=0.13.0; extra == "complete-with-docs"
128
+ Requires-Dist: tabulate<=0.9.0,>=0.8.10; extra == "complete-with-docs"
129
+ Requires-Dist: python-gitlab; extra == "complete-with-docs"
130
+ Requires-Dist: pypandoc>=1.11; extra == "complete-with-docs"
131
+ Requires-Dist: pymongo<=4.10.1,>=4.2.0; extra == "complete-with-docs"
132
+ Requires-Dist: pandas>=1.4.3; extra == "complete-with-docs"
133
+ Requires-Dist: xmltodict<=0.13.0; extra == "complete-with-docs"
134
+ Requires-Dist: tabulate<=0.9.0,>=0.8.10; extra == "complete-with-docs"
135
+ Requires-Dist: python-gitlab; extra == "complete-with-docs"
136
+ Requires-Dist: pypandoc>=1.11; extra == "complete-with-docs"
137
+ Requires-Dist: pymongo<=4.10.1,>=4.2.0; extra == "complete-with-docs"
138
+ Requires-Dist: pytest>=8.3.3; extra == "complete-with-docs"
139
+ Requires-Dist: pytest-cov>=5.0.0; extra == "complete-with-docs"
140
+ Requires-Dist: pylint; extra == "complete-with-docs"
141
+ Requires-Dist: scikit-image; extra == "complete-with-docs"
142
+ Requires-Dist: ssnolib>=1.5.1.2; extra == "complete-with-docs"
143
+ Requires-Dist: mongomock==4.1.2; extra == "complete-with-docs"
144
+ Requires-Dist: xmltodict<=0.13.0; extra == "complete-with-docs"
145
+ Requires-Dist: scipy>=1.10.1; extra == "complete-with-docs"
146
+ Requires-Dist: scikit-image>=0.21.0; extra == "complete-with-docs"
147
+ Requires-Dist: pandas>=1.4.3; extra == "complete-with-docs"
148
+ Requires-Dist: xmltodict<=0.13.0; extra == "complete-with-docs"
149
+ Requires-Dist: tabulate<=0.9.0,>=0.8.10; extra == "complete-with-docs"
150
+ Requires-Dist: python-gitlab; extra == "complete-with-docs"
151
+ Requires-Dist: pypandoc>=1.11; extra == "complete-with-docs"
152
+ Requires-Dist: pymongo<=4.10.1,>=4.2.0; extra == "complete-with-docs"
153
+ Requires-Dist: Sphinx==8.0.0; extra == "complete-with-docs"
154
+ Requires-Dist: sphinx_book_theme==1.1.3; extra == "complete-with-docs"
155
+ Requires-Dist: sphinx-copybutton==0.5.2; extra == "complete-with-docs"
156
+ Requires-Dist: sphinx-design==0.6.1; extra == "complete-with-docs"
157
+ Requires-Dist: myst-nb==1.2.0; extra == "complete-with-docs"
158
+ Requires-Dist: sphinxcontrib-bibtex==2.6.3; extra == "complete-with-docs"
159
+ Requires-Dist: scikit-image>=0.21.0; extra == "complete-with-docs"
160
+ Requires-Dist: scikit-learn; extra == "complete-with-docs"
143
161
  Dynamic: license-file
144
162
 
145
163
  # HDF5 Research Data Management Toolbox
146
164
 
147
165
  ![Tests](https://github.com/matthiasprobst/h5RDMtoolbox/actions/workflows/tests.yml/badge.svg)
148
- ![DOCS](https://codecov.io/gh/matthiasprobst/h5RDMtoolbox/branch/dev/graph/badge.svg)
166
+ [![codecov](https://codecov.io/gh/matthiasprobst/h5RDMtoolbox/graph/badge.svg?token=IVG4AQEW47)](https://codecov.io/gh/matthiasprobst/h5RDMtoolbox)
149
167
  [![Documentation Status](https://readthedocs.org/projects/h5rdmtoolbox/badge/?version=latest)](https://h5rdmtoolbox.readthedocs.io/en/latest/?badge=latest)
150
168
  ![pyvers](https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)
151
169
 
@@ -1,7 +1,7 @@
1
1
  # HDF5 Research Data Management Toolbox
2
2
 
3
3
  ![Tests](https://github.com/matthiasprobst/h5RDMtoolbox/actions/workflows/tests.yml/badge.svg)
4
- ![DOCS](https://codecov.io/gh/matthiasprobst/h5RDMtoolbox/branch/dev/graph/badge.svg)
4
+ [![codecov](https://codecov.io/gh/matthiasprobst/h5RDMtoolbox/graph/badge.svg?token=IVG4AQEW47)](https://codecov.io/gh/matthiasprobst/h5RDMtoolbox)
5
5
  [![Documentation Status](https://readthedocs.org/projects/h5rdmtoolbox/badge/?version=latest)](https://h5rdmtoolbox.readthedocs.io/en/latest/?badge=latest)
6
6
  ![pyvers](https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)
7
7
 
@@ -129,44 +129,53 @@ def get_ld(
129
129
  structural: bool = True,
130
130
  contextual: bool = True,
131
131
  skipND: int = 1,
132
- blank_node_iri_base: Optional[str] = None,
133
- **kwargs) -> rdflib.Graph:
132
+ file_uri: Optional[str] = None,
133
+ context: Optional[Dict] = None
134
+ ) -> rdflib.Graph:
134
135
  """Return the HDF file content as a rdflib.Graph object."""
135
136
  from h5rdmtoolbox.ld import get_ld
136
- return get_ld(hdf_filename, structural=structural, contextual=contextual, skipND=skipND,
137
- blank_node_iri_base=blank_node_iri_base, **kwargs)
137
+ return get_ld(hdf_filename,
138
+ structural=structural,
139
+ contextual=contextual,
140
+ skipND=skipND,
141
+ file_uri=file_uri,
142
+ context=context)
138
143
 
139
144
 
140
145
  def dump_jsonld(
141
146
  hdf_filename: Union[str, pathlib.Path],
142
147
  skipND: int = 1,
148
+ indent: int = 2,
143
149
  structural: bool = True,
144
150
  contextual: bool = True,
145
151
  context: Optional[Dict] = None,
146
- blank_node_iri_base: Optional[str] = None,
147
- **kwargs):
152
+ file_uri: Optional[str] = None
153
+ ):
148
154
  """Return the file content as a JSON-LD string."""
149
155
  from .ld import optimize_context
150
156
  context = context or {}
151
157
  graph = get_ld(hdf_filename,
152
158
  structural=structural,
153
159
  contextual=contextual,
154
- blank_node_iri_base=blank_node_iri_base,
155
- skipND=skipND,
156
- **kwargs)
160
+ file_uri=file_uri,
161
+ skipND=skipND)
157
162
  context = optimize_context(graph, context)
158
- return graph.serialize(format="json-ld", indent=2, auto_compact=True,
159
- context=context)
163
+ return graph.serialize(
164
+ format="json-ld",
165
+ indent=indent,
166
+ auto_compact=True,
167
+ context=context
168
+ )
160
169
 
161
170
 
162
171
  def dump_jsonld_depr(hdf_filename: Union[str, pathlib.Path],
163
172
  skipND: int = 1,
164
173
  structural: bool = True,
165
- semantic: bool = True,
174
+ contextual: bool = True,
166
175
  resolve_keys: bool = True,
167
176
  context: Optional[Dict] = None,
168
- blank_node_iri_base: Optional[str] = None,
169
- **kwargs) -> str:
177
+ blank_node_iri_base: Optional[str] = None
178
+ ) -> str:
170
179
  """Dump the JSON-LD representation of the file. With semantic=True and structural=False, the JSON-LD
171
180
  represents the semantic content only. To get a pure structural representation, set semantic=False, which
172
181
  will ignore any RDF content. If both are set to True, the JSON-LD will contain both structural and semantic.
@@ -198,13 +207,15 @@ def dump_jsonld_depr(hdf_filename: Union[str, pathlib.Path],
198
207
  if not isinstance(blank_node_iri_base, (str, HttpUrl)):
199
208
  raise ValueError('blank_node_iri_base must be a valid URL')
200
209
  from .wrapper import jsonld
201
- if not structural and not semantic:
202
- raise ValueError('At least one of structural or semantic must be True.')
210
+ if not structural and not contextual:
211
+ raise ValueError('At least one of structural or contextual must be True.')
203
212
 
204
213
  from h5rdmtoolbox.ld.hdf.file import get_serialized_ld
205
- if structural and not semantic:
206
- return get_serialized_ld(hdf_filename, blank_node_iri_base, format="json-ld", context=context, skipND=skipND)
207
- return get_serialized_ld(hdf_filename, blank_node_iri_base, format="json-ld", context=context, skipND=skipND)
214
+ if structural and not contextual:
215
+ return get_serialized_ld(hdf_filename, blank_node_iri_base, format="json-ld", context=context,
216
+ contextual=contextual, skipND=skipND)
217
+ return get_serialized_ld(hdf_filename, blank_node_iri_base, format="json-ld", context=context,
218
+ contextual=contextual, skipND=skipND)
208
219
  # with File(hdf_filename) as h5:
209
220
  # return jsonld.dumps(
210
221
  # h5,
@@ -221,20 +232,17 @@ def serialize(hdf_filename,
221
232
  fmt: str = "ttl",
222
233
  skipND: int = 1,
223
234
  structural: bool = True,
224
- semantic: bool = True,
225
- resolve_keys: bool = True,
226
- blank_node_iri_base: Optional[str] = None,
235
+ contextual: bool = True,
236
+ file_uri: Optional[str] = None,
227
237
  **kwargs):
228
238
  """Alternative to json-ld but allows multiple serialization options"""
229
239
  fmt = kwargs.pop("format", fmt)
230
240
  with File(hdf_filename) as h5:
231
- return h5.serialize(fmt,
232
- skipND,
241
+ return h5.serialize(fmt=fmt,
242
+ skipND=skipND,
233
243
  structural=structural,
234
- semantic=semantic,
235
- resolve_keys=resolve_keys,
236
- blank_node_iri_base=blank_node_iri_base,
237
- **kwargs)
244
+ contextual=contextual,
245
+ file_uri=file_uri)
238
246
 
239
247
 
240
248
  def build_pyvis_graph(hdf_filename, output_filename="kg-graph.html", notebook=False,
@@ -1,5 +1,6 @@
1
1
  import h5py
2
2
  import numpy as np
3
+ import rdflib
3
4
  from ontolutils.namespacelib.hdf5 import HDF5
4
5
 
5
6
  # Mapping HDF5 numpy datatypes to ontology types
@@ -53,12 +54,11 @@ def _get_endianness(dtype):
53
54
  return 'LE' # Default to little-endian if unknown
54
55
 
55
56
 
56
- def get_datatype(dataset: h5py.Dataset):
57
+ def get_datatype(dataset: h5py.Dataset) -> rdflib.URIRef:
57
58
  """Maps an HDF5 dataset to its ontology-defined datatype."""
58
59
  dtype = dataset.dtype
59
60
  np_type = np.dtype(dtype).type # Get numpy type (e.g., np.float32)
60
61
 
61
62
  endianness = _get_endianness(dtype)
62
63
 
63
- ontology_type = HDF5_DATATYPE_MAP.get((np_type, endianness), None)
64
- return ontology_type
64
+ return HDF5_DATATYPE_MAP.get((np_type, endianness), None)
@@ -0,0 +1,76 @@
1
+ import pathlib
2
+ import warnings
3
+ from typing import Union, Optional, Dict
4
+
5
+ import h5py
6
+ import rdflib
7
+
8
+ from .hdf.file import get_ld as get_hdf_ld
9
+ from .user.file import get_ld as get_contextual_ld
10
+ from .utils import optimize_context
11
+
12
+
13
+ def get_ld(
14
+ hdf_filename: Union[str, pathlib.Path],
15
+ structural: bool = True,
16
+ contextual: bool = True,
17
+ file_uri: Optional[str] = None,
18
+ skipND: Optional[int] = 1,
19
+ context: Optional[Dict] = None) -> rdflib.Graph:
20
+ """Return the HDF file content as a rdflib.Graph object."""
21
+
22
+ graph = None
23
+ with h5py.File(hdf_filename) as h5:
24
+ if contextual and structural:
25
+ graph1 = get_hdf_ld(h5, file_uri=file_uri, skipND=skipND)
26
+ graph2 = get_contextual_ld(h5, file_uri=file_uri)
27
+ graph = graph1 + graph2
28
+ else:
29
+ if structural:
30
+ graph = get_hdf_ld(hdf_filename, file_uri=file_uri, skipND=skipND)
31
+
32
+ if contextual:
33
+ graph = get_contextual_ld(hdf_filename, file_uri=file_uri)
34
+ if graph is None:
35
+ raise ValueError("structural and semantic cannot be both False.")
36
+ context = context or {}
37
+ for prefix, uri in context.items():
38
+ if not isinstance(uri, rdflib.URIRef):
39
+ graph.bind("ex", rdflib.URIRef(uri))
40
+ return graph
41
+
42
+
43
+ def hdf2jsonld(
44
+ filename: Union[str, pathlib.Path],
45
+ metadata_filename: Optional[Union[str, pathlib.Path]] = None,
46
+ context: Optional[dict] = None,
47
+ structural: bool = True,
48
+ contextual: bool = True,
49
+ indent: int = 2,
50
+ file_uri: Optional[str] = None,
51
+ skipND: Optional[int] = 1,
52
+ ):
53
+ if metadata_filename is None:
54
+ metadata_filename = pathlib.Path(filename).with_suffix('.jsonld') # recommended suffix for JSON-LD is .jsonld!
55
+ else:
56
+ metadata_filename = pathlib.Path(metadata_filename)
57
+
58
+ graph = get_ld(
59
+ hdf_filename=filename,
60
+ structural=structural,
61
+ contextual=contextual,
62
+ file_uri=file_uri,
63
+ skipND=skipND
64
+ )
65
+ context = context or {}
66
+ context = optimize_context(graph, context)
67
+
68
+ with open(metadata_filename, 'w', encoding='utf-8') as f:
69
+ f.write(
70
+ graph.serialize(format='json-ld',
71
+ indent=indent,
72
+ auto_compact=True,
73
+ context=context)
74
+ )
75
+
76
+ return metadata_filename
@@ -0,0 +1,3 @@
1
+ _CACHE = {
2
+ "FILE_MTIME_ID": {}
3
+ }
@@ -3,14 +3,20 @@ from ontolutils.namespacelib.hdf5 import HDF5
3
3
  from rdflib import Namespace, Literal
4
4
  from rdflib import XSD, RDF
5
5
 
6
+ from ..utils import get_attr_node
7
+
6
8
  HDF = Namespace(str(HDF5))
7
9
 
8
10
 
9
- def process_attribute(name, value, graph, parent_uri):
11
+ def process_attribute(*, name, value, graph, parent, parent_uri, blank_node_iri_base):
10
12
  """Process an HDF5 attribute, adding it to the RDF graph."""
11
13
  if name.isupper() or name.startswith('@'):
12
14
  return
13
- attr_uri = rdflib.BNode()
15
+ attr_uri = get_attr_node(
16
+ parent,
17
+ name,
18
+ blank_node_iri_base
19
+ )
14
20
 
15
21
  if isinstance(value, str):
16
22
  graph.add((attr_uri, RDF.type, HDF5.StringAttribute))
@@ -10,6 +10,7 @@ from rdflib import XSD, RDF
10
10
 
11
11
  from h5rdmtoolbox.convention.ontology.hdf_datatypes import get_datatype
12
12
  from h5rdmtoolbox.ld.hdf.attributes import process_attribute
13
+ from h5rdmtoolbox.ld.utils import get_property_node
13
14
 
14
15
  HDF = Namespace(str(HDF5))
15
16
  HDF5_FILTER_ONTOLOGY = {
@@ -71,11 +72,11 @@ def process_dataset(
71
72
  else:
72
73
  graph.add((dataset_uri, HDF5.maximumSize, rdflib.Literal(-1, datatype=XSD.integer)))
73
74
 
74
- datatype = get_datatype(dataset)
75
+ datatype_node = get_datatype(dataset)
75
76
 
76
- if datatype:
77
- graph.add((datatype, RDF.type, HDF5.Datatype))
78
- graph.add((dataset_uri, HDF5.datatype, datatype))
77
+ if datatype_node:
78
+ graph.add((datatype_node, RDF.type, HDF5.Datatype))
79
+ graph.add((dataset_uri, HDF5.datatype, datatype_node))
79
80
 
80
81
  is_string_dataset = False
81
82
  if dataset.dtype.kind == 'S':
@@ -97,22 +98,36 @@ def process_dataset(
97
98
  graph.add((dataset_uri, HDF5.layout, HDF5.H5D_VIRTUAL))
98
99
 
99
100
  if dataset.chunks:
100
- chunk_dimension_uri = rdflib.BNode()
101
+ chunk_dimension_uri = get_property_node(
102
+ dataset,
103
+ name='chunk_dimensions',
104
+ blank_node_iri_base=blank_node_iri_base
105
+ )
101
106
  graph.add((chunk_dimension_uri, RDF.type, HDF5.ChunkDimension))
102
107
  graph.add((dataset_uri, HDF5.chunk, chunk_dimension_uri))
103
108
 
104
109
  for ichunk, chunk in enumerate(dataset.chunks):
105
- dimension_index_uri = rdflib.BNode()
110
+ dimension_index_uri = get_property_node(
111
+ dataset,
112
+ name=f'chunk_dimension_{ichunk}',
113
+ blank_node_iri_base=blank_node_iri_base
114
+ )
106
115
  graph.add((dimension_index_uri, RDF.type, HDF5.DataspaceDimension))
107
116
  graph.add((chunk_dimension_uri, HDF5.dimension, dimension_index_uri))
108
117
  graph.add((dimension_index_uri, HDF5.size, rdflib.Literal(chunk, datatype=XSD.integer)))
109
118
  graph.add((dimension_index_uri, HDF5.dimensionIndex, rdflib.Literal(ichunk, datatype=XSD.integer)))
110
119
 
120
+ dataspace_uri = get_property_node(
121
+ obj=dataset, name='dataspace', blank_node_iri_base=blank_node_iri_base
122
+ )
111
123
  if dataset.ndim > 0:
112
- dataspace_uri = rdflib.BNode()
113
124
  graph.add((dataspace_uri, RDF.type, HDF5.SimpleDataspace))
114
125
  for idim, dim in enumerate(dataset.shape):
115
- dataspace_dimension_node = rdflib.BNode()
126
+ dataspace_dimension_node = get_property_node(
127
+ obj=dataset,
128
+ name=f'dataspace_dimension_{idim}',
129
+ blank_node_iri_base=blank_node_iri_base
130
+ )
116
131
  graph.add((dataspace_dimension_node, RDF.type, HDF5.DataspaceDimension))
117
132
  graph.add((dataspace_uri, HDF5.dimension, dataspace_dimension_node))
118
133
  graph.add((dataspace_dimension_node, HDF5.size, rdflib.Literal(dim, datatype=XSD.integer)))
@@ -125,8 +140,7 @@ def process_dataset(
125
140
  else:
126
141
  graph.add((dataset_uri, HDF5.value, rdflib.Literal(data)))
127
142
  else:
128
- dataspace_uri = HDF5.scalarDataspace
129
- graph.add((dataspace_uri, RDF.type, HDF5.scalarDataspace))
143
+ graph.add((dataspace_uri, RDF.type, HDF5.ScalarDataspace))
130
144
 
131
145
  if skipND and dataset.ndim < skipND:
132
146
  data = dataset[()]
@@ -139,4 +153,5 @@ def process_dataset(
139
153
 
140
154
  # Process attributes of the dataset
141
155
  for attr, value in dataset.attrs.items():
142
- process_attribute(attr, value, graph, dataset_uri)
156
+ process_attribute(name=attr, value=value, graph=graph, parent=dataset, parent_uri=dataset_uri,
157
+ blank_node_iri_base=blank_node_iri_base)
@@ -14,29 +14,30 @@ from ..utils import optimize_context, get_obj_bnode, get_file_bnode
14
14
  HDF = Namespace(str(HDF5))
15
15
 
16
16
 
17
- def get_ld(source: Union[str, h5py.File], blank_node_iri_base: Optional[str] = None,
17
+ def get_ld(source: Union[str, h5py.File],
18
+ file_uri: Optional[str] = None,
18
19
  skipND: int = 1) -> rdflib.Graph:
19
20
  """Convert an HDF5 file into an RDF graph."""
20
21
 
21
22
  if not isinstance(source, h5py.File):
22
23
  with h5py.File(source) as h5f:
23
- return get_ld(h5f, blank_node_iri_base=blank_node_iri_base, skipND=skipND)
24
+ return get_ld(h5f, file_uri=file_uri, skipND=skipND)
24
25
 
25
26
  graph = Graph()
26
27
  graph.bind("hdf", HDF)
27
28
 
28
29
  file_frdf_manager = FileRDFManager(source.attrs)
29
30
  if file_frdf_manager.subject:
30
- file_uri = rdflib.URIRef(file_frdf_manager.subject)
31
+ _file_uri = rdflib.URIRef(file_frdf_manager.subject)
31
32
  else:
32
- file_uri = get_file_bnode(source, blank_node_iri_base=blank_node_iri_base)
33
+ _file_uri = get_file_bnode(source, file_uri=file_uri)
33
34
 
34
- graph.add((file_uri, RDF.type, HDF.File))
35
+ graph.add((_file_uri, RDF.type, HDF.File))
35
36
 
36
- root_group_uri = get_obj_bnode(source["/"], blank_node_iri_base=blank_node_iri_base)
37
- graph.add((file_uri, HDF5.rootGroup, root_group_uri))
37
+ root_group_uri = get_obj_bnode(source["/"], blank_node_iri_base=file_uri)
38
+ graph.add((_file_uri, HDF5.rootGroup, root_group_uri))
38
39
 
39
- process_group(source["/"], graph, file_uri, blank_node_iri_base=blank_node_iri_base, skipND=skipND)
40
+ process_group(source["/"], graph, parent_uri=_file_uri, blank_node_iri_base=file_uri, skipND=skipND)
40
41
 
41
42
  return graph
42
43
 
@@ -13,7 +13,13 @@ from h5rdmtoolbox.ld.utils import get_obj_bnode
13
13
  HDF = Namespace(str(HDF5))
14
14
 
15
15
 
16
- def process_group(group, graph, parent_uri, blank_node_iri_base: Optional[str] = None, skipND: int = 1):
16
+ def process_group(
17
+ group,
18
+ graph,
19
+ parent_uri,
20
+ blank_node_iri_base: Optional[str] = None,
21
+ skipND: int = 1
22
+ ):
17
23
  """Recursively process HDF5 groups and datasets, adding them to the RDF graph."""
18
24
  group_uri = get_obj_bnode(group, blank_node_iri_base=blank_node_iri_base)
19
25
  graph.add((group_uri, RDF.type, HDF.Group))
@@ -25,10 +31,18 @@ def process_group(group, graph, parent_uri, blank_node_iri_base: Optional[str] =
25
31
  graph.add((group_uri, HDF.member, item_uri))
26
32
 
27
33
  if isinstance(item, h5py.Group):
28
- process_group(item, graph, group_uri, blank_node_iri_base=blank_node_iri_base)
34
+ process_group(item, graph, parent_uri=group_uri, blank_node_iri_base=blank_node_iri_base)
29
35
  elif isinstance(item, h5py.Dataset):
30
- process_dataset(item, graph, group_uri, item_uri, blank_node_iri_base=blank_node_iri_base, skipND=skipND)
36
+ process_dataset(
37
+ item,
38
+ graph,
39
+ parent_uri=group_uri,
40
+ dataset_uri=item_uri,
41
+ blank_node_iri_base=blank_node_iri_base,
42
+ skipND=skipND
43
+ )
31
44
 
32
45
  # Process attributes of the group
33
46
  for attr, value in group.attrs.items():
34
- process_attribute(attr, value, graph, group_uri)
47
+ process_attribute(name=attr, value=value, graph=graph, parent=group, parent_uri=group_uri,
48
+ blank_node_iri_base=blank_node_iri_base)
@@ -136,7 +136,7 @@ def set_object(attr: h5py.AttributeManager,
136
136
  iri_data_data = {}
137
137
 
138
138
  if isinstance(data, Thing):
139
- data = data.get_jsonld_dict(assign_bnode=False)
139
+ data = data.get_jsonld_dict()
140
140
  elif isinstance(data, dict):
141
141
  # assuming it is a JSON-LD dict
142
142
  if not "@type" in data:
@@ -1,5 +1,6 @@
1
1
  import json
2
2
  import warnings
3
+ from typing import Union
3
4
 
4
5
  import numpy as np
5
6
  import rdflib
@@ -9,7 +10,7 @@ from h5rdmtoolbox.ld.utils import get_attr_dtype_as_XSD, get_obj_bnode
9
10
  from ..rdf import FileRDFManager, RDFManager
10
11
 
11
12
 
12
- def process_file_attribute(parent_obj, name, data, graph, blank_node_iri_base, file_uri):
13
+ def process_file_attribute(parent_obj, name, data, graph, file_uri: Union[rdflib.URIRef, rdflib.BNode]):
13
14
  rdf_user_type = FileRDFManager(parent_obj.attrs).type
14
15
  if rdf_user_type is not None:
15
16
  if isinstance(rdf_user_type, (list, np.ndarray)):
@@ -48,18 +49,18 @@ def process_file_attribute(parent_obj, name, data, graph, blank_node_iri_base, f
48
49
  f"Error parsing JSON-LD object for attribute. name={name}, data={data}. Orig. Error: {e}")
49
50
 
50
51
  elif isinstance(rdf_user_object, dict):
51
- try:
52
- obj_graph = rdflib.Graph().parse(data=json.loads(json.dumps(rdf_user_object)), format="json-ld")
53
- # relate the obj_graph with the predicate:
54
- _subjects = set(obj_graph.subjects())
55
- if len(_subjects) != 1:
56
- warnings.warn(f"Error parsing JSON-LD object for attribute. name={name}, data={data}. "
57
- f"Expected exactly one subject, found {len(_subjects)}")
58
- obj_graph.add((file_uri, rdflib.URIRef(rdf_user_predicate), list(_subjects)[0]))
59
- graph += obj_graph
60
- except Exception as e:
61
- warnings.warn(
62
- f"Error parsing JSON-LD object for attribute. name={name}, data={data}. Orig. Error: {e}")
52
+ try:
53
+ obj_graph = rdflib.Graph().parse(data=json.loads(json.dumps(rdf_user_object)), format="json-ld")
54
+ # relate the obj_graph with the predicate:
55
+ _subjects = set(obj_graph.subjects())
56
+ if len(_subjects) != 1:
57
+ warnings.warn(f"Error parsing JSON-LD object for attribute. name={name}, data={data}. "
58
+ f"Expected exactly one subject, found {len(_subjects)}")
59
+ obj_graph.add((file_uri, rdflib.URIRef(rdf_user_predicate), list(_subjects)[0]))
60
+ graph += obj_graph
61
+ except Exception as e:
62
+ warnings.warn(
63
+ f"Error parsing JSON-LD object for attribute. name={name}, data={data}. Orig. Error: {e}")
63
64
  else:
64
65
  graph.add(
65
66
  (file_uri,
@@ -70,7 +71,6 @@ def process_file_attribute(parent_obj, name, data, graph, blank_node_iri_base, f
70
71
 
71
72
 
72
73
  def process_attribute(parent_obj, name, data, graph, blank_node_iri_base):
73
-
74
74
  rdf_manager = RDFManager(parent_obj.attrs)
75
75
 
76
76
  parent_uri = rdf_manager.subject