Skip to content

Commit

Permalink
hotfix skipND
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasprobst committed Dec 27, 2024
1 parent 3eb74a9 commit 42fe7d0
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 15 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

Log of changes in the versions

## v1.6.1
- hotfix `skipND` when calling `dump_jsonld()`. Option was not passed correctly to underlying function.

## v1.6.0
- `rootgroup` as alias for `rootparent`
- `ZenodoRecord` has new property `env_name_for_token` to define the environment variable name to be used for the Zenodo token
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ authors:
given-names: "Lucas"
orcid: "https://orcid.org/0000-0002-4116-0065"
title: "h5rdmtoolbox - HDF5 Research Data Management Toolbox"
version: 1.6.0
version: 1.6.1
doi: 10.5281/zenodo.14473697
date-released: 2024-14-12
date-released: 2024-14-27
url: "https://github.com/matthiasprobst/h5rdmtoolbox"
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"license": "https://spdx.org/licenses/MIT",
"codeRepository": "git+https://github.com/matthiasprobst/h5RDMtoolbox.git",
"name": "h5RDMtoolbox",
"version": "1.6.0",
"version": "1.6.1",
"description": "Supporting a FAIR Research Data lifecycle using Python and HDF5.",
"applicationCategory": "Engineering",
"programmingLanguage": [
Expand Down
4 changes: 2 additions & 2 deletions docs/colab/quickstart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"outputs": [],
"source": [
"# !pip install h5rdmtoolbox==1.6.0"
"# !pip install h5rdmtoolbox==1.6.1"
]
},
{
Expand All @@ -19,7 +19,7 @@
{
"data": {
"text/plain": [
"'1.5.3'"
"'1.6.1'"
]
},
"execution_count": 2,
Expand Down
11 changes: 9 additions & 2 deletions h5rdmtoolbox/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,15 @@ def dump_jsonld(hdf_filename: Union[str, pathlib.Path],
if structural and not semantic:
return jsonld.dump_file(hdf_filename, skipND=skipND)
with File(hdf_filename) as h5:
return jsonld.dumps(h5, structural=structural, resolve_keys=resolve_keys, context=context,
blank_node_iri_base=blank_node_iri_base, **kwargs)
return jsonld.dumps(
h5,
structural=structural,
resolve_keys=resolve_keys,
context=context,
blank_node_iri_base=blank_node_iri_base,
skipND=skipND,
**kwargs
)


def get_filesize(hdf_filename: Union[str, pathlib.Path]) -> int:
Expand Down
14 changes: 9 additions & 5 deletions h5rdmtoolbox/wrapper/jsonld.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,6 @@ def _add_hdf_node(name, obj, ctx) -> Dict:
_context.update({ns_prefix: ns_iri})
_add_node(g, (file_node, RDF.type, rdflib.URIRef(_type)))


# now go through all predicates
for ak, av in obj.attrs.items():
attr_predicate = obj.frdf.predicate.get(ak, None)
Expand Down Expand Up @@ -933,7 +932,8 @@ def dumpd(grp,
context: Dict = None,
blank_node_iri_base: Optional[HttpUrl] = None,
structural: bool = True,
resolve_keys: bool = False
resolve_keys: bool = False,
skipND: Optional[int] = None
) -> Union[List, Dict]:
"""If context is missing, return will be a List"""
s = serialize(grp,
Expand All @@ -943,7 +943,8 @@ def dumpd(grp,
context=context,
blank_node_iri_base=blank_node_iri_base,
structural=structural,
resolve_keys=resolve_keys)
resolve_keys=resolve_keys,
skipND=skipND)
if context:
for k, v in context.items():
CONTEXT_PREFIXES_INV[v] = k
Expand All @@ -960,13 +961,15 @@ def dumpd(grp,
return jsonld_dict


def dumps(grp, iri_only=False,
def dumps(grp,
iri_only=False,
recursive: bool = True,
compact: bool = True,
context: Optional[Dict] = None,
blank_node_iri_base: Optional[HttpUrl] = None,
structural: bool = True,
resolve_keys: bool = False,
skipND: Optional[int] = None,
**kwargs) -> str:
"""Dump a group or a dataset to string."""
return json.dumps(dumpd(
Expand All @@ -977,7 +980,8 @@ def dumps(grp, iri_only=False,
context=context,
blank_node_iri_base=blank_node_iri_base,
structural=structural,
resolve_keys=resolve_keys),
resolve_keys=resolve_keys,
skipND=skipND),
**kwargs
)

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ python-gitlab
pypandoc>=1.11
pydantic>=2.8.2
# other:
ontolutils >= 0.12.2
ontolutils >= 0.12.4
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = h5rdmtoolbox
version = 1.6.0
version = 1.6.1
author = Matthias Probst
author_email = matth.probst@gmail.com
description = Supporting a FAIR Research Data lifecycle using Python and HDF5.
Expand Down Expand Up @@ -35,7 +35,7 @@ install_requires =
pint_xarray >= 0.2.1
regex>=2020.7.9
packaging>=24.1
ontolutils>=0.12.2
ontolutils>=0.12.4
python-forge==18.6.0
requests>=2.32.3
pydantic>=2.8.2
Expand Down

0 comments on commit 42fe7d0

Please sign in to comment.