Open wrobell opened 5 years ago
Hi @wrobell with the recent release of rdflib 5.0.0, we might look into OWL-RL Issues.
Can you comment on this code to test for what we should be seeing as a test for this (which will currently fail due to missing axiom:
from rdflib import Graph, URIRef, Literal
from rdflib.namespace import OWL
from owlrl import DeductiveClosure, OWLRL_Semantics
g = Graph()
g.add((
URIRef("a:"),
URIRef("b:"),
Literal("11"),
))
g.add((
URIRef("a:"),
URIRef("b:"),
Literal("12"),
))
DeductiveClosure(OWLRL_Semantics).expand(g)
assert ((Literal("11"), OWL.differentFrom, Literal("12"))) in g
assert ((Literal("11"), OWL.sameAs, Literal("12"))) not in g
both assert
statements currently fail; not even the cls-maxc2
seems to be working in this test case.
Once we have the test case for what should be seen, we can work on implementing it then perhaps optimising it.
(I fear that the major work needed here is actually a check of the OWL-RL documentation to remind us (me) of what is and isn't supported now, before patches/updates are made.)
The inference for
dt-diff
rule is missing in OWL-RL at the moment (see https://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Graphs_using_Rules for the rule definition).The rule is important, because it allows to infer an error when a subject and predicate (data property) violate the 1 max cardinality. For example
(s, p, 11)
(s, p, 12)
cls-maxc2
:(11, owl:sameAs, 12)
dt-diff
(missing at the moment):(11, owl:differentFrom, 12)
eq-diff1
(not triggered due todt-diff
missing): falseBecause
dt-diff
is not implemented we end up with(11, owl:sameAs, 12)
in the graph only - this is without the(11, owl:differentFrom, 12)
and the error.We could implement inference for
dt-diff
, but it will create a lot of trivial triples in a graph. We should probably immediately optimise this and whenever we have triples like(s, p, l1)
and(s, p, l2)
generate an error avoiding generation ofdt-diff
andcls-maxc2
triples.