owlcollab/owltools

Add prefix definition

stuppie opened this issue · 2 comments

Is there a way (preferably on the command line) to add a prefix definition to an ontology?

To give my specific usage, I am trying to merge some triples into an existing ontology however if there is a prefix defined in the triples that doesn't exist in the base file, the full URI is used. How can I add the prefix definition?

$ owltools MYFILE.owl -o -h
-o [-f FORMAT] [--prefix PREFIX URI]* FILE         writes source ontology.

e.g.

owltools MYFILE.owl -o -f ofn --prefix FOO http://example.org/foo MYFILE-out.ofn

should work with any owlapi prefix-enabled format

(note prefix definitions are a purely syntactic feature and semantically invisible to the owlapi)

Also for many basic ontology release operations the recommendation is to use robot.

Thanks for the quick response!!

It still didn't work however. Example:

owltools doid-edit.owl --merge tmp.ttl -o -f ofn --prefix skos "http://www.w3.org/2004/02/skos/core#" doid-edit.owl

where doid-edit.owl is: https://github.com/DiseaseOntology/HumanDiseaseOntology/blob/master/src/ontology/doid-edit.owl
and tmp.ttl contains:

@prefix obo:   <http://purl.obolibrary.org/obo/> .
@prefix skos:   <http://www.w3.org/2004/02/skos/core#> .    
obo:DOID_7880  skos:broadMatch  "XXX"^^xsd:string .

I get the following lines in the output file:

Declaration(AnnotationProperty(<http://www.w3.org/2004/02/skos/core#broadMatch>))
AnnotationAssertion(<http://www.w3.org/2004/02/skos/core#broadMatch> obo:DOID_7880 "XXX"^^xsd:string)

where I'm expecting

Prefix(skos:=<http://www.w3.org/2004/02/skos/core#>)
Declaration(AnnotationProperty(skos:broadMatch))
AnnotationAssertion(skos:broadMatch obo:DOID_7880 "XXX"^^xsd:string)

I know they're equivalent, but.. just for git reasons, I'd like it to be the curie