Skip to content

metadata

Metadata of an SBML model as RDF next to the CellML model.

CellML 2.0 has no place for metadata: its elements must be in the CellML or MathML namespace, and the only thing a model offers to the outside is the id of an element. The names, notes, SBO terms, annotations (CV terms) and the history of the SBML elements therefore go into an RDF/XML file next to the CellML file, with <cellml file>#<id> as the subject of an element, and sbml2cellml.cellml2sbml reads the file back.

The RDF is the one of SBML annotations: bqbiol and bqmodel qualifiers with an rdf:Bag of resources, the history as dcterms:creator (vCard 4), dcterms:created and dcterms:modified. libsbml writes and parses it, from a scratch element of SBML level 3, so that a level 2 model gives the same RDF. In addition an element has

  • dcterms:title: its name,
  • dcterms:description: its notes, the XHTML as an XML literal,
  • a first bqbiol:is (bqmodel:is for the model) with the single resource https://identifiers.org/SBO:...: its SBO term.

Record dataclass

Record(name='', notes='', sbo='', terms='', is_model=False)

The metadata of one element.

element_record

element_record(element)

The metadata of an SBML element.

Parameters:

Name Type Description Default
element SBase

the model, a compartment, species, parameter, reaction, ...

required

Returns:

Type Description
Record

The record, which is false when the element has no metadata.

collect_metadata

collect_metadata(elements)

The records of the elements which have metadata.

Parameters:

Name Type Description Default
elements dict[str, SBase]

SBML element by the id of its CellML element.

required

Returns:

Type Description
dict[str, Record]

The record by the id of the CellML element, in the order of elements.

write_metadata

write_metadata(records, cellml_name, path)

Write the records as RDF/XML.

Parameters:

Name Type Description Default
records dict[str, Record]

record by the id of the CellML element.

required
cellml_name str

file name of the CellML model, the subjects are <cellml_name>#<id>.

required
path Path

path of the RDF file.

required

read_metadata

read_metadata(path, cellml_name)

Read the records of a CellML model from an RDF/XML file.

Parameters:

Name Type Description Default
path Path

path of the RDF file, as write_metadata writes it.

required
cellml_name str

file name of the CellML model; the subjects of other files are ignored.

required

Returns:

Type Description
dict[str, Record]

The record by the id of the CellML element.

Raises:

Type Description
ValueError

if the file is not XML.

apply_metadata

apply_metadata(element, record, metaid)

Set the metadata of a record on an SBML element.

Parameters:

Name Type Description Default
element SBase

the SBML element.

required
record Record

its metadata.

required
metaid str

metaid the element gets when it has CV terms or a history, unique in the document.

required