使用 OWL-API 和 Pellet reasoner 时 'getInstanceExplanations' 的问题
Problem with 'getInstanceExplanations' when using OWL-API and Pellet reasoner
我尝试使用 getInstanceExplanations 方法获取推理解释:
Set<Set<OWLAxiom>> expIns = expGen.getInstanceExplanations(individual, Class);
但是我遇到了这个错误:
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)
我正在使用 OWL-API 4.5.0 和 pellet 2.3.2
Pellet 2.3.2 依赖于 OWLAPI 3.x.x 并且与 OWLAPI 不兼容 4.x.x
Maven Central 上有一个与 OWLAPI 4 兼容的构建
https://search.maven.org/search?q=v:2.4.0-ignazio1977
在 Openllet 分支下还有一个更新的 OWLAPI 5 版本:
https://search.maven.org/artifact/com.github.galigator.openllet/openllet-parent/2.6.4/pom
(2.6.4 与 Java 8 兼容,与您当前使用的版本相同。)
我尝试使用 getInstanceExplanations 方法获取推理解释:
Set<Set<OWLAxiom>> expIns = expGen.getInstanceExplanations(individual, Class);
但是我遇到了这个错误:
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)
我正在使用 OWL-API 4.5.0 和 pellet 2.3.2
Pellet 2.3.2 依赖于 OWLAPI 3.x.x 并且与 OWLAPI 不兼容 4.x.x
Maven Central 上有一个与 OWLAPI 4 兼容的构建 https://search.maven.org/search?q=v:2.4.0-ignazio1977
在 Openllet 分支下还有一个更新的 OWLAPI 5 版本: https://search.maven.org/artifact/com.github.galigator.openllet/openllet-parent/2.6.4/pom
(2.6.4 与 Java 8 兼容,与您当前使用的版本相同。)