OWL-API と一緒にペレットを実行すると問題が発生します。コードをデバッグするために、次の例外がスローされます。
public class SemanticHelper{
private static final File file = new File("C:\\Users\\clayton\\Desktop\\testandoTopObjectProperty.owl");
public Set<OWLNamedIndividual> consultarInstanciasDeSuperClasse(String superClasse) {
Set<OWLNamedIndividual> owlNamedIndividual = null;
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLOntology ontology;
try {
ontology = manager.loadOntologyFromOntologyDocument(IRI.create(file));
OWLReasonerFactory reasonerFactory = PelletReasonerFactory.getInstance();
OWLReasoner reasoner = reasonerFactory.createReasoner(ontology, new SimpleConfiguration());
OWLClass owlClass =
ontology
.getOWLOntologyManager()
.getOWLDataFactory()
.getOWLClass(
IRI.create(Configuracoes.getIriBase() + "#" + superClasse));
reasoner.precomputeInferences();
Set<OWLClass> classes = reasoner.getSubClasses(owlClass, false).getFlattened();
System.out.println(classes);
} catch (OWLOntologyCreationException e) {
e.printStackTrace();
}
return owlNamedIndividual;
}
public static void main(String args[]){
SemanticHelper semanticHelper = new SemanticHelper();
semanticHelper.consultarInstanciasDeSuperClasse("IntervaloDeDias");
}
}
次の行で例外がスローされます。
OWLReasoner reasoner = reasonerFactory.createReasoner(オントロジー、新しい SimpleConfiguration());
Exception in thread "main" java.lang.NoSuchMethodError: org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom.getProperty()Lorg/semanticweb/owlapi/model/OWLObjectPropertyExpression;
at com.clarkparsia.pellet.owlapiv3.PelletVisitor.visit(PelletVisitor.java:478)
at uk.ac.manchester.cs.owl.owlapi.OWLObjectSomeValuesFromImpl.accept(OWLObjectSomeValuesFromImpl.java:100)
at com.clarkparsia.pellet.owlapiv3.PelletVisitor.visit(PelletVisitor.java:419)
at uk.ac.manchester.cs.owl.owlapi.OWLObjectIntersectionOfImpl.accept(OWLObjectIntersectionOfImpl.java:90)
at com.clarkparsia.pellet.owlapiv3.PelletVisitor.visit(PelletVisitor.java:1136)
at uk.ac.manchester.cs.owl.owlapi.OWLObjectPropertyRangeAxiomImpl.accept(OWLObjectPropertyRangeAxiomImpl.java:107)
at com.clarkparsia.pellet.owlapiv3.PelletVisitor.visit(PelletVisitor.java:839)
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyImpl.accept(OWLOntologyImpl.java:1516)
at com.clarkparsia.pellet.owlapiv3.PelletReasoner.refresh(PelletReasoner.java:967)
at com.clarkparsia.pellet.owlapiv3.PelletReasoner.<init>(PelletReasoner.java:345)
at com.clarkparsia.pellet.owlapiv3.PelletReasonerFactory.createReasoner(PelletReasonerFactory.java:69)
at com.clarkparsia.pellet.owlapiv3.PelletReasonerFactory.createReasoner(PelletReasonerFactory.java:33)
at br.com.ontologia.SemanticHelper.consultarInstanciasDeSuperClasse(SemanticHelper.java:58)
at br.com.ontologia.SemanticHelper.main(SemanticHelper.java:94)
POM.XML:
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.owlapi</groupId>
<artifactId>pellet-core-ignazio1977</artifactId>
<version>2.4.0-ignazio1977</version>
</dependency>
<dependency>
<groupId>net.sourceforge.owlapi</groupId>
<artifactId>owlapi-distribution</artifactId>
<version>4.1.3</version>
</dependency>
<dependency>
<groupId>net.sourceforge.owlapi</groupId>
<artifactId>pellet-owlapi-ignazio1977</artifactId>
<version>2.4.0-ignazio1977</version>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-bundle</artifactId>
<version>1.19</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20140107</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.19</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>1.19</version>
</dependency>
</dependencies>
この問題を解決する方法についてのヒントを教えてもらえますか?
私のクラスパスのメインファイル
owlapi-distribution-4.1.3
pellet-core-ignazio1977
pellet-owlapi-ignazio1977-2.4.0
pellet-query-ignazio1977-2.4.0
pellet-jena-ignazio1977-2.4.0
jena-arq-2.10.1
jena-core-2.10.1
System.out.println(System.getProperty("java.class.path")); の結果
C:\Users\clayton\workspace\SemanticMDX\target\classes;
C:\apache-tomcat-7.0.34\lib\annotations-api.jar;
C:\apache-tomcat-7.0.34\lib\catalina-ant.jar;
C:\apache-tomcat-7.0.34\lib\catalina-ha.jar;
C:\apache-tomcat-7.0.34\lib\catalina-tribes.jar;
C:\apache-tomcat-7.0.34\lib\catalina.jar;
C:\apache-tomcat-7.0.34\lib\ecj-4.2.1.jar;
C:\apache-tomcat-7.0.34\lib\el-api.jar;
C:\apache-tomcat-7.0.34\lib\jasper-el.jar;
C:\apache-tomcat-7.0.34\lib\jasper.jar;
C:\apache-tomcat-7.0.34\lib\jsp-api.jar;
C:\apache-tomcat-7.0.34\lib\owlapi-distribution-3.5.2.jar;
C:\apache-tomcat-7.0.34\lib\servlet-api.jar;
C:\apache-tomcat-7.0.34\lib\tomcat-api.jar;
C:\apache-tomcat-7.0.34\lib\tomcat-coyote.jar;
C:\apache-tomcat-7.0.34\lib\tomcat-dbcp.jar;
C:\apache-tomcat-7.0.34\lib\tomcat-i18n-es.jar;
C:\apache-tomcat-7.0.34\lib\tomcat-i18n-fr.jar;
C:\apache-tomcat-7.0.34\lib\tomcat-i18n-ja.jar;
C:\apache-tomcat-7.0.34\lib\tomcat-jdbc.jar;
C:\apache-tomcat-7.0.34\lib\tomcat-util.jar;
C:\Users\clayton\.m2\repository\net\sourceforge\owlapi\pellet-core-ignazio1977\2.4.0-ignazio1977\pellet-core-ignazio1977-2.4.0-ignazio1977.jar;
C:\Users\clayton\.m2\repository\com\github\ansell\aterms\aterm-java\1.8.2-p1\aterm-java-1.8.2-p1.jar;
C:\Users\clayton\.m2\repository\com\github\ansell\jjtraveler\jjtraveler\0.6\jjtraveler-0.6.jar;
C:\Users\clayton\.m2\repository\com\github\ansell\aterms\shared-objects\1.4.9-p1\shared-objects-1.4.9-p1.jar;
C:\Users\clayton\.m2\repository\org\jgrapht\jgrapht-jdk1.5\0.7.3\jgrapht-jdk1.5-0.7.3.jar;
C:\Users\clayton\.m2\repository\xerces\xercesImpl\2.11.0\xercesImpl-2.11.0.jar;
C:\Users\clayton\.m2\repository\xml-apis\xml-apis\1.4.01\xml-apis-1.4.01.jar;
C:\Users\clayton\.m2\repository\org\apache\jena\jena-arq\2.10.1\jena-arq-2.10.1.jar;
C:\Users\clayton\.m2\repository\org\apache\jena\jena-core\2.10.1\jena-core-2.10.1.jar;
C:\Users\clayton\.m2\repository\org\apache\jena\jena-iri\0.9.6\jena-iri-0.9.6.jar;
C:\Users\clayton\.m2\repository\org\apache\httpcomponents\httpclient\4.2.3\httpclient-4.2.3.jar;
C:\Users\clayton\.m2\repository\org\apache\httpcomponents\httpcore\4.2.2\httpcore-4.2.2.jar;
C:\Users\clayton\.m2\repository\commons-codec\commons-codec\1.6\commons-codec-1.6.jar;
C:\Users\clayton\.m2\repository\net\sourceforge\owlapi\owlapi-distribution\4.1.3\owlapi-distribution-4.1.3.jar;
C:\Users\clayton\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.5.1\jackson-core-2.5.1.jar;
C:\Users\clayton\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.5.1\jackson-databind-2.5.1.jar;
C:\Users\clayton\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.5.1\jackson-annotations-2.5.1.jar;
C:\Users\clayton\.m2\repository\org\tukaani\xz\1.5\xz-1.5.jar;
C:\Users\clayton\.m2\repository\org\openrdf\sesame\sesame-model\2.7.12\sesame-model-2.7.12.jar;
C:\Users\clayton\.m2\repository\org\openrdf\sesame\sesame-util\2.7.12\sesame-util-2.7.12.jar;
C:\Users\clayton\.m2\repository\org\openrdf\sesame\sesame-rio-api\2.7.12\sesame-rio-api-2.7.12.jar;
C:\Users\clayton\.m2\repository\org\openrdf\sesame\sesame-rio-languages\2.7.12\sesame-rio-languages-2.7.12.jar;
C:\Users\clayton\.m2\repository\org\openrdf\sesame\sesame-rio-datatypes\2.7.12\sesame-rio-datatypes-2.7.12.jar;
C:\Users\clayton\.m2\repository\org\openrdf\sesame\sesame-rio-binary\2.7.12\sesame-rio-binary-2.7.12.jar;
C:\Users\clayton\.m2\repository\org\openrdf\sesame\sesame-rio-n3\2.7.12\sesame-rio-n3-2.7.12.jar;
C:\Users\clayton\.m2\repository\org\openrdf\sesame\sesame-rio-nquads\2.7.12\sesame-rio-nquads-2.7.12.jar;
C:\Users\clayton\.m2\repository\org\openrdf\sesame\sesame-rio-ntriples\2.7.12\sesame-rio-ntriples-2.7.12.jar;
C:\Users\clayton\.m2\repository\org\openrdf\sesame\sesame-rio-rdfjson\2.7.12\sesame-rio-rdfjson-2.7.12.jar;
C:\Users\clayton\.m2\repository\org\openrdf\sesame\sesame-rio-rdfxml\2.7.12\sesame-rio-rdfxml-2.7.12.jar;
C:\Users\clayton\.m2\repository\org\openrdf\sesame\sesame-rio-trix\2.7.12\sesame-rio-trix-2.7.12.jar;
C:\Users\clayton\.m2\repository\org\openrdf\sesame\sesame-rio-turtle\2.7.12\sesame-rio-turtle-2.7.12.jar;
C:\Users\clayton\.m2\repository\org\openrdf\sesame\sesame-rio-trig\2.7.12\sesame-rio-trig-2.7.12.jar;
C:\Users\clayton\.m2\repository\com\github\jsonld-java\jsonld-java-sesame\0.5.0\jsonld-java-sesame-0.5.0.jar;
C:\Users\clayton\.m2\repository\com\github\jsonld-java\jsonld-java\0.5.0\jsonld-java-0.5.0.jar;
C:\Users\clayton\.m2\repository\org\apache\httpcomponents\httpclient-cache\4.2.5\httpclient-cache-4.2.5.jar;
C:\Users\clayton\.m2\repository\org\slf4j\jcl-over-slf4j\1.7.7\jcl-over-slf4j-1.7.7.jar;
C:\Users\clayton\.m2\repository\org\semarglproject\semargl-sesame\0.6.1\semargl-sesame-0.6.1.jar;
C:\Users\clayton\.m2\repository\org\semarglproject\semargl-core\0.6.1\semargl-core-0.6.1.jar;
C:\Users\clayton\.m2\repository\org\semarglproject\semargl-rdfa\0.6.1\semargl-rdfa-0.6.1.jar;
C:\Users\clayton\.m2\repository\org\semarglproject\semargl-rdf\0.6.1\semargl-rdf-0.6.1.jar;
C:\Users\clayton\.m2\repository\net\sf\trove4j\trove4j\3.0.3\trove4j-3.0.3.jar;
C:\Users\clayton\.m2\repository\com\google\guava\guava\18.0\guava-18.0.jar;
C:\Users\clayton\.m2\repository\com\google\inject\guice\4.0\guice-4.0.jar;
C:\Users\clayton\.m2\repository\javax\inject\javax.inject\1\javax.inject-1.jar;
C:\Users\clayton\.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;
C:\Users\clayton\.m2\repository\com\google\inject\extensions\guice-assistedinject\4.0\guice-assistedinject-4.0.jar;
C:\Users\clayton\.m2\repository\com\google\inject\extensions\guice-multibindings\4.0\guice-multibindings-4.0.jar;
C:\Users\clayton\.m2\repository\com\google\code\findbugs\jsr305\2.0.1\jsr305-2.0.1.jar;
C:\Users\clayton\.m2\repository\org\slf4j\slf4j-api\1.7.10\slf4j-api-1.7.10.jar;
C:\Users\clayton\.m2\repository\commons-io\commons-io\2.4\commons-io-2.4.jar;
C:\Users\clayton\.m2\repository\net\sourceforge\owlapi\pellet-owlapi-ignazio1977\2.4.0-ignazio1977\pellet-owlapi-ignazio1977-2.4.0-ignazio1977.jar;
C:\Users\clayton\.m2\repository\net\sourceforge\owlapi\pellet-query-ignazio1977\2.4.0-ignazio1977\pellet-query-ignazio1977-2.4.0-ignazio1977.jar;
C:\Users\clayton\.m2\repository\net\sourceforge\owlapi\pellet-jena-ignazio1977\2.4.0-ignazio1977\pellet-jena-ignazio1977-2.4.0-ignazio1977.jar;
C:\Users\clayton\.m2\repository\org\antlr\antlr-runtime\3.4\antlr-runtime-3.4.jar;
C:\Users\clayton\.m2\repository\org\antlr\stringtemplate\3.2.1\stringtemplate-3.2.1.jar;
C:\Users\clayton\.m2\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar;
C:\Users\clayton\.m2\repository\asm\asm\3.3.1\asm-3.3.1.jar;
C:\Users\clayton\.m2\repository\com\sun\jersey\jersey-bundle\1.19\jersey-bundle-1.19.jar;
C:\Users\clayton\.m2\repository\javax\ws\rs\jsr311-api\1.1.1\jsr311-api-1.1.1.jar;
C:\Users\clayton\.m2\repository\org\json\json\20140107\json-20140107.jar;
C:\Users\clayton\.m2\repository\com\sun\jersey\jersey-server\1.19\jersey-server-1.19.jar;
C:\Users\clayton\.m2\repository\com\sun\jersey\jersey-core\1.19\jersey-core-1.19.jar