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

Automatically creating `http://omex-library.org/NewOmex.omex` URIs is likely to generate confusion #138

Open jonrkarr opened 3 years ago

jonrkarr commented 3 years ago

I think its important that this library work consistently with other RDF readers in case people choose to use other libraries to read OMEX metadata.

This illustrates a key departure that I think will likely create confusion. The root uri is ..

<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>
  <rdf:Description rdf:about=".">
</rdf:RDF>

However, this library transforms this to http://omex-library.org/NewOmex.omex/.

import json
import pyomexmeta
rdf = pyomexmeta.RDF.from_file('tests/fixtures/omex-metadata/no-root.rdf', 'rdfxml')
query = "SELECT ?subject ?predicate ?object WHERE { ?subject ?predicate ?object }"
triples = json.loads(rdf.query_results_as_string(query, 'json'))['results']['bindings']
print(triples[0]['subject']['value'])

Instead, validation could be provided to assert that the URI must start with http://omex-library.org/ and end in .omex.