sys-bio / libOmexMeta

libOmexMeta is a library aimed at providing developer-level support for reading, writing, editing and managing semantic annotations for biosimulation models.
https://sys-bio.github.io/libOmexMeta/
Apache License 2.0
8 stars 6 forks source link

Hash removal at the end of uri's #39

Closed aram148 closed 3 years ago

aram148 commented 3 years ago

It was suggested that the hash at the end of the uri's be removed.

nickerso commented 3 years ago

The # added to the model URL as part of the generated triples for, e.g., model level annotations:

<http://omex-library.org/my-omex-archive.omex/models/special-model/my-model.cellml#>
CiaranWelsh commented 3 years ago

Do you have a code example that produces a triple with the trailing #?

CiaranWelsh commented 3 years ago

Do you mean, for instance:

from pyomexmeta import RDF, Editor
rdf = RDF.from_file("BIOMD0000000386.xml", "rdfxml")
print(rdf)

The hashes after the rdf or local prefixes (which were copied directly from the omexmeta spec):

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix bqmodel: <http://biomodels.net/model-qualifiers/> .
@prefix bqbiol: <http://biomodels.net/biology-qualifiers/> .
@prefix semsim: <http://bime.uw.edu/semsim/> .
@prefix OMEXlib: <http://omex-library.org/> .
@prefix local: <http://omex-library.org/NewOmex.omex/NewModel.rdf#> .
... (no other triples in this model have trailing hashes)
aram148 commented 3 years ago

Yes that's what I believe Goksel meant by the trailing hashes! Perhaps @nickerso can confirm.

nickerso commented 3 years ago

No, those namespaces are correct and require the #. This was with the model level annotations...

from pyomexmeta import RDF
rdf_graph = RDF()
rdf_graph.set_archive_uri("my-omex-archive.omex")
rdf_graph.set_model_uri("my-model.cellml")
cellml = """
<model xmlns="http://www.cellml.org/cellml/1.1#" xmlns:cmeta="http://www.cellml.org/metadata/1.0#"
      name="annotation_examples" cmeta:id="annExamples">
  <component name="main">
    <variable cmeta:id="main.Volume" initial_value="100" name="Volume" units="dimensionless" />
    <variable cmeta:id="main.MembraneVoltage" initial_value="-80" name="MembraneVoltage" units="dimensionless" />
    <variable cmeta:id="main.ReactionRate" initial_value="1" name="ReactionRate" units="dimensionless" />
  </component>
</model>
"""
editor = rdf_graph.to_editor(cellml, generate_new_metaids=False, sbml_semantic_extraction=False)
editor.add_creator("0000-0003-4667-9779")
editor.add_taxon("9895")
print(rdf_graph)

which gives:

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix dc: <https://dublincore.org/specifications/dublin-core/dcmi-terms/> .
@prefix bqbiol: <http://biomodels.net/biology-qualifiers/> .
@prefix NCBI_Taxon: <https://identifiers.org/taxonomy:> .
@prefix OMEXlib: <http://omex-library.org/> .
@prefix local: <http://omex-library.org/my-omex-archive.omex/models/special-model/my-model.rdf#> .

<http://omex-library.org/my-omex-archive.omex/models/special-model/my-model.cellml#>
    bqbiol:hasTaxon <https://identifiers.org/taxonomy:9895> ;
    dc:creator <https://orcid.org/0000-0003-4667-9779> .

and its that # at the end of <http://omex-library.org/my-omex-archive.omex/models/special-model/my-model.cellml#> which is extraneous.