h5rdmtoolbox.wrapper.h5attr.Attribute

h5rdmtoolbox.wrapper.h5attr.Attribute#

class h5rdmtoolbox.wrapper.h5attr.Attribute(value, *, definition=None, rdf_predicate=None, frdf_predicate=None, rdf_object=None, frdf_object=None)[source]#

Helper class for quick assignment of RDF attributes to the HDF5 file.

Examples

>>> import h5rdmtoolbox as h5tbx
>>> from ontolutils import M4I
>>> rdf_attr = h5tbx.Attribute('0000-0001-8729-0482', rdf_predicate=M4I.orcidId,
...                            rdf_object='https://orcid.org/0000-0001-8729-0482')
>>> with h5tbx.File('test.h5', 'w') as h5:
...     grp = h5.create_group('person')
...     grp.attrs['orcid'] = rdf_attr
...     # equal to:
...     # grp.attrs['orcid'] = '0000-0001-8729-0482'
...     # grp.rdf.predicate['orcid'] = str(M4I.orcidId)
...     # grp.rdf.object['orcid'] = 'https://orcid.org/0000-0001-8729-0482'
__init__(value, *, definition=None, rdf_predicate=None, frdf_predicate=None, rdf_object=None, frdf_object=None)[source]#

Methods

__init__(value, *[, definition, ...])