metadata4Ing#
Metadata4Ing is an ontology developed within the NFDI Consortium NFDI4Ing “with the aim of providing a thorough framework for the semantic description of research data, with a particular focus on engineering sciences and neighbouring disciplines.”
The h5RDMtoolbox allows translating JSON-LD data into the HDF5 structure and wise versa (see here). This way, engineering process metadata can be added easily to the HDF5 file.
Consider the following example file taken from the m4i ontology “first steps guide”, which describes an experimental investigation. You can find the full content of the JSON-LD file here, the following shows an excerpt:
import h5rdmtoolbox as h5tbx
_ = h5tbx.set_config(auto_create_h5tbx_version=False)
With a single call (h5tbx.jsonld.to_hdf) it is possible to read in the JSON-LD data and parse it into the HDF5 structure:
with h5tbx.File() as h5:
h5.create_group('metadata')
h5tbx.jsonld.to_hdf(h5.metadata, source='min_m4i_ex.jsonld')
print(h5tbx.serialize(h5.hdf_filename, format="ttl", structural=False))
@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix m4i: <http://w3id.org/nfdi4ing/metadata4ing#> .
@prefix ns1: <http://purl.obolibrary.org/obo/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <https://schema.org/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<https://local-domain.org/postprocessing_0001> a m4i:ProcessingStep ;
rdfs:label "Post Processing"^^xsd:string .
<https://local-domain.org/preparation_0001> a m4i:ProcessingStep ;
rdfs:label "Sample preparation and parameter definition"^^xsd:string ;
prov:wasAssociatedWith <https://local-domain.org/alex> ;
schema:startTime "22"^^xsd:string .
<https://local-domain.org/reconstruction_0001> a m4i:ProcessingStep ;
rdfs:label "Image Processing and Reconstruction"^^xsd:string ;
ns1:RO_0002224 <https://local-domain.org/normalization_0001> ;
ns1:RO_0002233 <https://local-domain.org/xrct_data_0001> .
<https://local-domain.org/xray_tube_voltage> a m4i:NumericalVariable ;
rdfs:label "X-Ray Tube Voltage"^^xsd:string ;
m4i:hasKindOfQuantity "http://qudt.org/vocab/quantitykind/ElectricPotential"^^xsd:string ;
m4i:hasNumericalValue "140"^^xsd:string ;
m4i:hasUnit "http://qudt.org/vocab/unit/KiloV"^^xsd:string .
<https://local-domain.org/xrctscan_0001> a m4i:ProcessingStep ;
rdfs:label "XRCT-Scan"^^xsd:string ;
m4i:hasEmployedTool <https://local-domain.org/xray_source_finetec_180.01ctt_0001> ;
m4i:investigates "https://www.wikidata.org/wiki/Q189259"^^xsd:string ;
m4i:investigatesProperty "https://www.wikidata.org/wiki/Q256699"^^xsd:string ;
m4i:realizesMethod <https://local-domain.org/cone_beam_scanning> .
<https://local-domain.org/alex> a prov:Person ;
m4i:orcidId "0000-0000-0123-4567"^^xsd:string ;
foaf:firstName "Alexandra"^^xsd:string ;
foaf:lastName "Test"^^xsd:string .
<https://local-domain.org/cone_beam_scanning> a m4i:Method ;
rdfs:label "Standard cone beam scanning"^^xsd:string ;
dcterms:description "Standard cone beam scanning of the centered sample"^^xsd:string .
<https://local-domain.org/xray_source_finetec_180.01ctt_0001> a m4i:Tool ;
rdfs:label "FineTec FORE 180.01C TT"^^xsd:string .
<https://local-domain.org/xrct_data_0001> a dcat:Dataset .
[] dcat:downloadURL "//path/to/xcrt_0001.tiff"^^xsd:string ;
dcat:mediaType "image/tiff"^^xsd:string .
[] dcat:downloadURL "//path/to/xcrt_0003.tiff"^^xsd:string ;
dcat:mediaType "image/tiff"^^xsd:string .
[] dcat:downloadURL "//path/to/xcrt_0002.tiff"^^xsd:string ;
dcat:mediaType "image/tiff"^^xsd:string .
print(
h5tbx.serialize(
h5.hdf_filename,
format="ttl",
structural=False,
context={"@import": "https://w3id.org/nfdi4ing/metadata4ing/m4i_context.jsonld"})
)
@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix m4i: <http://w3id.org/nfdi4ing/metadata4ing#> .
@prefix ns1: <http://purl.obolibrary.org/obo/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <https://schema.org/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<https://local-domain.org/postprocessing_0001> a m4i:ProcessingStep ;
rdfs:label "Post Processing"^^xsd:string .
<https://local-domain.org/preparation_0001> a m4i:ProcessingStep ;
rdfs:label "Sample preparation and parameter definition"^^xsd:string ;
prov:wasAssociatedWith <https://local-domain.org/alex> ;
schema:startTime "22"^^xsd:string .
<https://local-domain.org/reconstruction_0001> a m4i:ProcessingStep ;
rdfs:label "Image Processing and Reconstruction"^^xsd:string ;
ns1:RO_0002224 <https://local-domain.org/normalization_0001> ;
ns1:RO_0002233 <https://local-domain.org/xrct_data_0001> .
<https://local-domain.org/xray_tube_voltage> a m4i:NumericalVariable ;
rdfs:label "X-Ray Tube Voltage"^^xsd:string ;
m4i:hasKindOfQuantity "http://qudt.org/vocab/quantitykind/ElectricPotential"^^xsd:string ;
m4i:hasNumericalValue "140"^^xsd:string ;
m4i:hasUnit "http://qudt.org/vocab/unit/KiloV"^^xsd:string .
<https://local-domain.org/xrctscan_0001> a m4i:ProcessingStep ;
rdfs:label "XRCT-Scan"^^xsd:string ;
m4i:hasEmployedTool <https://local-domain.org/xray_source_finetec_180.01ctt_0001> ;
m4i:investigates "https://www.wikidata.org/wiki/Q189259"^^xsd:string ;
m4i:investigatesProperty "https://www.wikidata.org/wiki/Q256699"^^xsd:string ;
m4i:realizesMethod <https://local-domain.org/cone_beam_scanning> .
<https://local-domain.org/alex> a prov:Person ;
m4i:orcidId "0000-0000-0123-4567"^^xsd:string ;
foaf:firstName "Alexandra"^^xsd:string ;
foaf:lastName "Test"^^xsd:string .
<https://local-domain.org/cone_beam_scanning> a m4i:Method ;
rdfs:label "Standard cone beam scanning"^^xsd:string ;
dcterms:description "Standard cone beam scanning of the centered sample"^^xsd:string .
<https://local-domain.org/xray_source_finetec_180.01ctt_0001> a m4i:Tool ;
rdfs:label "FineTec FORE 180.01C TT"^^xsd:string .
<https://local-domain.org/xrct_data_0001> a dcat:Dataset .
[] dcat:downloadURL "//path/to/xcrt_0002.tiff"^^xsd:string ;
dcat:mediaType "image/tiff"^^xsd:string .
[] dcat:downloadURL "//path/to/xcrt_0003.tiff"^^xsd:string ;
dcat:mediaType "image/tiff"^^xsd:string .
[] dcat:downloadURL "//path/to/xcrt_0001.tiff"^^xsd:string ;
dcat:mediaType "image/tiff"^^xsd:string .