I'm using version 0.33 and Python 3.8.5.
I'm creating a little ontology in a SNOMED-CT namespace
http://snomed.info/id/world = World()
sct_namespace = world.get_ontology("
http://snomed.info/id/")
with sct_namespace:
# create some classes here
sct_namespace.save(file='snomedct_plus.rdf')
I've run into problems when viewing in Protege. The RDF/XML file is missing an xml:base attribute which means Protege puts the classes in a file based IRI namespace rather than the
http://snomed.info/id/ namespace.
It comes out with this:
<rdf:RDF xmlns:rdf="
http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xsd="
http://www.w3.org/2001/XMLSchema#" xmlns:rdfs="
http://www.w3.org/2000/01/rdf-schema#" xmlns:owl="
http://www.w3.org/2002/07/owl#" xmlns:core="
http://www.w3.org/2004/02/skos/core#" xmlns="
http://snomed.info/id/"><owl:Ontology rdf:about="
http://snomed.info/id"/><owl:ObjectProperty rdf:about="SCT_609096000">
<rdfs:label rdf:datatype="
http://www.w3.org/2001/XMLSchema#string">role group</rdfs:label>
<core:altLabel xml:lang="en">Role group (attribute)</core:altLabel>
<core:prefLabel xml:lang="en">Role group</core:prefLabel>
</owl:ObjectProperty>...
I can fix it by modifying driver.py line 324-325 from:
xmln = xmlns.get(left)
if not xmln:to
xmln = xmlns.get(left)
if left not in xmlns:I think what is happening is that the base uri has an empty string to denote no prefix but empty string evaluates to False and so the abbrev(storid) function goes ahead creates a new 'id:' prefix for the SNOMED namespace. As the prefix is no longer "" for the base uri no xml:base attribute is created in the XML root element.
I could be wrong though as in some situations it has been working without the fix in the past.