So this is my first question on this board, please forgive me if it is naive.
Basically, it seems to me that the reasoning engine of GraphDB takes all triples inside named graphs and duplicates them within the nil graph, and then proceeds to make inferences directly inside the nil graph only. I do not know exactly, but it does not seem the correct way to handle inferences.
Consider the following trivial example:
INSERT DATA {
:Dog rdfs:subClassOf :Mammal.
GRAPH :G1 {
:Lassie a :Dog.
}
}
I am using the OWL2-RL ruleset for inferences. If I query it with inferences on, it returns 805 statements, not shown here, but if I filter just the interesting ones with the following query:
SELECT * WHERE {
{
{
GRAPH ?g { ?s ?p ?o. }
} UNION {
GRAPH <http://rdf4j.org/schema/rdf4j#nil> { ?s ?p ?o. }
BIND ("-" AS ?g)
}
}
FILTER ( !(
strstarts(str(?s), "http://www.w3.org/2002/07/owl#") ||
strstarts(str(?s), "http://www.w3.org/2000/01/rdf-schema#") ||
strstarts(str(?s), "http://www.w3.org/2001/XMLSchema#") ||
strstarts(str(?s), "http://www.w3.org/1999/02/22-rdf-syntax-ns#") ||
strstarts(str(?o), "http://www.w3.org/2002/07/owl#Thing") ||
false
))
}
the reasoning engine returns 9 statements, and interestingly one appears twice:
g | s | p | o |
---|---|---|---|
:G1 | :Lassie | rdf:type | :Dog |
"-" | :Lassie | rdf:type | :Dog |
(The BIND ("-" as ?g)
hack in the second branch of the UNION is to make sure the "-" results actually come from the 'nil' graph and they are not artefacts of the SPARQL query)
Basically, there are now TWO statements :Lassie a :Dog.
, one inside :G1 and the other in the "nil" graph. The second one is clearly the result of the inference engine, since if I deactivate it I correctly only receive the original statements. So it is an inference.
Yet, I was unable to identify the rule in the file "builtin_owl2-rl.pie" that controls this inference (which I find it is unwarranted and ultimately incorrect).
Is there a way to exclude the generation of the statement in the 'nil' graph, or at least to activate-deactivate it in the ruleset?
Thank you
FV
The Proof plugin is not able to help either, since proof:explain
only allows three instead of four parameters, and therefore it does not allow to specify the context of the statement to be proofed. As such it simply returns twice that the statement :Lassie a :Dog.
is explicit, which is ALSO WRONG.
PREFIX proof: <http://www.ontotext.com/proof/>
SELECT * WHERE {
{
GRAPH ?g { ?s ?p ?o. }
} UNION {
GRAPH <http://rdf4j.org/schema/rdf4j#nil> { ?s ?p ?o. }
BIND ("-" AS ?g)
}
FILTER ( !(
strstarts(str(?s), "http://www.w3.org/2002/07/owl#") ||
strstarts(str(?s), "http://www.w3.org/2000/01/rdf-schema#") ||
strstarts(str(?s), "http://www.w3.org/2001/XMLSchema#") ||
strstarts(str(?s), "http://www.w3.org/1999/02/22-rdf-syntax-ns#") ||
strstarts(str(?o), "http://www.w3.org/2002/07/owl#Thing") ||
false
))
?ctx proof:explain (?s ?p ?o) .
?ctx proof:rule ?rule .
}
returns
g | s | p | o | ctx | rule |
---|---|---|---|---|---|
:G1 | :Lassie | rdf:type | :Dog | _:8017b441a12c4c6eab8466163d0587c7154718 | "explicit" |
"-" | :Lassie | rdf:type | :Dog | _:8017b441a12c4c6eab8466163d0587c7154719 | "explicit" |