-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explanations for Inconsistent Ontologies with OWL API 5.1.14 #4
Comments
This version compiles on owlexplanation version 5:
|
Thanks for your quick reply, I have indeed something that is compiling but failing at runtime with an Illegal state exception.
Here is the code I am running package org.w3id;
import java.util.Set;
import org.semanticweb.HermiT.ReasonerFactory;
import org.semanticweb.owl.explanation.api.Explanation;
import org.semanticweb.owl.explanation.api.ExplanationGenerator;
import org.semanticweb.owl.explanation.impl.blackbox.checker.InconsistentOntologyExplanationGeneratorFactory;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLDataFactory;
import org.semanticweb.owlapi.model.OWLIndividual;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyManager;
public class Http {
public static void main(String[] args) throws Exception {
OWLOntology ont = OWLManager.createOWLOntologyManager().createOntology();
OWLOntologyManager m = ont.getOWLOntologyManager();
OWLDataFactory df = m.getOWLDataFactory();
OWLClass class1 = df.getOWLClass(IRI.create("urn:test:class1"));
OWLClass class2 = df.getOWLClass(IRI.create("urn:test:class2"));
OWLIndividual i = df.getOWLNamedIndividual(IRI.create("urn:test:i"));
// create an inconsistent ontology by declaring an individual member of two disjoint classes
m.addAxiom(ont, df.getOWLDisjointClassesAxiom(class1, class2));
m.addAxiom(ont, df.getOWLClassAssertionAxiom(class1, i));
m.addAxiom(ont, df.getOWLClassAssertionAxiom(class2, i));
ReasonerFactory rf = new ReasonerFactory();
// create the explanation generator
ExplanationGenerator<OWLAxiom> explainInconsistency =
new InconsistentOntologyExplanationGeneratorFactory(rf,
OWLManager.getOWLDataFactory(),
OWLManager::createOWLOntologyManager,
1000L).createExplanationGenerator(ont);
// Ask for an explanation of `Thing subclass of Nothing` - this axiom is entailed in any inconsistent ontology
Set<Explanation<OWLAxiom>> explanations = explainInconsistency.getExplanations(
df.getOWLSubClassOfAxiom(df.getOWLThing(), df.getOWLNothing()));
explanations.forEach(System.out::println);
}
} My dependency specification is the following <dependencies>
<dependency>
<groupId>net.sourceforge.owlapi</groupId>
<artifactId>org.semanticweb.hermit</artifactId>
<version>1.3.8.510</version>
</dependency>
<dependency>
<groupId>net.sourceforge.owlapi</groupId>
<artifactId>owlapi-distribution</artifactId>
<version>5.1.14</version>
</dependency>
<dependency>
<groupId>net.sourceforge.owlapi</groupId>
<artifactId>owlexplanation</artifactId>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>net.sf.trove4j</groupId>
<artifactId>core</artifactId>
<version>3.1.0</version>
</dependency>
</dependencies> trove4j seems to be implicitly required by HermiT. |
@mthl Were you able to make this work? I know it has been a while, but I got to the same "value cannot be null at this stage" exception with a very similar setup and code as yours. |
Hello,
I am trying to use this package for checking inconsistencies in an OWL 2 DL ontology. I am using OWL API 5.1.14 and owlexplanation 5.0.0 but I am failing to adapt an old example found on stackoverflow to OWL API v5.
Any help would be welcome.
The text was updated successfully, but these errors were encountered: