SHACL Rules - discussion of scope and direction #295
Replies: 6 comments 12 replies
-
There also needs to be a clear guidance wrt. execution order of
ex:RuleShape1 #S1
a sh:NodeShape ;
sh:targetClass ex:Person ;
sh:rule [ #S1R1
a sh:SPARQLRule ;
sh:prefixes ex: ;
sh:order 1 ;
sh:construct """
...
"""
] ;
sh:rule [ #S1R2
a sh:SPARQLRule ;
sh:prefixes ex: ;
sh:order 2 ;
sh:construct """
...
"""
] .
ex:RuleShape2 #S2
a sh:NodeShape ;
sh:targetClass ex:Person ;
sh:rule [ #S2R1
a sh:SPARQLRule ;
rdfs:label "Infer uncles, i.e. male siblings of the parents of $this" ;
sh:prefixes ex: ;
sh:order 2 ;
sh:construct """
...
"""
] ;
sh:rule [ #S2R2
a sh:SPARQLRule ;
rdfs:label "Infer cousins, i.e. the children of the uncles" ;
sh:prefixes ex: ;
sh:order 4 ;
sh:construct """
...
"""
] .
e.g. pyshacl processes NodeShapes "chronologically" (from top to bottom), whereas jena is processing them alphabetically. |
Beta Was this translation helpful? Give feedback.
-
@simonstey - I agree with needing to specify execution order, also including when Node Expressions should be evaluated, and whether they may need to be re-evaluated. I see three executions to sequence, each of which might be able to affect one another:
|
Beta Was this translation helpful? Give feedback.
-
This is part of taming CONSTRUCT-based rules. What I think is needed is a restriction to collection of triple pattern matches - NodeExpressions as filters - making new RDF terms. That's not to say |
Beta Was this translation helpful? Give feedback.
-
That would be TopBraid SHACL?
|
Beta Was this translation helpful? Give feedback.
-
I think having |
Beta Was this translation helpful? Give feedback.
-
work-in-progress : incomplete and inconsistent. Subject to change without warning.
https://gist.github.com/afs/2547eac679b1411acc078959ac2b3d31 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
SHACL Rules
SHACL rules infer new triples. The input is a data graph and a shape graph with rules, the output is a graph of inferred triples.
Whether, and how, the output graph is added back into the data graph is a separate decision.
The design must respect both simple implementations as well as implementations focused on performance and scale.
The data graph may be large (= impractical in main memory). The shapes graph is assumed to be small enough it can be read and processed in memory.
There may be thousands of rules. (Generated mappings between datasets can easily have a large numbers of rules.)
Syntax examples are not real, nor consistent; they are just for illustration and intentionally different from reality.
SHACL Rules so far
SHACL-AF has
CONSTRUCT
)and we now have Derived properties which use Node Expressions as generators of lists of nodes.
Targets are themselves "generators" - they are a pattern such as
?target sh:targetClass :SomeClass
generating a collection of nodes.Requirements
Please add use cases as issues, labelled with "Inferencing" and "UCR". Do not worry about overlaps or duplicates.
https://github.com/w3c/data-shapes/issues?q=is%3Aissue%20state%3Aopen%20label%3AInferencing%20label%3AUCR
sh:entailment
, and strategies for describing entailment satisfaction #219Specific domains:
"The latter is left to future work"
This comment in SHACL-AF is about rules depending on inferred triples from other rules. The future has arrived.
One part of this is taming CONSTRUCT-based rules.
NOT EXISTS
), value negation (FILTER(?x != <uri>)
) and creating new RDF terms, all of which affect evaluation when rules depend other rules.Outline
Datalog1 provides well-understood evaluation properties and there are various algorithms for execution ranging from simple-to-implement to complex. We are not starting from scratch.
Out of scope
Note about transitivity
The rule for a transitive property is recursive. But it is a specific case of general recursive rules and might be a special case so we could have a profile that is "non-recursive + transitive properties".
The full rule:
might be written:
Footnotes
See, for example, part D in the book Foundations of Databases (chapters 12 to 15).
Many university course notes and slides are online. ↩
Beta Was this translation helpful? Give feedback.
All reactions