owl-apipellet

Problem with 'getInstanceExplanations' when using OWL-API and Pellet reasoner


I trying to get reasoning explanations using getInstanceExplanations method:

Set<Set<OWLAxiom>> expIns = expGen.getInstanceExplanations(individual, Class);

But I had this error:

Exception in thread "main" java.lang.NoSuchMethodError: 'org.semanticweb.owlapi.model.OWLLiteral org.semanticweb.owlapi.model.OWLDataFactory.getOWLTypedLiteral(java.lang.String, org.semanticweb.owlapi.model.OWLDatatype)'
at com.clarkparsia.pellet.owlapiv3.ConceptConverter.visitLiteral(ConceptConverter.java:348)
at com.clarkparsia.pellet.owlapiv3.ConceptConverter.visitRestrictedDatatype(ConceptConverter.java:386)
at org.mindswap.pellet.output.ATermBaseVisitor.visit(ATermBaseVisitor.java:109)
at com.clarkparsia.pellet.owlapiv3.ConceptConverter.visitSome(ConceptConverter.java:174)
at org.mindswap.pellet.output.ATermBaseVisitor.visit(ATermBaseVisitor.java:85)
at com.clarkparsia.pellet.owlapiv3.ConceptConverter.visitList(ConceptConverter.java:357)
at com.clarkparsia.pellet.owlapiv3.ConceptConverter.visitAnd(ConceptConverter.java:138)
at org.mindswap.pellet.output.ATermBaseVisitor.visit(ATermBaseVisitor.java:67)
at com.clarkparsia.pellet.owlapiv3.ConceptConverter.visitSome(ConceptConverter.java:174)
at org.mindswap.pellet.output.ATermBaseVisitor.visit(ATermBaseVisitor.java:85)
at com.clarkparsia.pellet.owlapiv3.ConceptConverter.visitList(ConceptConverter.java:357)
at com.clarkparsia.pellet.owlapiv3.ConceptConverter.visitOr(ConceptConverter.java:148)
at org.mindswap.pellet.output.ATermBaseVisitor.visit(ATermBaseVisitor.java:73)
at com.clarkparsia.pellet.owlapiv3.ConceptConverter.visitList(ConceptConverter.java:357)
at com.clarkparsia.pellet.owlapiv3.ConceptConverter.visitAnd(ConceptConverter.java:138)
at org.mindswap.pellet.output.ATermBaseVisitor.visit(ATermBaseVisitor.java:67)
at com.clarkparsia.pellet.owlapiv3.ConceptConverter.convert(ConceptConverter.java:84)
at com.clarkparsia.pellet.owlapiv3.AxiomConverter.convert(AxiomConverter.java:87)
at com.clarkparsia.owlapi.explanation.GlassBoxExplanation.convertExplanation(GlassBoxExplanation.java:263)
at com.clarkparsia.owlapi.explanation.GlassBoxExplanation.getPelletExplanation(GlassBoxExplanation.java:228)
at com.clarkparsia.owlapi.explanation.GlassBoxExplanation.getExplanation(GlassBoxExplanation.java:191)
at com.clarkparsia.owlapi.explanation.HSTExplanationGenerator.getExplanation(HSTExplanationGenerator.java:110)
at com.clarkparsia.owlapi.explanation.HSTExplanationGenerator.getExplanations(HSTExplanationGenerator.java:131)
at com.clarkparsia.owlapi.explanation.HSTExplanationGenerator.getExplanations(HSTExplanationGenerator.java:115)
at com.clarkparsia.owlapi.explanation.PelletExplanation.getUnsatisfiableExplanations(PelletExplanation.java:154)
at com.clarkparsia.owlapi.explanation.PelletExplanation.getEntailmentExplanations(PelletExplanation.java:82)
at com.clarkparsia.owlapi.explanation.PelletExplanation.getInstanceExplanations(PelletExplanation.java:111)
at com.google.mapApi.map.Ontology.Ontology.main(Ontology.java:492)

I am using OWL-API 4.5.0, and pellet 2.3.2


Solution

  • Pellet 2.3.2 relies on OWLAPI 3.x.x and is not compatible with OWLAPI 4.x.x

    There is a build compatible with OWLAPI 4 available on Maven Central https://search.maven.org/search?q=v:2.4.0-ignazio1977

    There is also a much more recent build for OWLAPI 5, under the Openllet fork: https://search.maven.org/artifact/com.github.galigator.openllet/openllet-parent/2.6.4/pom

    (2.6.4 is compatible with Java 8, same as the versions you're currently using.)