h5rdmtoolbox 2.5.1__tar.gz → 2.5.2__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.5.1 → h5rdmtoolbox-2.5.2}/PKG-INFO +7 -7
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/__init__.py +0 -5
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/convention/core.py +3 -10
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/ld/__init__.py +2 -2
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/ld/rdf.py +38 -15
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/ld/user/attributes.py +53 -28
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/ld/user/file.py +8 -7
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/ld/user/groups.py +6 -5
- h5rdmtoolbox-2.5.2/h5rdmtoolbox/ld/user/utils.py +8 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/repository/zenodo/core.py +159 -89
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/wrapper/core.py +17 -8
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox.egg-info/PKG-INFO +7 -7
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox.egg-info/SOURCES.txt +1 -2
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox.egg-info/requires.txt +5 -5
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/setup.cfg +3 -3
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/conventions/test_convention_vfuncs.py +2 -1
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/ld/test_rdf.py +188 -6
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/ld/test_user_graph.py +10 -7
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/repository/test_zenodo.py +30 -18
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/test_version.py +4 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/wrapper/test_core.py +21 -7
- h5rdmtoolbox-2.5.1/h5rdmtoolbox/repository/zenodo/dcat.py +0 -285
- h5rdmtoolbox-2.5.1/h5rdmtoolbox/repository/zenodo/foaf.py +0 -194
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/LICENSE +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/README.md +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/_cfg.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/_repr.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/_version.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/cli.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/consts.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/convention/__init__.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/convention/cfg.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/convention/consts.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/convention/errors.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/convention/generate.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/convention/ontology/__init__.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/convention/ontology/h5ontocls.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/convention/ontology/hdf_datatypes.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/convention/references.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/convention/standard_attributes.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/convention/toolbox_validators.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/convention/utils.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/data/def_icon.png +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/data/fluid-v1.yml +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/data/h5tbx.yaml +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/data/id_icon.png +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/data/iri_icon.png +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/data/ld_icon.png +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/data/piv-v1.yml +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/data/style.css +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/data/tutorial_convention.yaml +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/data/tutorial_standard_name_table.yaml +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/data/type_icon.png +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/database/__init__.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/database/hdfdb/__init__.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/database/hdfdb/filedb.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/database/hdfdb/objdb.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/database/hdfdb/query.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/database/hdfdb/utils.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/database/interface.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/database/lazy.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/database/mongo.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/errors.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/extensions/__init__.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/extensions/magnitude.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/extensions/normalize.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/extensions/onto.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/extensions/units.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/extensions/vector.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/gui/__init__.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/gui/fairify.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/gui/src/__init__.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/gui/src/main.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/identifiers.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/layout/__init__.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/layout/core.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/ld/globals.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/ld/hdf/__init__.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/ld/hdf/attributes.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/ld/hdf/datasets.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/ld/hdf/file.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/ld/hdf/groups.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/ld/shacl.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/ld/user/__init__.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/ld/user/datasets.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/ld/utils.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/plotting.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/protected_attributes.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/protocols.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/repository/__init__.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/repository/default_metamapper.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/repository/interface.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/repository/utils.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/repository/zenodo/__init__.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/repository/zenodo/metadata.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/repository/zenodo/tokens.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/repository/zenodo/utils.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/tutorial.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/user.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/utils.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/wrapper/__init__.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/wrapper/accessor.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/wrapper/accessors/__init__.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/wrapper/accessors/provenance.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/wrapper/ds_decoder.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/wrapper/h5attr.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/wrapper/h5ext.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/wrapper/h5utils.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/wrapper/h5yaml.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/wrapper/jsonld.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox/wrapper/xr2hdf.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox.egg-info/dependency_links.txt +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox.egg-info/entry_points.txt +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/h5rdmtoolbox.egg-info/top_level.txt +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/pyproject.toml +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/setup.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/__init__.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/clean_zenodo_sandbox.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/conventions/__init__.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/conventions/test_conventions.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/conventions/test_engmeta.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/conventions/test_references.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/conventions/test_toolbox_validators.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/conventions/test_utils.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/database/__init__.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/database/test_find_rdf.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/database/test_hdfDB.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/database/test_mongo.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/layouts/__init__.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/layouts/test_core.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/layouts/test_docs.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/ld/__init__.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/ld/test_ld.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/ld/test_shacl.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/ld/test_utils.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/repository/__init__.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/test_cli.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/test_config.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/test_extensions.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/test_identifiers.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/test_plotting.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/test_repr.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/test_user.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/test_utils.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/test_xarray_export.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/wrapper/__init__.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/wrapper/test_dump.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/wrapper/test_file.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/wrapper/test_h5ext.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/wrapper/test_lazy.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/wrapper/test_namespaces.py +0 -0
- {h5rdmtoolbox-2.5.1 → h5rdmtoolbox-2.5.2}/tests/wrapper/test_xr2df.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: h5rdmtoolbox
|
|
3
|
-
Version: 2.5.
|
|
3
|
+
Version: 2.5.2
|
|
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
|
|
@@ -29,7 +29,7 @@ Requires-Dist: pint>=0.24.4
|
|
|
29
29
|
Requires-Dist: pint_xarray<=0.6.0,>=0.2.1
|
|
30
30
|
Requires-Dist: regex>=2020.7.9
|
|
31
31
|
Requires-Dist: packaging>=24.1
|
|
32
|
-
Requires-Dist: ontolutils<1.0.0,>=0.
|
|
32
|
+
Requires-Dist: ontolutils<1.0.0,>=0.22.1
|
|
33
33
|
Requires-Dist: python-forge==18.6.0
|
|
34
34
|
Requires-Dist: requests>=2.32.4
|
|
35
35
|
Requires-Dist: pydantic~=2.8
|
|
@@ -54,7 +54,7 @@ Provides-Extra: test
|
|
|
54
54
|
Requires-Dist: pytest>=8.3.3; extra == "test"
|
|
55
55
|
Requires-Dist: pytest-cov>=5.0.0; extra == "test"
|
|
56
56
|
Requires-Dist: pylint; extra == "test"
|
|
57
|
-
Requires-Dist: ssnolib
|
|
57
|
+
Requires-Dist: ssnolib<3.0.0,>=2.1.0.2; extra == "test"
|
|
58
58
|
Requires-Dist: mongomock==4.1.2; extra == "test"
|
|
59
59
|
Requires-Dist: xmltodict<=0.13.0; extra == "test"
|
|
60
60
|
Requires-Dist: scipy>=1.10.1; extra == "test"
|
|
@@ -76,7 +76,7 @@ Requires-Dist: pymongo<=4.10.1,>=4.2.0; extra == "docs"
|
|
|
76
76
|
Requires-Dist: pytest>=8.3.3; extra == "docs"
|
|
77
77
|
Requires-Dist: pytest-cov>=5.0.0; extra == "docs"
|
|
78
78
|
Requires-Dist: pylint; extra == "docs"
|
|
79
|
-
Requires-Dist: ssnolib
|
|
79
|
+
Requires-Dist: ssnolib<3.0.0,>=2.1.0.2; extra == "docs"
|
|
80
80
|
Requires-Dist: mongomock==4.1.2; extra == "docs"
|
|
81
81
|
Requires-Dist: xmltodict<=0.13.0; extra == "docs"
|
|
82
82
|
Requires-Dist: scipy>=1.10.1; extra == "docs"
|
|
@@ -102,7 +102,7 @@ Requires-Dist: PyQt5==5.15.10; extra == "complete"
|
|
|
102
102
|
Requires-Dist: pytest>=8.3.3; extra == "complete"
|
|
103
103
|
Requires-Dist: pytest-cov>=5.0.0; extra == "complete"
|
|
104
104
|
Requires-Dist: pylint; extra == "complete"
|
|
105
|
-
Requires-Dist: ssnolib
|
|
105
|
+
Requires-Dist: ssnolib<3.0.0,>=2.1.0.2; extra == "complete"
|
|
106
106
|
Requires-Dist: mongomock==4.1.2; extra == "complete"
|
|
107
107
|
Requires-Dist: xmltodict<=0.13.0; extra == "complete"
|
|
108
108
|
Requires-Dist: scipy>=1.10.1; extra == "complete"
|
|
@@ -120,7 +120,7 @@ Requires-Dist: PyQt5==5.15.10; extra == "complete-with-docs"
|
|
|
120
120
|
Requires-Dist: pytest>=8.3.3; extra == "complete-with-docs"
|
|
121
121
|
Requires-Dist: pytest-cov>=5.0.0; extra == "complete-with-docs"
|
|
122
122
|
Requires-Dist: pylint; extra == "complete-with-docs"
|
|
123
|
-
Requires-Dist: ssnolib
|
|
123
|
+
Requires-Dist: ssnolib<3.0.0,>=2.1.0.2; extra == "complete-with-docs"
|
|
124
124
|
Requires-Dist: mongomock==4.1.2; extra == "complete-with-docs"
|
|
125
125
|
Requires-Dist: xmltodict<=0.13.0; extra == "complete-with-docs"
|
|
126
126
|
Requires-Dist: scipy>=1.10.1; extra == "complete-with-docs"
|
|
@@ -141,7 +141,7 @@ Requires-Dist: pymongo<=4.10.1,>=4.2.0; extra == "complete-with-docs"
|
|
|
141
141
|
Requires-Dist: pytest>=8.3.3; extra == "complete-with-docs"
|
|
142
142
|
Requires-Dist: pytest-cov>=5.0.0; extra == "complete-with-docs"
|
|
143
143
|
Requires-Dist: pylint; extra == "complete-with-docs"
|
|
144
|
-
Requires-Dist: ssnolib
|
|
144
|
+
Requires-Dist: ssnolib<3.0.0,>=2.1.0.2; extra == "complete-with-docs"
|
|
145
145
|
Requires-Dist: mongomock==4.1.2; extra == "complete-with-docs"
|
|
146
146
|
Requires-Dist: xmltodict<=0.13.0; extra == "complete-with-docs"
|
|
147
147
|
Requires-Dist: scipy>=1.10.1; extra == "complete-with-docs"
|
|
@@ -285,11 +285,6 @@ def serialize(hdf_filename,
|
|
|
285
285
|
**kwargs):
|
|
286
286
|
"""Alternative to json-ld but allows multiple serialization options"""
|
|
287
287
|
fmt = kwargs.pop("format", fmt)
|
|
288
|
-
if file_uri is None:
|
|
289
|
-
warnings.warn(
|
|
290
|
-
"Not providing a file-uri is not good practice because it will generate blank nodes. Consider providing an URI such as the DOI URL for example.",
|
|
291
|
-
category=UserWarning
|
|
292
|
-
)
|
|
293
288
|
with File(hdf_filename) as h5:
|
|
294
289
|
return h5.serialize(fmt=fmt,
|
|
295
290
|
skipND=skipND,
|
|
@@ -512,7 +512,7 @@ def _import_convention(convention_name) -> "module":
|
|
|
512
512
|
try:
|
|
513
513
|
return importlib.import_module(f'{convention_name}')
|
|
514
514
|
except ImportError:
|
|
515
|
-
|
|
515
|
+
logger.error(f"Failed to import module {convention_name}. Most likely the created convention file is erroneous.")
|
|
516
516
|
|
|
517
517
|
|
|
518
518
|
def _get_convention_from_dir(convention_name: str) -> "Convention":
|
|
@@ -523,6 +523,7 @@ def _get_convention_from_dir(convention_name: str) -> "Convention":
|
|
|
523
523
|
_convention_py_filename = CV_DIR / f'{_convention_name}' / f'{_convention_name}.py'
|
|
524
524
|
if not _convention_py_filename.exists():
|
|
525
525
|
raise ConventionNotFound(f'Convention "{convention_name}" not found.')
|
|
526
|
+
logger.debug(f"Adding path {_convention_py_filename.parent.absolute()} to system path...")
|
|
526
527
|
sys.path.insert(0, str(_convention_py_filename.parent))
|
|
527
528
|
# import:
|
|
528
529
|
_import_convention(_convention_name)
|
|
@@ -611,15 +612,6 @@ def get_registered_conventions() -> Dict:
|
|
|
611
612
|
"""Return dictionary of registered convention"""
|
|
612
613
|
return cfg._registered_conventions
|
|
613
614
|
|
|
614
|
-
|
|
615
|
-
# unused:
|
|
616
|
-
# def register_convention(new_convention: Convention) -> None:
|
|
617
|
-
# """Return dictionary of registered convention"""
|
|
618
|
-
# if new_convention in cfg._registered_conventions:
|
|
619
|
-
# raise ValueError(f'Convention "{new_convention}" is already registered')
|
|
620
|
-
# cfg._registered_conventions[new_convention.name] = new_convention
|
|
621
|
-
|
|
622
|
-
|
|
623
615
|
def add_convention(convention: Convention, name=None):
|
|
624
616
|
"""Add a convention to the list of registered convention"""
|
|
625
617
|
if not isinstance(convention, Convention):
|
|
@@ -689,6 +681,7 @@ def from_file(filename) -> Convention:
|
|
|
689
681
|
|
|
690
682
|
def from_yaml(filename: Union[str, pathlib.Path], overwrite: bool = False) -> Convention:
|
|
691
683
|
"""Load a convention from a YAML file. See Convention.from_yaml() for details"""
|
|
684
|
+
logger.debug(f"Reading Convention from yaml file: {filename}")
|
|
692
685
|
return Convention.from_yaml(filename, overwrite=overwrite)
|
|
693
686
|
|
|
694
687
|
|
|
@@ -17,8 +17,8 @@ def get_ld(
|
|
|
17
17
|
skipND: Optional[int] = 1,
|
|
18
18
|
context: Optional[Dict] = None) -> rdflib.Graph:
|
|
19
19
|
"""Return the HDF file content as a rdflib.Graph object."""
|
|
20
|
-
if file_uri and not (str(file_uri)
|
|
21
|
-
file_uri
|
|
20
|
+
if file_uri and not (str(file_uri).endswith("#") or str(file_uri).endswith("/")):
|
|
21
|
+
raise ValueError("file_uri must end with '#' or '/'")
|
|
22
22
|
graph = None
|
|
23
23
|
with h5py.File(hdf_filename) as h5:
|
|
24
24
|
if contextual and structural:
|
|
@@ -76,6 +76,10 @@ def validate_url(url: str) -> str:
|
|
|
76
76
|
Returns the original string if the URL is valid. Thus, white spaces are not replaced
|
|
77
77
|
by %20.
|
|
78
78
|
"""
|
|
79
|
+
if isinstance(url, rdflib.BNode):
|
|
80
|
+
return url.n3()
|
|
81
|
+
if isinstance(url, str) and url.startswith("_:"):
|
|
82
|
+
return url
|
|
79
83
|
try:
|
|
80
84
|
if not url.startswith("http"):
|
|
81
85
|
if ":" in url:
|
|
@@ -113,11 +117,17 @@ def set_predicate(attr: h5py.AttributeManager,
|
|
|
113
117
|
-------
|
|
114
118
|
None
|
|
115
119
|
"""
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
if isinstance(value, rdflib.BNode):
|
|
121
|
+
value = value.n3()
|
|
122
|
+
else:
|
|
123
|
+
if isinstance(value, str) and value.startswith("_:"):
|
|
124
|
+
pass
|
|
125
|
+
else:
|
|
126
|
+
try:
|
|
127
|
+
HttpUrl(value)
|
|
128
|
+
except pydantic.ValidationError as e:
|
|
129
|
+
raise RDFError(f'Invalid IRI: "{value}" for attr name "{attr_name}". '
|
|
130
|
+
f'Expecting a valid URL. This was validated with pydantic. Pydantic error: {e}')
|
|
121
131
|
|
|
122
132
|
iri_name_data = attr.get(rdf_predicate_attr_name, None)
|
|
123
133
|
if iri_name_data is None:
|
|
@@ -152,19 +162,32 @@ def set_object(attr: h5py.AttributeManager,
|
|
|
152
162
|
|
|
153
163
|
if isinstance(data, Thing):
|
|
154
164
|
data = data.get_jsonld_dict()
|
|
165
|
+
elif isinstance(data, rdflib.BNode):
|
|
166
|
+
data = data.n3()
|
|
155
167
|
elif isinstance(data, rdflib.Literal):
|
|
156
168
|
if data.language is not None and data.datatype is None:
|
|
157
169
|
data = {"lexical_or_value": str(data), "lang": data.language, "$type": "rdflib.term.Literal"}
|
|
158
170
|
elif isinstance(data, dict):
|
|
159
171
|
# assuming it is a JSON-LD dict
|
|
172
|
+
if "@graph" in data:
|
|
173
|
+
# if one entry, reduce it to a simpler form:
|
|
174
|
+
if len(data["@graph"]) == 1:
|
|
175
|
+
_ctx = data.get("@context", None)
|
|
176
|
+
_data = data["@graph"][0]
|
|
177
|
+
data = {"@context": _ctx, **_data} if _ctx is not None else _data
|
|
178
|
+
else:
|
|
179
|
+
raise RDFError(f"Cannot set multiple graph entries as object for attribute {attr_name}. ")
|
|
160
180
|
if not "@type" in data:
|
|
161
|
-
raise RDFError(f"The input data is interpreted as JSON-LD, but no @type is found: {data}")
|
|
181
|
+
raise RDFError(f"The input data is interpreted as JSON-LD, but no '@type' is found: {data}")
|
|
162
182
|
else:
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
183
|
+
if isinstance(data, str) and data.startswith("_:"):
|
|
184
|
+
pass
|
|
185
|
+
else:
|
|
186
|
+
try:
|
|
187
|
+
data = str(HttpUrl(data))
|
|
188
|
+
except pydantic.ValidationError as e:
|
|
189
|
+
raise RDFError(f'Invalid IRI: "{data}" for attr name "{attr_name}". '
|
|
190
|
+
f'Expecting a valid URL. This was validated with pydantic. Pydantic error: {e}')
|
|
168
191
|
curr_data = iri_data_data.get(attr_name, None)
|
|
169
192
|
if curr_data is None:
|
|
170
193
|
iri_data_data.update({attr_name: data})
|
|
@@ -510,9 +533,9 @@ class RDFManager:
|
|
|
510
533
|
"""Add a rdf type (@type in JSON-LD syntax) to the group or dataset.
|
|
511
534
|
If the subject already exists, it will not be added again."""
|
|
512
535
|
if isinstance(rdf_type, list):
|
|
513
|
-
data = [validate_url(
|
|
536
|
+
data = [validate_url(i) for i in rdf_type]
|
|
514
537
|
else:
|
|
515
|
-
data = validate_url(
|
|
538
|
+
data = validate_url(rdf_type)
|
|
516
539
|
|
|
517
540
|
# get the attribute
|
|
518
541
|
if '@TYPE' in self._attr:
|
|
@@ -825,9 +848,9 @@ class FileRDFManager:
|
|
|
825
848
|
def type(self, rdf_type: Union[str, List[str]]):
|
|
826
849
|
"""Add a rdf type (@type in JSON-LD syntax) to the hdf5 file (not the root group!)"""
|
|
827
850
|
if isinstance(rdf_type, list):
|
|
828
|
-
data = [validate_url(
|
|
851
|
+
data = [validate_url(i) for i in rdf_type]
|
|
829
852
|
else:
|
|
830
|
-
data = validate_url(
|
|
853
|
+
data = validate_url(rdf_type)
|
|
831
854
|
|
|
832
855
|
# get the attribute
|
|
833
856
|
iri_sbj_data = self._attr.get(RDF_FILE_TYPE_ATTR_NAME, None)
|
|
@@ -10,6 +10,7 @@ from ontolutils.classes.thing import is_url
|
|
|
10
10
|
from rdflib import RDF, DCTERMS, XSD, URIRef, Literal, Graph, BNode
|
|
11
11
|
|
|
12
12
|
from h5rdmtoolbox.ld.utils import get_attr_dtype_as_xsd, get_obj_bnode
|
|
13
|
+
from .utils import to_uriref
|
|
13
14
|
from ..rdf import FileRDFManager, RDFManager
|
|
14
15
|
|
|
15
16
|
# FALLBACK_PREDICATE = SCHEMA.additionalProperty
|
|
@@ -24,8 +25,14 @@ def _is_date_str(value: str):
|
|
|
24
25
|
# quick check, that first character is a digit
|
|
25
26
|
if not re.match(r"^\d", value):
|
|
26
27
|
return None
|
|
28
|
+
# reject version-like strings composed only of digits and dots, e.g. "2.5.2"
|
|
29
|
+
if re.match(r"^\d+(?:\.\d+)+$", value):
|
|
30
|
+
return None
|
|
27
31
|
try:
|
|
28
32
|
dt = parser.parse(value)
|
|
33
|
+
# reject implausible years (versions can parse as year 2, etc.)
|
|
34
|
+
if dt.year < 1000:
|
|
35
|
+
return None
|
|
29
36
|
# Prüfe, ob nur ein Datum (YYYY-MM-DD) vorliegt
|
|
30
37
|
if re.match(r"^\d{4}-\d{2}-\d{2}$", value):
|
|
31
38
|
return dt.date().isoformat(), XSD.date
|
|
@@ -35,14 +42,14 @@ def _is_date_str(value: str):
|
|
|
35
42
|
return None
|
|
36
43
|
|
|
37
44
|
|
|
38
|
-
def process_file_attribute(parent_obj, name, data, graph, file_uri: Union[URIRef, BNode]):
|
|
45
|
+
def process_file_attribute(parent_obj, name, data, graph, file_uri: Union[URIRef, BNode], blank_node_iri_base):
|
|
39
46
|
rdf_user_type = FileRDFManager(parent_obj.attrs).type
|
|
40
47
|
if rdf_user_type is not None:
|
|
41
48
|
if isinstance(rdf_user_type, (list, np.ndarray)):
|
|
42
49
|
for t in rdf_user_type:
|
|
43
|
-
graph.add((file_uri, RDF.type,
|
|
50
|
+
graph.add((file_uri, RDF.type, to_uriref(t, blank_node_iri_base)))
|
|
44
51
|
else:
|
|
45
|
-
graph.add((file_uri, RDF.type,
|
|
52
|
+
graph.add((file_uri, RDF.type, to_uriref(rdf_user_type, blank_node_iri_base)))
|
|
46
53
|
rdf_user_predicate = FileRDFManager(parent_obj.attrs).predicate[name]
|
|
47
54
|
|
|
48
55
|
rdf_user_object = FileRDFManager(parent_obj.attrs).object[name]
|
|
@@ -52,21 +59,22 @@ def process_file_attribute(parent_obj, name, data, graph, file_uri: Union[URIRef
|
|
|
52
59
|
rdf_user_predicate = FALLBACK_PREDICATE_FOR_LITERAL_OBJECTS
|
|
53
60
|
else:
|
|
54
61
|
rdf_user_predicate = FALLBACK_PREDICATE_FOR_IRI_OBJECTS
|
|
55
|
-
rdf_user_object = SCHEMA.PropertyValue
|
|
62
|
+
# rdf_user_object = SCHEMA.PropertyValue
|
|
56
63
|
|
|
57
64
|
if rdf_user_predicate:
|
|
58
65
|
if rdf_user_object:
|
|
59
66
|
if isinstance(rdf_user_object, Literal):
|
|
60
|
-
graph.add((file_uri,
|
|
67
|
+
graph.add((file_uri, to_uriref(rdf_user_predicate, blank_node_iri_base), rdf_user_object))
|
|
61
68
|
if isinstance(rdf_user_object, str) and rdf_user_object.startswith('http'):
|
|
62
|
-
graph.add((file_uri,
|
|
69
|
+
graph.add((file_uri, to_uriref(rdf_user_predicate, blank_node_iri_base),
|
|
70
|
+
to_uriref(rdf_user_object, blank_node_iri_base)))
|
|
63
71
|
elif isinstance(rdf_user_object, list):
|
|
64
72
|
for ruo in rdf_user_object:
|
|
65
73
|
if isinstance(ruo, Literal):
|
|
66
|
-
graph.add((file_uri,
|
|
74
|
+
graph.add((file_uri, to_uriref(rdf_user_predicate, blank_node_iri_base), ruo))
|
|
67
75
|
|
|
68
76
|
elif isinstance(ruo, str) and ruo.startswith('http'):
|
|
69
|
-
graph.add((file_uri,
|
|
77
|
+
graph.add((file_uri, to_uriref(rdf_user_predicate, blank_node_iri_base), URIRef(ruo)))
|
|
70
78
|
|
|
71
79
|
elif isinstance(ruo, dict):
|
|
72
80
|
try:
|
|
@@ -76,7 +84,9 @@ def process_file_attribute(parent_obj, name, data, graph, file_uri: Union[URIRef
|
|
|
76
84
|
if len(_subjects) != 1:
|
|
77
85
|
warnings.warn(f"Error parsing JSON-LD object for attribute. name={name}, data={data}. "
|
|
78
86
|
f"Expected exactly one subject, found {len(_subjects)}")
|
|
79
|
-
obj_graph.add(
|
|
87
|
+
obj_graph.add(
|
|
88
|
+
(file_uri, to_uriref(rdf_user_predicate, blank_node_iri_base),
|
|
89
|
+
to_uriref(list(_subjects)[0], blank_node_iri_base)))
|
|
80
90
|
graph += obj_graph
|
|
81
91
|
except Exception as e:
|
|
82
92
|
warnings.warn(
|
|
@@ -90,7 +100,8 @@ def process_file_attribute(parent_obj, name, data, graph, file_uri: Union[URIRef
|
|
|
90
100
|
if len(_subjects) != 1:
|
|
91
101
|
warnings.warn(f"Error parsing JSON-LD object for attribute. name={name}, data={data}. "
|
|
92
102
|
f"Expected exactly one subject, found {len(_subjects)}")
|
|
93
|
-
obj_graph.add((file_uri,
|
|
103
|
+
obj_graph.add((file_uri, to_uriref(rdf_user_predicate, blank_node_iri_base),
|
|
104
|
+
to_uriref(list(_subjects)[0], blank_node_iri_base)))
|
|
94
105
|
graph += obj_graph
|
|
95
106
|
except Exception as e:
|
|
96
107
|
warnings.warn(
|
|
@@ -101,19 +112,19 @@ def process_file_attribute(parent_obj, name, data, graph, file_uri: Union[URIRef
|
|
|
101
112
|
date_value, xsd_type = date_info
|
|
102
113
|
graph.add(
|
|
103
114
|
(file_uri,
|
|
104
|
-
|
|
115
|
+
to_uriref(rdf_user_predicate, blank_node_iri_base),
|
|
105
116
|
Literal(date_value, datatype=xsd_type))
|
|
106
117
|
)
|
|
107
118
|
elif is_url(data):
|
|
108
119
|
graph.add(
|
|
109
120
|
(file_uri,
|
|
110
|
-
|
|
121
|
+
to_uriref(rdf_user_predicate, blank_node_iri_base),
|
|
111
122
|
URIRef(data))
|
|
112
123
|
)
|
|
113
124
|
else:
|
|
114
125
|
graph.add(
|
|
115
126
|
(file_uri,
|
|
116
|
-
|
|
127
|
+
to_uriref(rdf_user_predicate, blank_node_iri_base),
|
|
117
128
|
Literal(data, datatype=get_attr_dtype_as_xsd(data)))
|
|
118
129
|
)
|
|
119
130
|
return graph
|
|
@@ -124,16 +135,16 @@ def process_attribute(parent_obj, name, data, graph, blank_node_iri_base):
|
|
|
124
135
|
|
|
125
136
|
parent_uri = rdf_manager.subject
|
|
126
137
|
if parent_uri:
|
|
127
|
-
parent_uri =
|
|
138
|
+
parent_uri = to_uriref(parent_uri, blank_node_iri_base)
|
|
128
139
|
else:
|
|
129
140
|
parent_uri = get_obj_bnode(parent_obj, blank_node_iri_base)
|
|
130
141
|
rdf_user_type = rdf_manager.type
|
|
131
142
|
if rdf_user_type is not None:
|
|
132
143
|
if isinstance(rdf_user_type, (list, np.ndarray)):
|
|
133
144
|
for t in rdf_user_type:
|
|
134
|
-
graph.add((parent_uri, RDF.type,
|
|
145
|
+
graph.add((parent_uri, RDF.type, to_uriref(t, blank_node_iri_base)))
|
|
135
146
|
else:
|
|
136
|
-
graph.add((parent_uri, RDF.type,
|
|
147
|
+
graph.add((parent_uri, RDF.type, to_uriref(rdf_user_type, blank_node_iri_base)))
|
|
137
148
|
rdf_user_predicate = rdf_manager.predicate[name]
|
|
138
149
|
rdf_user_object = rdf_manager.object[name]
|
|
139
150
|
if rdf_user_object and not rdf_user_predicate:
|
|
@@ -146,23 +157,37 @@ def process_attribute(parent_obj, name, data, graph, blank_node_iri_base):
|
|
|
146
157
|
def _add_to_graph(_rdf_user_object, _graph):
|
|
147
158
|
if _rdf_user_object:
|
|
148
159
|
if isinstance(_rdf_user_object, Literal):
|
|
149
|
-
_graph.add((parent_uri,
|
|
160
|
+
_graph.add((parent_uri, to_uriref(rdf_user_predicate, blank_node_iri_base), _rdf_user_object))
|
|
150
161
|
elif isinstance(_rdf_user_object, str) and _rdf_user_object.startswith('http'):
|
|
151
|
-
_graph.add((parent_uri,
|
|
162
|
+
_graph.add((parent_uri, to_uriref(rdf_user_predicate, blank_node_iri_base),
|
|
163
|
+
to_uriref(_rdf_user_object, blank_node_iri_base)))
|
|
152
164
|
elif isinstance(_rdf_user_object, list):
|
|
153
165
|
for _itm in _rdf_user_object:
|
|
154
166
|
_graph = _add_to_graph(_itm, _graph)
|
|
155
167
|
else:
|
|
156
168
|
if isinstance(_rdf_user_object, dict):
|
|
157
169
|
try:
|
|
158
|
-
|
|
170
|
+
jsonld_dict = json.loads(json.dumps(_rdf_user_object))
|
|
171
|
+
obj_graph = Graph().parse(data=jsonld_dict,
|
|
159
172
|
format="json-ld")
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
173
|
+
|
|
174
|
+
if "@graph" not in jsonld_dict:
|
|
175
|
+
use_subject = jsonld_dict.get("@id")
|
|
176
|
+
obj_graph.add((parent_uri, to_uriref(rdf_user_predicate, blank_node_iri_base),
|
|
177
|
+
to_uriref(use_subject, blank_node_iri_base)))
|
|
178
|
+
else:
|
|
179
|
+
_graph_entities = jsonld_dict["@graph"]
|
|
180
|
+
if len(_graph_entities) == 1:
|
|
181
|
+
use_subject = _graph_entities[0].get("@id")
|
|
182
|
+
obj_graph.add((parent_uri, to_uriref(rdf_user_predicate, blank_node_iri_base),
|
|
183
|
+
to_uriref(use_subject, blank_node_iri_base)))
|
|
184
|
+
else:
|
|
185
|
+
for _entity in _graph_entities:
|
|
186
|
+
if RDF.type in _entity and _entity[RDF.type] == str(SCHEMA.PropertyValue):
|
|
187
|
+
use_subject = _entity.get("@id")
|
|
188
|
+
obj_graph.add((parent_uri, to_uriref(rdf_user_predicate, blank_node_iri_base),
|
|
189
|
+
to_uriref(use_subject, blank_node_iri_base)))
|
|
190
|
+
|
|
166
191
|
_graph += obj_graph
|
|
167
192
|
except Exception as e:
|
|
168
193
|
warnings.warn(
|
|
@@ -173,19 +198,19 @@ def process_attribute(parent_obj, name, data, graph, blank_node_iri_base):
|
|
|
173
198
|
date_value, xsd_type = date_info
|
|
174
199
|
graph.add(
|
|
175
200
|
(parent_uri,
|
|
176
|
-
|
|
201
|
+
to_uriref(rdf_user_predicate, blank_node_iri_base),
|
|
177
202
|
Literal(date_value, datatype=xsd_type))
|
|
178
203
|
)
|
|
179
204
|
elif is_url(data):
|
|
180
205
|
graph.add(
|
|
181
206
|
(parent_uri,
|
|
182
|
-
|
|
207
|
+
to_uriref(rdf_user_predicate, blank_node_iri_base),
|
|
183
208
|
URIRef(data))
|
|
184
209
|
)
|
|
185
210
|
else:
|
|
186
211
|
graph.add(
|
|
187
212
|
(parent_uri,
|
|
188
|
-
|
|
213
|
+
to_uriref(rdf_user_predicate, blank_node_iri_base),
|
|
189
214
|
Literal(data, datatype=get_attr_dtype_as_xsd(data)))
|
|
190
215
|
)
|
|
191
216
|
return _graph
|
|
@@ -10,6 +10,7 @@ from rdflib import Namespace
|
|
|
10
10
|
from h5rdmtoolbox.ld.user.attributes import process_file_attribute
|
|
11
11
|
from h5rdmtoolbox.ld.user.groups import process_group
|
|
12
12
|
from h5rdmtoolbox.ld.utils import get_file_bnode
|
|
13
|
+
from .utils import to_uriref
|
|
13
14
|
from ..rdf import FileRDFManager
|
|
14
15
|
|
|
15
16
|
HDF = Namespace(str(HDF5))
|
|
@@ -25,14 +26,14 @@ def get_ld(
|
|
|
25
26
|
return get_ld(h5f, file_uri=file_uri)
|
|
26
27
|
|
|
27
28
|
graph = Graph()
|
|
28
|
-
graph.bind("m4i",
|
|
29
|
-
graph.bind("ssno",
|
|
30
|
-
graph.bind("piv",
|
|
29
|
+
graph.bind("m4i", to_uriref("http://w3id.org/nfdi4ing/metadata4ing#"))
|
|
30
|
+
graph.bind("ssno", to_uriref("https://matthiasprobst.github.io/ssno#"))
|
|
31
|
+
graph.bind("piv", to_uriref("https://matthiasprobst.github.io/pivmeta#"))
|
|
31
32
|
|
|
32
33
|
file_frdf_manager = FileRDFManager(source.attrs)
|
|
33
34
|
|
|
34
35
|
if file_frdf_manager.subject:
|
|
35
|
-
file_node =
|
|
36
|
+
file_node = to_uriref(file_frdf_manager.subject)
|
|
36
37
|
else:
|
|
37
38
|
file_node = get_file_bnode(source, file_uri=file_uri)
|
|
38
39
|
|
|
@@ -44,12 +45,12 @@ def get_ld(
|
|
|
44
45
|
if file_rdf:
|
|
45
46
|
if isinstance(file_rdf, list):
|
|
46
47
|
for rdf_type in file_rdf:
|
|
47
|
-
graph.add((file_node, rdflib.RDF.type,
|
|
48
|
+
graph.add((file_node, rdflib.RDF.type, to_uriref(rdf_type, file_uri)))
|
|
48
49
|
else:
|
|
49
|
-
graph.add((file_node, rdflib.RDF.type,
|
|
50
|
+
graph.add((file_node, rdflib.RDF.type, to_uriref(file_rdf, file_uri)))
|
|
50
51
|
|
|
51
52
|
for ak, av in source.attrs.items():
|
|
52
|
-
process_file_attribute(source, ak, av, graph, file_node)
|
|
53
|
+
process_file_attribute(source, ak, av, graph, file_node, blank_node_iri_base=file_uri)
|
|
53
54
|
|
|
54
55
|
process_group(source, graph, blank_node_iri_base=file_uri)
|
|
55
56
|
|
|
@@ -9,7 +9,7 @@ from h5rdmtoolbox.ld.user.attributes import process_attribute
|
|
|
9
9
|
from h5rdmtoolbox.ld.user.datasets import process_dataset
|
|
10
10
|
from h5rdmtoolbox.ld.utils import get_obj_bnode, get_file_bnode
|
|
11
11
|
from ..rdf import RDFManager
|
|
12
|
-
|
|
12
|
+
from .utils import to_uriref
|
|
13
13
|
|
|
14
14
|
def process_group(group, graph, blank_node_iri_base: Optional[str] = None):
|
|
15
15
|
for ak, av in group.attrs.items():
|
|
@@ -22,6 +22,7 @@ def process_group(group, graph, blank_node_iri_base: Optional[str] = None):
|
|
|
22
22
|
|
|
23
23
|
# if rdf_type is None:
|
|
24
24
|
if rdf_subject:
|
|
25
|
+
rdf_subject = to_uriref(rdf_subject, blank_node_iri_base)
|
|
25
26
|
graph.add((group_uri, SCHEMA.about, rdflib.URIRef(rdf_subject)))
|
|
26
27
|
rdf_predicate = rdf_manager.predicate
|
|
27
28
|
if rdf_predicate.get("SELF", None):
|
|
@@ -34,15 +35,15 @@ def process_group(group, graph, blank_node_iri_base: Optional[str] = None):
|
|
|
34
35
|
if rdf_subject:
|
|
35
36
|
if isinstance(rdf_type, (list, np.ndarray)):
|
|
36
37
|
for t in rdf_type:
|
|
37
|
-
graph.add((rdflib.URIRef(rdf_subject), rdflib.RDF.type,
|
|
38
|
+
graph.add((rdflib.URIRef(rdf_subject), rdflib.RDF.type, to_uriref(t, blank_node_iri_base)))
|
|
38
39
|
else:
|
|
39
|
-
graph.add((rdflib.URIRef(rdf_subject), rdflib.RDF.type,
|
|
40
|
+
graph.add((rdflib.URIRef(rdf_subject), rdflib.RDF.type, to_uriref(rdf_type, blank_node_iri_base)))
|
|
40
41
|
else:
|
|
41
42
|
if isinstance(rdf_type, (list, np.ndarray)):
|
|
42
43
|
for t in rdf_type:
|
|
43
|
-
graph.add((group_uri, rdflib.RDF.type,
|
|
44
|
+
graph.add((group_uri, rdflib.RDF.type, to_uriref(t, blank_node_iri_base)))
|
|
44
45
|
else:
|
|
45
|
-
graph.add((group_uri, rdflib.RDF.type,
|
|
46
|
+
graph.add((group_uri, rdflib.RDF.type, to_uriref(rdf_type, blank_node_iri_base)))
|
|
46
47
|
|
|
47
48
|
# Iterate through items in the group
|
|
48
49
|
for name, sub_group_or_dataset in group.items():
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
from rdflib import URIRef
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def to_uriref(value: str, blank_node_iri_base: str = None) -> URIRef:
|
|
5
|
+
"""Convert a value to a URIRef, handling blank nodes if necessary."""
|
|
6
|
+
if value.startswith("_:") and blank_node_iri_base:
|
|
7
|
+
value = blank_node_iri_base + value[2:]
|
|
8
|
+
return URIRef(value)
|