I want to build a Java application which will query an ontology using Pellet query but I am new to this field and I encounter some compatibility problems.
The ontology has been constructed using Protege 4 OWL Editor.
I have downloaded owlapi-distribution-3.4.3-bin.jar file from here and added this into my netbeans project. Furthermore I have found the DLExamples.java from here which is very useful to get you started.
For the pellet reasoner I have downloaded pellet-2.3.0.zip from here and added in my netbeans project all the files and folders that there were in pellet-2.3.0/lib (Notice that I am not sure if this is the correct way to add pellet in netbeans but I could not find a better way eg just a single jar file to add).
I found from here that in order to embed pellet reasoner to DLExamples.java I need to replace its lines 151 and 152 with just “return new Reasoner (manager) ” where Reasoner is located in org.mindswap.pellet.owlapi.Reasoner
of pellet library. When I applied that change netbeans complained by saying:
no suitable constructor found for Reasoner(org.semanticweb.owlapi.model.OWLOntologyManager)
constructor Reasoner.Reasoner(org.semanticweb.owl.model.OWLOntologyManager,KnowledgeBase) is not applicable
(actual and formal argument lists differ in length)
constructor Reasoner.Reasoner(org.semanticweb.owl.model.OWLOntologyManager) is not applicable
(actual argument org.semanticweb.owlapi.model.OWLOntologyManager cannot be converted to org.semanticweb.owl.model.OWLOntologyManager by method invocation conversion)
I looked inside org.mindswap.pellet.owlapi.Reasoner
and realised that its constructor definition is indeed
public Reasoner(org.semanticweb.owl.model.OWLOntologyManager manager) {
}
In other words instead of taking as a parameter an org.semanticweb.owlapi.model.OWLOntologyManager
it takes an org.semanticweb.owl.model.OWLOntologyManager
(Notice the difference between owlapi
and owl
packages).
Unless I am not doing something really wrong, there is clearly an incompatibility between owlapi and pellet. That is not normal given that pellet is supposed to provide a reasoner for owlapi right?
Are there any suggestions as to how to solve this problem? Should I switch to a different reasoner? I have tried HermiT too but when I asked a DL query which should have returned both classes and their individuals, it has only returned the classes. So I thought HermiT may not be so powerful and I decided to try Pellet with no success.
Are there any suggestions?
Thanks in advance.