Referencing Standard Name Tables¶
There are multiple ways of associating tables to other objects such as a project or an HDF5 file
import ssnolib
Referencing to a Project¶
The vocabulary/ontology classes we want to reference to are schema:Project or schema:ResearchProject
In this example, we want to describe a Standard Name Table, which has been published on Zenodo.
In fact, this is very simple, because it does not require the SSNO ontology but rather the DCAT vocabulary. However, the ssnolib library provides the necessary classes.
Later, by associating a thing, e.g. a project or an HDF5 file, we will use ssno:usesStandardNameTable, which may point to either ssno:StandardNameTable or the dcat:Dataset we define below.
snt_dist = ssnolib.dcat.Distribution(
downloadURL="https://sandbox.zenodo.org/records/123202/files/Standard_Name_Table_for_the_Property_Descriptions_of_Centrifugal_Fans.jsonld",
media_type="application/json+ld"
)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[2], line 1
----> 1 snt_dist = ssnolib.dcat.Distribution(
2 downloadURL="https://sandbox.zenodo.org/records/123202/files/Standard_Name_Table_for_the_Property_Descriptions_of_Centrifugal_Fans.jsonld",
3 media_type="application/json+ld"
4 )
AttributeError: module 'ssnolib' has no attribute 'dcat'
dataset = ssnolib.dcat.Dataset(
identifier="https://sandbox.zenodo.org/uploads/123202",
distribution=snt_dist
)
print(dataset.model_dump_ttl())
Now let’s associate a Project with a standard name table file published on Zenodo:
from ssnolib.schema import Project, ResearchProject
proj = Project(name="My Project@en", usesStandardnameTable=dataset)
research_proj = ResearchProject(name="My Project", usesStandardnameTable=dataset)
print(proj.model_dump_ttl())
Referencing to an HDF5 file¶
We use the ontology http://purl.allotrope.org/ontologies/hdf5/1.8# to reference the table to a hdf5:File
from ssnolib import hdf5
file = hdf5.File(uses_standard_name_table=dataset)
print(file.model_dump_ttl())