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!