2

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.

  • The `DLQueryExample` should handle anonymous class expressions as input (just like in Protege). Could you precise the exact expression you've used as well as including a snippet or link to the ontology you're using? – loopasam May 06 '13 at 23:07
  • @loopasam, thanks for the answer. I tried on the Pizza sample: http://www.co-ode.org/ontologies/pizza/pizza.owl. The query is simple: Pizza and (hasTopping some CheeseTopping), the result is: Loaded ontology: OntologyID(OntologyIRI()) Please type a class expression in Manchester Syntax and press Enter (or press x to exit): Pizza and (hasTopping some CheeseTopping) QUERY: Pizza and (hasTopping some CheeseTopping) SuperClasses [NONE] EquivalentClasses [NONE] SubClasses [NONE] Instances [NONE] – user1823541 May 23 '13 at 18:51
  • Link to the problematic DL query example is now: https://github.com/owlcs/owlapi/blob/version3/contract/src/test/java/org/coode/owlapi/examples/DLQueryExample.java – FBB Feb 04 '16 at 16:11

1 Answers1

4

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!

loopasam
  • 3,027
  • 2
  • 21
  • 22
  • OWL API now provides a documentation regarding this problem: https://github.com/owlcs/owlapi/wiki/DL-Queries-with-a-real-reasoner – FBB Feb 04 '16 at 16:10