Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce inference and optimization for dt-diff #27

Open
wrobell opened this issue Nov 29, 2018 · 1 comment
Open

Introduce inference and optimization for dt-diff #27

wrobell opened this issue Nov 29, 2018 · 1 comment

Comments

@wrobell
Copy link
Contributor

wrobell commented Nov 29, 2018

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

  • triple 1: (s, p, 11)
  • triple 2: (s, p, 12)
  • rule cls-maxc2: (11, owl:sameAs, 12)
  • rule dt-diff (missing at the moment): (11, owl:differentFrom, 12)
  • rule eq-diff1 (not triggered due to dt-diff missing): false

Because 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 of dt-diff and cls-maxc2 triples.

@nicholascar
Copy link
Member

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants