Open mkroetzsch opened 6 years ago
Actually it would be good to have several examples here, e.g, one for CQ answering, and one for computing all atomic class subsumptions.
added an example of reasoning with an OWL ontology in OwlOntologyToRulesAndFacts
(vlog4j-examples
module).. This example includes transforming an OWL ontology to rules and facts, reasoning with these rules and facts, and answering atomic queries.
Detailed description of solving CQ answering using VLog:
VLog's Reasoner
method QueryResultIterator answerQuery(@NonNull Atom queryAtom, boolean includeBlanks)
is not equivalent to a answering a CQ over
queryAtom
are free, and therefore are answer variablesincludeBlanks
is true
. Setting includeBlanks
to false
filters out answers which contain unnamed individuals from the query result. To solve CQ answering on an OWL Ontology using VLog:
vlog4j-owlapi
Given a conjunctive query
q=\exists \vec{v} . B[\vec{x}, \vec{v}]
where B is a conjunction of atoms containing only variables from \vec{x} and \vec{v}, add to the program rule
Answer_q(\vec{x}) :- B[\vec{x}, \vec{v}]
where Answer_q is a fresh predicate that will contain all the answers over answer variables of q.
reason()
on the reasoner objectanswerQuery(Answer_q(\vec{x}), false)
The setting includeBlanks=false is needed because conjunctive queries do not allow mapping answer variables to unnamed individuals (blanks, in our case).
The results given by returned QueryResultIterator
are the answers to the given conjunctive query q.
Detailed description of computing all atomic class subsumptions:
reason()
answerQuery(A(x), true)
, the boolean query answerQuery(B(c), true)
(or, in this case, answerQuery(B(c), false)
should give the same answers) has results, then A is a subclass of B.
We are still lacking an example for how to use the OWL API for reasoning with OWL. This could be modelled after the evaluations.