You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm experiencing another bug which is probably caused by some regression introduced in #522. Whenever I serialize my OWL ontology using a prefix based syntax (i.e: Functional Style Syntax, Manchester OWL syntax, etc.) The prefixes I specify for my ontology entities are replaced by the IRI. Example:
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.formats.FunctionalSyntaxDocumentFormat;
import org.semanticweb.owlapi.io.OWLOntologyDocumentTarget;
import org.semanticweb.owlapi.io.StringDocumentTarget;
import org.semanticweb.owlapi.model.*;
import org.semanticweb.owlapi.util.DefaultPrefixManager;
public class Main {
public static void main (String args[]) throws OWLOntologyCreationException, OWLOntologyStorageException {
OWLOntologyManager man = OWLManager.createOWLOntologyManager();
OWLOntology ontology = man.createOntology(IRI.create("http://www.dis.uniroma1.it/pizza"));
OWLDataFactory dataFactory = man.getOWLDataFactory();
PrefixManager pm = new DefaultPrefixManager();
pm.setPrefix("pizza", "http://www.dis.uniroma1.it/pizza");
OWLClass pizza = dataFactory.getOWLClass("pizza:PizzaBase", pm);
OWLDeclarationAxiom declarationAxiom = dataFactory.getOWLDeclarationAxiom(pizza);
man.addAxiom(ontology, declarationAxiom);
FunctionalSyntaxDocumentFormat ontoFormat = new FunctionalSyntaxDocumentFormat();
ontoFormat.copyPrefixesFrom(pm);
man.setOntologyFormat(ontology, ontoFormat);
OWLOntologyDocumentTarget stream = new StringDocumentTarget();
man.saveOntology(ontology, stream);
System.out.println(stream.toString());
}
}
Here you can see Declaration(Class(<http://www.dis.uniroma1.it/pizzaPizzaBase>)) while I was expecting: Declaration(Class(<pizza:PizzaBase>)). I'm using OWLapi version 4.
The text was updated successfully, but these errors were encountered:
It's unrelated to the previous issue: this depends on the IRI for the pizza class being http://www.dis.uniroma1.it/pizzaPizzaBase. The default namespace for this IRI is http://www.dis.uniroma1.it/, and that's what's used to find suitable prefixes. This is reductive, as when the default namespace is not replaced, then it's legitimate to try and use any suitable replacement.
ignazio1977
changed the title
Explicit prefix is overridden by IRI during OWL serialization
Explicit prefix ignored during serialization
Sep 10, 2016
I'm experiencing another bug which is probably caused by some regression introduced in #522. Whenever I serialize my OWL ontology using a prefix based syntax (i.e: Functional Style Syntax, Manchester OWL syntax, etc.) The prefixes I specify for my ontology entities are replaced by the IRI. Example:
produces the following:
Here you can see
Declaration(Class(<http://www.dis.uniroma1.it/pizzaPizzaBase>))
while I was expecting:Declaration(Class(<pizza:PizzaBase>))
. I'm using OWLapi version 4.The text was updated successfully, but these errors were encountered: