Search code examples
owlontologyowl-apiiri

Add or update VersionIRI through OWL API


I have an ontology IRI without version. How to add or update version IRI of a particular OWL ontology ?


Solution

  • You need to create a change object that sets the ontology id. So, if you have an ontology o with an IRI but no version IRI:

    OWLOntology o = ...
    IRI versionIRI=IRI.create("version");
    SetOntologyID change=new SetOntologyID(o, 
        new OWLOntologyID(o.getOntologyID().getIR(), Optional.of(versionIRI)));
    o.getOWLOntologyManager().applyChange(change);