0

I get this error message

Error starting application: Error creating query engine Drools. Exception: java.lang.NoSuchMethodError. Message: 'void org.semanticweb.owlapi.util.PriorityCollection.add(java.io.Serializable)'

I am using SWRL API for Java to run SQWRL queries on OWL ontologies. So, I built edu.stanford.swrl swrlapi-example from Maven updating in the pom file the default swrl API and swrlapi-drools-engine from versions 1.0.3 to 2.0.9 and the owl API from default 4.2.3 to 5.1.17. I am runnig this code in the executable main :

OWLOntologyManager ontologyManager = OWLManager.createOWLOntologyManager();

  File file = new File("C:\\Users\\Hugo\\Desktop\\Universidad\\SUPAERO\\S4\\SWRLapiTEST\\Prueba.owl");

  OWLOntology ontology = ontologyManager.loadOntologyFromOntologyDocument(file); 

    ontologyManager.createOntology();

     SQWRLQueryEngine queryEngine = SWRLAPIFactory.createSQWRLQueryEngine(ontology);

The program stops at the last command. I don't know what I am doing wrong. If I use the version 1.0.3 of swrl api and swrlapi-drools-engine it works, bu I wanted to use some commands incuded in the tbox and abox libraries that are not implemented in that ancient version.

HugoMH
  • 51
  • 1

1 Answers1

0

The exception you're seeing is a symptom of multiple incompatible OWLAPI versions in your classpath. Make sure you only have one version in use (5.1.17 from what you say). If you cannot find the problem, please add details on how you're setting your classpath (you can print the java.class.path environment variable at the beginning of your code to get the exact classpath being used).

Ignazio
  • 10,504
  • 1
  • 14
  • 25