SynBioDex / sbol_factory

The SBOLFactory provides a mechanism for automatically generating an interactive, object-oriented API from a declarative data model specification encoded in OWL.
MIT License
6 stars 3 forks source link

prov ontology is given 'default' prefix #61

Open bbartley opened 2 years ago

bbartley commented 2 years ago

There is an inconsistency in how different versions of rdflib handle namespace prefixes that cause the prov ontology to be given a the default1 prefix instead of prov. This causes an issue for UML factory rendering class qnames correctly, and problems for testing.

This may be related to https://stackoverflow.com/questions/65818401/namespace-binding-in-rdflib

Here is a minimal case

import rdflib

def check_namespaces(graph):
    prefixes = [p for p, ns in graph.namespaces()]
    if 'default1' in prefixes:
        print(prefixes)
        return False
    return True

# This fails with rdflib 6.0.2 but passess with 6.1.1
g=rdflib.Graph(base='http://sbols.org/v3#')
g.parse('sbol_factory/rdf/prov-o.owl')
assert check_namespaces(g) is True
g.parse('sbol_factory/rdf/sbolowl3.rdf')
assert check_namespaces(g) is True

# This fails with rdflib 6.1.1 but passes with 6.0.2
g=rdflib.Graph(base='http://sbols.org/v3#')
g.parse('sbol_factory/rdf/sbolowl3.rdf')
assert check_namespaces(g) is True
g.parse('sbol_factory/rdf/prov-o.owl')
assert check_namespaces(g) is True
jakebeal commented 2 years ago

Next step: file an issue with rdflib