Open allenbaron opened 9 months ago
Thanks for pointing to #1106, which uses isPrefixOWLOntologyFormat()
to check whether a format should use prefixes. That should be correct. In this case robot query
is converting the input ontology to Turtle, loading into Jena, running SPARQL, converting back to Turtle, and reading in to OWLAPI again. I guess that the format of the input ontology is being lost. If I'm right, then the prefixes won't be preserved for RDFXML format either, but we might be setting decent prefixes in that case.
Do you (or anyone reading this) have time to dig into this issue? I have some big deadlines coming up.
I'd love to help more but I don't have sufficient expertise with Java (or sufficient familiarity with the internal workings of ROBOT/OWLAPI) to delve into this. My apologies.
Seems @souzadevinicius is interested to look at this, but its actually a quite complex issue possibly - we will see.
The robot query command performing an update operation drops prefixes when the output is .ofn or .omn but not .owl (all I tested). This seems to be the same issue as #1101 except it's happening for robot update queries and wasn't fixed by PR https://github.com/ontodev/robot/pull/1106 (still happens in 1.9.5). The doid-edit.owl input file is formatted as .ofn. This happens for all SPARQL update queries I've tried (including a completely empty one, see bottom).
Prefixes dropped
.ofn output loses prefixes:
Chaining
convert
doesn't help:Separate
convert
doesn't help (for .ofn or .omn):Result:
Prefixes Preserved
.owl output preserves prefixes:
Using
--add-prefixes
also works (my current workaround):
fix_whitespace.rq: ```sparql # remove extra whitespace from ALL strings (e.g. in defs, xrefs, labels, etc.) # -> removes 2+ spaces, spaces before commas or periods, and spaces at beginning or end of string PREFIX xsd:SPARQL queries
```json { "@context": { "obo": "http://purl.obolibrary.org/obo/", "oboInOwl": "http://www.geneontology.org/formats/oboInOwl#", "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdfs": "http://www.w3.org/2000/01/rdf-schema#", "xml": "http://www.w3.org/XML/1998/namespace", "xsd": "http://www.w3.org/2001/XMLSchema#", "owl": "http://www.w3.org/2002/07/owl#", "terms": "http://purl.org/dc/terms/", "dc": "http://purl.org/dc/elements/1.1/", "skos": "http://www.w3.org/2004/02/skos/core#", "doid": "http://purl.obolibrary.org/obo/doid#" } } ```prefixes.json file