문제

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.

도움이 되었습니까?

해결책

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!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top