Question

I'm using OWL API for reasoning over ontology created in Protege. I'm dealing with OWL API Example DL query: http://sourceforge.net/p/owlapi/code/ci/aef6981535f07a2d0d44c394b9f4d5415f36025a/tree/contract/src/test/java/org/coode/owlapi/examples/DLQueryExample.java. I guess that this example provides functionality equivalent to DL Query Tab in Protege. But in fact there are some significant differences: I need to get the information (subclass, superclass, etc.) of an anonymous class, which is defined by a set of individuals (ex {Member1, Member2...}) or in another way. In Protege this query returns correct result, but such query in OWL API Dl Query Example returns [NOTHING]. Is there a way to manipulate anonymous classes in OWL API? Thanks in advance for answering.

Was it helpful?

Solution

Assuming you are using the class DLQueryExample as such without modifications.

You need to use a different reasoner than the default one. Look at line 151, the implementation uses the structural reasoner built in the OWL-API. This reasoner is limited and not capable of processing complex class expressions as yours.

How to fix it:

Use a more advanced reasoner like Hermit. Download and put the jar on your classpath, then replace the code at line 151 by that:

OWLReasonerFactory reasonerFactory = new Reasoner.ReasonerFactory();

You will need to import the package org.semanticweb.HermiT.Reasoner. You will now use Hermit to process your queries. Try Pizza and (hasTopping some CheeseTopping), it should work!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top