h5rdmtoolbox 2.0.0a0__tar.gz → 2.2.0__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.
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/PKG-INFO +59 -42
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/README.md +2 -2
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/__init__.py +36 -28
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/_repr.py +25 -1
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/generate.py +4 -1
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/ontology/hdf_datatypes.py +3 -3
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/standard_attributes.py +30 -4
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/data/tutorial_convention.yaml +7 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/database/__init__.py +1 -1
- h5rdmtoolbox-2.2.0/h5rdmtoolbox/ld/__init__.py +76 -0
- h5rdmtoolbox-2.2.0/h5rdmtoolbox/ld/globals.py +3 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/ld/hdf/attributes.py +8 -2
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/ld/hdf/datasets.py +26 -11
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/ld/hdf/file.py +9 -8
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/ld/hdf/groups.py +18 -4
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/ld/rdf.py +8 -2
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/ld/user/attributes.py +14 -14
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/ld/user/file.py +10 -10
- h5rdmtoolbox-2.2.0/h5rdmtoolbox/ld/utils.py +124 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/repository/interface.py +6 -36
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/wrapper/core.py +28 -20
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/wrapper/h5attr.py +38 -2
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/wrapper/jsonld.py +0 -3
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox.egg-info/PKG-INFO +59 -42
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox.egg-info/SOURCES.txt +2 -1
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox.egg-info/requires.txt +25 -8
- h5rdmtoolbox-2.2.0/pyproject.toml +6 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/setup.cfg +10 -9
- h5rdmtoolbox-2.0.0a0/tests/conventions/tutorial_convention_vfuncs.py → h5rdmtoolbox-2.2.0/tests/conventions/test_convention_vfuncs.py +22 -5
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/conventions/test_conventions.py +40 -3
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/database/test_hdfDB.py +1 -1
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/ld/test_ld.py +78 -34
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/ld/test_rdf.py +25 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/ld/test_user_graph.py +1 -1
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/repository/test_zenodo.py +23 -7
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/test_version.py +7 -2
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/wrapper/test_dump.py +3 -6
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/wrapper/test_namespaces.py +3 -2
- h5rdmtoolbox-2.0.0a0/h5rdmtoolbox/ld/__init__.py +0 -91
- h5rdmtoolbox-2.0.0a0/h5rdmtoolbox/ld/utils.py +0 -77
- h5rdmtoolbox-2.0.0a0/pyproject.toml +0 -6
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/LICENSE +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/_cfg.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/_version.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/cli.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/consts.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/__init__.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/cfg.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/consts.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/core.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/errors.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/ontology/__init__.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/ontology/h5ontocls.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/references.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/toolbox_validators.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/utils.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/data/def_icon.png +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/data/fluid-v1.yml +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/data/h5tbx.yaml +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/data/id_icon.png +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/data/iri_icon.png +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/data/ld_icon.png +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/data/piv-v1.yml +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/data/style.css +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/data/tutorial_standard_name_table.yaml +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/data/type_icon.png +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/database/hdfdb/__init__.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/database/hdfdb/filedb.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/database/hdfdb/objdb.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/database/hdfdb/query.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/database/hdfdb/utils.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/database/interface.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/database/lazy.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/database/mongo.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/errors.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/extensions/__init__.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/extensions/magnitude.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/extensions/normalize.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/extensions/onto.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/extensions/units.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/extensions/vector.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/gui/__init__.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/gui/fairify.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/gui/src/__init__.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/gui/src/main.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/identifiers.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/layout/__init__.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/layout/core.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/ld/hdf/__init__.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/ld/user/__init__.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/ld/user/datasets.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/ld/user/groups.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/plotting.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/protected_attributes.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/protocols.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/repository/__init__.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/repository/utils.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/repository/zenodo/__init__.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/repository/zenodo/core.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/repository/zenodo/metadata.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/repository/zenodo/tokens.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/repository/zenodo/utils.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/tutorial.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/user.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/utils.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/wrapper/__init__.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/wrapper/accessor.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/wrapper/accessors/__init__.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/wrapper/accessors/provenance.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/wrapper/ds_decoder.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/wrapper/h5ext.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/wrapper/h5utils.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/wrapper/h5yaml.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/wrapper/xr2hdf.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox.egg-info/dependency_links.txt +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox.egg-info/entry_points.txt +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox.egg-info/top_level.txt +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/setup.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/__init__.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/clean_zenodo_sandbox.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/conventions/__init__.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/conventions/test_engmeta.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/conventions/test_references.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/conventions/test_toolbox_validators.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/conventions/test_utils.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/database/__init__.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/database/test_find_rdf.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/database/test_mongo.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/layouts/__init__.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/layouts/test_core.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/layouts/test_docs.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/ld/__init__.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/repository/__init__.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/test_cli.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/test_config.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/test_extensions.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/test_identifiers.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/test_plotting.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/test_repr.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/test_user.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/test_utils.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/test_xarray_export.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/wrapper/__init__.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/wrapper/test_core.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/wrapper/test_file.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/wrapper/test_h5ext.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/wrapper/test_lazy.py +0 -0
- {h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/tests/wrapper/test_xr2df.py +0 -0
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: h5rdmtoolbox
|
|
3
|
-
Version: 2.0
|
|
3
|
+
Version: 2.2.0
|
|
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
|
|
7
7
|
Author-email: matth.probst@gmail.com
|
|
8
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
9
8
|
Classifier: Programming Language :: Python :: 3.9
|
|
10
9
|
Classifier: Programming Language :: Python :: 3.10
|
|
11
10
|
Classifier: Programming Language :: Python :: 3.11
|
|
@@ -14,22 +13,22 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
14
13
|
Classifier: Operating System :: OS Independent
|
|
15
14
|
Classifier: Development Status :: 4 - Beta
|
|
16
15
|
Classifier: Topic :: Scientific/Engineering
|
|
17
|
-
Requires-Python: <3.13,>=3.
|
|
16
|
+
Requires-Python: <3.13,>=3.9
|
|
18
17
|
Description-Content-Type: text/markdown
|
|
19
18
|
License-File: LICENSE
|
|
20
19
|
Requires-Dist: appdirs>=1.4.4
|
|
21
|
-
Requires-Dist: importlib_resources
|
|
20
|
+
Requires-Dist: importlib_resources<7.0.0,>=6.5.2
|
|
22
21
|
Requires-Dist: numpy<2.0.0,>=1.20
|
|
23
|
-
Requires-Dist: h5py
|
|
22
|
+
Requires-Dist: h5py<4.0.0,>=3.8.0
|
|
24
23
|
Requires-Dist: matplotlib>=3.5.2
|
|
25
24
|
Requires-Dist: IPython>=7.34.0
|
|
26
|
-
Requires-Dist: pyyaml
|
|
25
|
+
Requires-Dist: pyyaml>=6.0
|
|
27
26
|
Requires-Dist: xarray>=2022.3.0
|
|
28
27
|
Requires-Dist: pint==0.21.1
|
|
29
|
-
Requires-Dist: pint_xarray
|
|
28
|
+
Requires-Dist: pint_xarray<=0.4.0,>=0.2.1
|
|
30
29
|
Requires-Dist: regex>=2020.7.9
|
|
31
30
|
Requires-Dist: packaging>=24.1
|
|
32
|
-
Requires-Dist: ontolutils
|
|
31
|
+
Requires-Dist: ontolutils<=1.0.0,>=0.13.3
|
|
33
32
|
Requires-Dist: python-forge==18.6.0
|
|
34
33
|
Requires-Dist: requests>=2.32.3
|
|
35
34
|
Requires-Dist: pydantic>=2.8.2
|
|
@@ -53,7 +52,7 @@ Requires-Dist: pytest>=8.3.3; extra == "test"
|
|
|
53
52
|
Requires-Dist: pytest-cov>=5.0.0; extra == "test"
|
|
54
53
|
Requires-Dist: pylint; extra == "test"
|
|
55
54
|
Requires-Dist: scikit-image; extra == "test"
|
|
56
|
-
Requires-Dist: ssnolib>=1.5.
|
|
55
|
+
Requires-Dist: ssnolib>=1.5.1.2; extra == "test"
|
|
57
56
|
Requires-Dist: mongomock==4.1.2; extra == "test"
|
|
58
57
|
Requires-Dist: xmltodict<=0.13.0; extra == "test"
|
|
59
58
|
Requires-Dist: scipy>=1.10.1; extra == "test"
|
|
@@ -75,7 +74,7 @@ Requires-Dist: pytest>=8.3.3; extra == "docs"
|
|
|
75
74
|
Requires-Dist: pytest-cov>=5.0.0; extra == "docs"
|
|
76
75
|
Requires-Dist: pylint; extra == "docs"
|
|
77
76
|
Requires-Dist: scikit-image; extra == "docs"
|
|
78
|
-
Requires-Dist: ssnolib>=1.5.
|
|
77
|
+
Requires-Dist: ssnolib>=1.5.1.2; extra == "docs"
|
|
79
78
|
Requires-Dist: mongomock==4.1.2; extra == "docs"
|
|
80
79
|
Requires-Dist: xmltodict<=0.13.0; extra == "docs"
|
|
81
80
|
Requires-Dist: scipy>=1.10.1; extra == "docs"
|
|
@@ -101,7 +100,7 @@ Requires-Dist: pytest>=8.3.3; extra == "complete"
|
|
|
101
100
|
Requires-Dist: pytest-cov>=5.0.0; extra == "complete"
|
|
102
101
|
Requires-Dist: pylint; extra == "complete"
|
|
103
102
|
Requires-Dist: scikit-image; extra == "complete"
|
|
104
|
-
Requires-Dist: ssnolib>=1.5.
|
|
103
|
+
Requires-Dist: ssnolib>=1.5.1.2; extra == "complete"
|
|
105
104
|
Requires-Dist: mongomock==4.1.2; extra == "complete"
|
|
106
105
|
Requires-Dist: xmltodict<=0.13.0; extra == "complete"
|
|
107
106
|
Requires-Dist: scipy>=1.10.1; extra == "complete"
|
|
@@ -112,43 +111,61 @@ Requires-Dist: tabulate<=0.9.0,>=0.8.10; extra == "complete"
|
|
|
112
111
|
Requires-Dist: python-gitlab; extra == "complete"
|
|
113
112
|
Requires-Dist: pypandoc>=1.11; extra == "complete"
|
|
114
113
|
Requires-Dist: pymongo<=4.10.1,>=4.2.0; extra == "complete"
|
|
115
|
-
|
|
116
|
-
Requires-Dist:
|
|
117
|
-
Requires-Dist:
|
|
118
|
-
Requires-Dist:
|
|
119
|
-
Requires-Dist:
|
|
120
|
-
Requires-Dist:
|
|
121
|
-
Requires-Dist:
|
|
122
|
-
Requires-Dist:
|
|
123
|
-
Requires-Dist:
|
|
124
|
-
Requires-Dist:
|
|
125
|
-
Requires-Dist:
|
|
126
|
-
Requires-Dist:
|
|
127
|
-
Requires-Dist:
|
|
128
|
-
Requires-Dist:
|
|
129
|
-
Requires-Dist:
|
|
130
|
-
Requires-Dist:
|
|
131
|
-
Requires-Dist:
|
|
132
|
-
Requires-Dist:
|
|
133
|
-
Requires-Dist:
|
|
134
|
-
Requires-Dist:
|
|
135
|
-
Requires-Dist:
|
|
136
|
-
Requires-Dist:
|
|
137
|
-
Requires-Dist:
|
|
138
|
-
Requires-Dist:
|
|
139
|
-
Requires-Dist:
|
|
140
|
-
Requires-Dist:
|
|
141
|
-
Requires-Dist:
|
|
142
|
-
Requires-Dist: scikit-image
|
|
143
|
-
Requires-Dist:
|
|
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"
|
|
144
161
|
Dynamic: license-file
|
|
145
162
|
|
|
146
163
|
# HDF5 Research Data Management Toolbox
|
|
147
164
|
|
|
148
165
|

|
|
149
|
-
](https://codecov.io/gh/matthiasprobst/h5RDMtoolbox)
|
|
150
167
|
[](https://h5rdmtoolbox.readthedocs.io/en/latest/?badge=latest)
|
|
151
|
-

|
|
152
169
|
|
|
153
170
|
*Note, that the project is still under development!*
|
|
154
171
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# HDF5 Research Data Management Toolbox
|
|
2
2
|
|
|
3
3
|

|
|
4
|
-
](https://codecov.io/gh/matthiasprobst/h5RDMtoolbox)
|
|
5
5
|
[](https://h5rdmtoolbox.readthedocs.io/en/latest/?badge=latest)
|
|
6
|
-

|
|
7
7
|
|
|
8
8
|
*Note, that the project is still under development!*
|
|
9
9
|
|
|
@@ -129,44 +129,53 @@ def get_ld(
|
|
|
129
129
|
structural: bool = True,
|
|
130
130
|
contextual: bool = True,
|
|
131
131
|
skipND: int = 1,
|
|
132
|
-
|
|
133
|
-
|
|
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,
|
|
137
|
-
|
|
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
|
-
|
|
147
|
-
|
|
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
|
-
|
|
155
|
-
skipND=skipND
|
|
156
|
-
**kwargs)
|
|
160
|
+
file_uri=file_uri,
|
|
161
|
+
skipND=skipND)
|
|
157
162
|
context = optimize_context(graph, context)
|
|
158
|
-
return graph.serialize(
|
|
159
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
202
|
-
raise ValueError('At least one of structural or
|
|
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
|
|
206
|
-
return get_serialized_ld(hdf_filename, blank_node_iri_base, format="json-ld", context=context,
|
|
207
|
-
|
|
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
|
-
|
|
225
|
-
|
|
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
|
-
|
|
235
|
-
|
|
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,
|
|
@@ -585,12 +585,14 @@ class HDF5StructureHTMLRepr(_HDF5StructureRepr):
|
|
|
585
585
|
|
|
586
586
|
def __attrs__(self, name, h5obj):
|
|
587
587
|
attr_value = h5obj.attrs.raw[name]
|
|
588
|
+
is_root_group = h5obj.name == "/"
|
|
588
589
|
try:
|
|
589
590
|
if isinstance(attr_value, np.bytes_):
|
|
590
591
|
try:
|
|
591
592
|
attr_value = attr_value.decode('utf-8')
|
|
592
593
|
except UnicodeDecodeError:
|
|
593
594
|
warnings.warn(f'Cannot decode attribute value for {name}', RuntimeWarning)
|
|
595
|
+
|
|
594
596
|
rdf = h5obj.rdf.get(name)
|
|
595
597
|
|
|
596
598
|
disp_name = name
|
|
@@ -599,11 +601,22 @@ class HDF5StructureHTMLRepr(_HDF5StructureRepr):
|
|
|
599
601
|
if rdf_predicate is not None:
|
|
600
602
|
disp_name += get_iri_icon_href(rdf_predicate, icon_url=IRI_ICON)
|
|
601
603
|
|
|
604
|
+
if is_root_group:
|
|
605
|
+
frdf = h5obj.frdf.get(name)
|
|
606
|
+
frdf_predicate = frdf.predicate
|
|
607
|
+
if frdf_predicate is not None:
|
|
608
|
+
disp_name += get_iri_icon_href(frdf_predicate, icon_url=IRI_ICON)
|
|
609
|
+
|
|
602
610
|
attrs_def = h5obj.rdf[name].definition
|
|
603
611
|
if attrs_def is not None:
|
|
604
612
|
disp_name += get_def_icon_href(attrs_def)
|
|
605
613
|
|
|
606
614
|
rdf_object = rdf.object
|
|
615
|
+
if is_root_group:
|
|
616
|
+
frdf_object = frdf.object
|
|
617
|
+
else:
|
|
618
|
+
frdf_object = None
|
|
619
|
+
|
|
607
620
|
|
|
608
621
|
if isinstance(attr_value, ndarray):
|
|
609
622
|
|
|
@@ -619,6 +632,8 @@ class HDF5StructureHTMLRepr(_HDF5StructureRepr):
|
|
|
619
632
|
|
|
620
633
|
if rdf_object is not None:
|
|
621
634
|
_value_str += get_iri_icon_href(rdf_object, icon_url=IRI_ICON)
|
|
635
|
+
if frdf_object is not None:
|
|
636
|
+
_value_str += get_iri_icon_href(frdf_object, icon_url=IRI_ICON)
|
|
622
637
|
return '<li style="list-style-type: none; ' \
|
|
623
638
|
f'font-style: italic">{disp_name}: {_value_str}</li>'
|
|
624
639
|
else:
|
|
@@ -628,7 +643,9 @@ class HDF5StructureHTMLRepr(_HDF5StructureRepr):
|
|
|
628
643
|
_value = f'{_value[0:self.max_attr_length]}...'
|
|
629
644
|
|
|
630
645
|
if rdf_object is not None:
|
|
631
|
-
_value += get_iri_icon_href(
|
|
646
|
+
_value += get_iri_icon_href(rdf_object, icon_url=IRI_ICON)
|
|
647
|
+
if frdf_object is not None:
|
|
648
|
+
_value += get_iri_icon_href(frdf_object, icon_url=IRI_ICON)
|
|
632
649
|
|
|
633
650
|
return f'<li style="list-style-type: none; font-style: italic">{disp_name}: {_value}</li>'
|
|
634
651
|
|
|
@@ -654,6 +671,8 @@ class HDF5StructureHTMLRepr(_HDF5StructureRepr):
|
|
|
654
671
|
# add rdf icon if available:
|
|
655
672
|
if rdf_object is not None:
|
|
656
673
|
_value_html += get_iri_icon_href(rdf_object, icon_url=IRI_ICON)
|
|
674
|
+
if frdf_object is not None:
|
|
675
|
+
_value_html += get_iri_icon_href(frdf_object, icon_url=IRI_ICON)
|
|
657
676
|
|
|
658
677
|
if is_url and not _value_html.startswith('{'): # TODO: why the second condition?
|
|
659
678
|
return f'<li style="list-style-type: none; font-style: italic">{disp_name}: {_value_html}</li>'
|
|
@@ -667,6 +686,8 @@ class HDF5StructureHTMLRepr(_HDF5StructureRepr):
|
|
|
667
686
|
_value_str = attr_value
|
|
668
687
|
if rdf_object is not None:
|
|
669
688
|
_value_str += get_iri_icon_href(rdf_object, icon_url=IRI_ICON)
|
|
689
|
+
if frdf_object is not None:
|
|
690
|
+
_value_str += get_iri_icon_href(frdf_object, icon_url=IRI_ICON)
|
|
670
691
|
return f'<li style="list-style-type: none; font-style: italic">{disp_name}: {_value_str}</li>'
|
|
671
692
|
|
|
672
693
|
elif not isinstance(attr_value, ndarray):
|
|
@@ -688,8 +709,11 @@ class HDF5StructureHTMLRepr(_HDF5StructureRepr):
|
|
|
688
709
|
|
|
689
710
|
if rdf_object is not None:
|
|
690
711
|
_value_str += get_iri_icon_href(rdf_object, icon_url=IRI_ICON)
|
|
712
|
+
if frdf_object is not None:
|
|
713
|
+
_value_str += get_iri_icon_href(frdf_object, icon_url=IRI_ICON)
|
|
691
714
|
|
|
692
715
|
return f'<li style="list-style-type: none; font-style: italic">{name}: {_value_str}</li>'
|
|
716
|
+
|
|
693
717
|
except Exception as e:
|
|
694
718
|
return f'<li style="list-style-type: none; font-style: italic">{name}: {attr_value}</li>'
|
|
695
719
|
|
|
@@ -193,7 +193,7 @@ def write_convention_module_from_yaml(yaml_filename: pathlib.Path, name=None):
|
|
|
193
193
|
_default_value = v.get('default_value', '$EMPTY')
|
|
194
194
|
|
|
195
195
|
# it is not allowed to have a dash in the class name.
|
|
196
|
-
# However it was needed to have standard attribute with the same name for different methods
|
|
196
|
+
# However, it was needed to have standard attribute with the same name for different methods
|
|
197
197
|
class_name = k.replace('-', '_')
|
|
198
198
|
attr_name = k.rsplit('-', 1)[0]
|
|
199
199
|
f.write(f'\nclass {class_name}(BaseModel):')
|
|
@@ -241,6 +241,9 @@ def write_convention_module_from_yaml(yaml_filename: pathlib.Path, name=None):
|
|
|
241
241
|
name='{kk}',
|
|
242
242
|
description={_str_getter(vv, 'description', None)},
|
|
243
243
|
validator={_validator.replace('-', '_')},
|
|
244
|
+
alternative_standard_attribute={_str_getter(vv, 'alternative_standard_attribute', None)},
|
|
245
|
+
rdf_predicate={_str_getter(vv, 'rdf_predicate', None)},
|
|
246
|
+
frdf_predicate={_str_getter(vv, 'frdf_predicate', None)},
|
|
244
247
|
target_method={_str_getter(vv, 'target_method')},
|
|
245
248
|
default_value={_default_value_str},
|
|
246
249
|
requirements={_str_getter(vv, 'requirements', None)},
|
{h5rdmtoolbox-2.0.0a0 → h5rdmtoolbox-2.2.0}/h5rdmtoolbox/convention/ontology/hdf_datatypes.py
RENAMED
|
@@ -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
|
-
|
|
64
|
-
return ontology_type
|
|
64
|
+
return HDF5_DATATYPE_MAP.get((np_type, endianness), None)
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"""standard attribute module"""
|
|
2
|
-
import h5py
|
|
3
2
|
import json
|
|
4
3
|
import logging
|
|
5
|
-
import pydantic
|
|
6
|
-
import typing_extensions
|
|
7
4
|
import warnings
|
|
8
5
|
from typing import Dict, List, Union
|
|
9
6
|
|
|
7
|
+
import h5py
|
|
8
|
+
import pydantic
|
|
9
|
+
import typing_extensions
|
|
10
|
+
from pydantic import HttpUrl
|
|
11
|
+
|
|
10
12
|
from . import errors
|
|
11
13
|
from .consts import DefaultValue
|
|
12
14
|
from .. import get_config
|
|
@@ -74,6 +76,8 @@ class StandardAttribute:
|
|
|
74
76
|
position: Union[None, Dict[str, str]] = None,
|
|
75
77
|
requirements: List[str] = None,
|
|
76
78
|
type_hint: str = None,
|
|
79
|
+
rdf_predicate: str = None,
|
|
80
|
+
frdf_predicate: str = None,
|
|
77
81
|
**kwargs):
|
|
78
82
|
# name of attribute:
|
|
79
83
|
self.name = name.split('-', 1)[0] # the attrs key
|
|
@@ -98,6 +102,23 @@ class StandardAttribute:
|
|
|
98
102
|
f'Valid target methods are: {self.VALID_TARGET_METHODS}.')
|
|
99
103
|
self.target_method = target_method
|
|
100
104
|
|
|
105
|
+
if rdf_predicate is not None:
|
|
106
|
+
try:
|
|
107
|
+
HttpUrl(rdf_predicate)
|
|
108
|
+
except pydantic.ValidationError:
|
|
109
|
+
raise TypeError(f'rdf_predicate must be a valid URL. Got {rdf_predicate} instead.')
|
|
110
|
+
if frdf_predicate is not None:
|
|
111
|
+
try:
|
|
112
|
+
HttpUrl(frdf_predicate)
|
|
113
|
+
except pydantic.ValidationError:
|
|
114
|
+
raise TypeError(f'rdf_predicate must be a valid URL. Got {frdf_predicate} instead.')
|
|
115
|
+
self.rdf_predicate = rdf_predicate
|
|
116
|
+
self.frdf_predicate = frdf_predicate
|
|
117
|
+
if frdf_predicate is not None and target_method != "__init__":
|
|
118
|
+
raise ValueError(
|
|
119
|
+
f'frdf_predicate is only supported for the __init__ method. Got {target_method} instead.'
|
|
120
|
+
)
|
|
121
|
+
|
|
101
122
|
# The default value
|
|
102
123
|
if isinstance(default_value, str):
|
|
103
124
|
_default_value = default_value.lower()
|
|
@@ -220,10 +241,15 @@ class StandardAttribute:
|
|
|
220
241
|
f'Expected fields: {self.validator.model_fields}\nPydantic error: {err}')
|
|
221
242
|
validated_value = getattr(_validated_value, key0)
|
|
222
243
|
|
|
223
|
-
|
|
244
|
+
ret = super(type(parent.attrs), parent.attrs).__setitem__(
|
|
224
245
|
self.name,
|
|
225
246
|
parse_object_for_attribute_setting(validated_value)
|
|
226
247
|
)
|
|
248
|
+
if self.rdf_predicate is not None:
|
|
249
|
+
parent.rdf[self.name].predicate = self.rdf_predicate
|
|
250
|
+
if self.frdf_predicate is not None:
|
|
251
|
+
parent.frdf[self.name].predicate = self.frdf_predicate
|
|
252
|
+
return ret
|
|
227
253
|
|
|
228
254
|
def get(self, parent: Union[h5py.File, h5py.Group, h5py.Dataset]):
|
|
229
255
|
"""Read the attribute from `parent`
|
|
@@ -19,12 +19,19 @@ units:
|
|
|
19
19
|
validator: $units
|
|
20
20
|
description: The physical unit of the dataset. If dimensionless, the unit is ''.
|
|
21
21
|
|
|
22
|
+
title:
|
|
23
|
+
description: Title of the HDF5 file acting as a minimal description of the dataset.
|
|
24
|
+
target_method: __init__
|
|
25
|
+
validator: str
|
|
26
|
+
frdf_predicate: https://schema.org/title
|
|
27
|
+
|
|
22
28
|
standard_name:
|
|
23
29
|
target_method: create_dataset
|
|
24
30
|
validator: $standardNameType
|
|
25
31
|
requirements: units
|
|
26
32
|
description: Standard name of the dataset. If not set, the long_name attribute must be given.
|
|
27
33
|
alternative_standard_attribute: long_name
|
|
34
|
+
default_value: $EMPTY
|
|
28
35
|
|
|
29
36
|
standard_name_table:
|
|
30
37
|
target_method: __init__
|
|
@@ -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
|
|
@@ -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 =
|
|
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))
|