OWL 2 RL is a subset of OWL 2 which is amenable to implementation using rule-based technologies. Here I implement an OWL 2 RL reasoner with DLV.
The only predicate that we are going to use is t(S, P, O)
which represents a triple with subject S, predicate P and object O. In order to distinguish between
IRIs, literals and blank nodes we can use the function symbols iri, literal and bnode.
For example, the triples:
ex:bob foaf:knows _:x .
_:x foaf:age 21 .
can be represented as
t(iri("ex:bob"), iri("foaf:knows"), bnode("_:x")).
t(bnode("_:x"), iri("foaf:age"), literal("21")).
Here I have listed all the rules implemented. Parts 7, 10 and 11 extend OWL 2 RL reasoning with features of DLV such as NAF and disjunction.
- RDFS rules: prp-dom, prp-rng, scm-spo, prp-spo1, cax-sco, scm-sco.
- Equality and class axioms: eq-sym, eq-trans, eq-rep-s, eq-rep-p, eq-rep-o, eq-diff1, cax-eqc1, cax-eqc2, and cax-dw.
- Axioms about properties: prp-fp, prp-ifp, prp-irp, prp-symp, prp-asyp, prp-trp, prp-inv1, and prp-inv2.
- Boolean operations (simplified): cls-com, cls-int1-s, cls-int2-s, cls-uni-s.
- Existential and universal restrictions: cls-svf1, cls-svf2, cls-avf.
- Semantics of schema vocabulary: scm-dom1, scm-dom2, scm-rng1, scm-rng2.
- Disjunction in the head (simplified): cls-uni-dlv-s
- Boolean operations: cls-int1, cls-int2 and cls-uni.
- AllDifferent and AllDisjointClasses: eq-diff2, eq-diff3, cax-adc.
- Disjunction in the head: cls-uni-dlv.
- Universal restriction with the closed world assumption: cls-avf-cw
- DLV.
For running the OWL2_RL reasoner on your knowledge base you need to print in the terminal the path to the DLV executable, the path to the file "OWL2_RL_reasoner_with_DLV.dlv" and the path to the file containing your knowlege base
<path-to\dlv-executable> <path-to\OWL2_RL_reasoner_with_DLV.dlv> <path-to\your-kb>