… load a convention from a local YAML file?#
Yes you can. To demonstrate this, let’s take a convention file, which comes with the h5RDMtoolbox
import h5rdmtoolbox as h5tbx
from h5rdmtoolbox import tutorial
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[1], line 1
----> 1 import h5rdmtoolbox as h5tbx
2 from h5rdmtoolbox import tutorial
File ~/checkouts/readthedocs.org/user_builds/h5rdmtoolbox/checkouts/v1.7.0/h5rdmtoolbox/__init__.py:129
125 with File(src) as h5:
126 return h5.dumps()
--> 129 from h5rdmtoolbox.wrapper.ld.hdf.file import get_ld as hdf_get_ld
130 from h5rdmtoolbox.wrapper.ld.user.file import get_ld as user_get_ld
133 def get_ld(
134 hdf_filename: Union[str, pathlib.Path],
135 structural: bool = True,
136 semantic: bool = True,
137 blank_node_iri_base: Optional[str] = None,
138 **kwargs) -> rdflib.Graph:
File ~/checkouts/readthedocs.org/user_builds/h5rdmtoolbox/checkouts/v1.7.0/h5rdmtoolbox/wrapper/ld/__init__.py:1
----> 1 import ssnolib.ssno.standard_name
2 from ontolutils.namespacelib import M4I
3 from ontolutils.namespacelib import SCHEMA
ModuleNotFoundError: No module named 'ssnolib'
yaml_filename = tutorial.get_convention_yaml_filename()
cv = h5tbx.convention.Convention.from_yaml(yaml_filename)
h5tbx.use(cv)
Convention "h5rdmtoolbox-tutorial-convention" filename: C:\Users\da4323\Documents\programming\GitHub\h5RDMtoolbox\h5rdmtoolbox\data\tutorial_convention.yaml
creating directory for the convention
No special functions defined
Found 0 function(s) in C:\Users\da4323\AppData\Local\h5rdmtoolbox\h5rdmtoolbox\conventions\h5rdmtoolbox_tutorial_convention\h5rdmtoolbox_tutorial_convention.py
using("h5rdmtoolbox-tutorial-convention")
The convention requires a standard name table. It comes with a default one, but let’s also load a local one:
snt_yaml_filename = tutorial.get_standard_name_table_yaml_file()
with h5tbx.File(data_type='experimental', contact=h5tbx.__author_orcid__,
standard_name_table=snt_yaml_filename) as h5:
snt = h5.standard_name_table
c = h5.contact
h5.dump()
-
- __h5rdmtoolbox_version__ : 0.9.0a0
- contact :
https://orcid.org/0000-0001-8729-0482 - data_type : experimental
- standard_name_table :
- StandardNameTable: (institution: my_institution, contact: https://orcid.org/0000-0001-8729-0482, valid_characters: [^a-zA-Z0-9_], pattern: ^[0-9 ].*, last_modified: 2023-08-16_11:05:00, version: v1.1)