Improvements from rules document review#916
Conversation
4ab784a to
a2fe08a
Compare
53f629d to
fd47acc
Compare
simonstey
left a comment
There was a problem hiding this comment.
also, the namespace of shnex should be http://www.w3.org/ns/shacl-node-expr# (at least that's what the nodeexpr test cases also use.
(needs fix to be fixed in rdf-syntax-shapes.ttl )
We use:
- "SHACL Rules Language (SRL)" (line 182, line 680),
- "Shape Rules Language (SRL)" (1317, 1322, 1388),
- "Shapes Rules Language" (1957),
- ("Shape Rules Abstract Syntax" (675))
what's the canonical final expansion of SRL?
| ## Partition each level into once and general | ||
| let stratumLevels be a sequence of pairs of sets of rules. | ||
| for i = 0 to maxStratum: | ||
| let rules = stratumLevels.get(i) |
There was a problem hiding this comment.
| let rules = stratumRules.get(i) |
shouldn't this be stratumRules?
| for each <var>μ</var><sub>1</sub> in X: | ||
| for each <var>μ</var><sub>2</sub> in SEQ: | ||
| if compatible(<var>μ</var><sub>1</sub>, <var>μ</var><sub>2</sub>) | ||
| <var>μ</var><sub>3</sub> = merge(<var>μ</var>1, <var>μ</var><sub>2</sub>) |
There was a problem hiding this comment.
| <var>μ</var><sub>3</sub> = merge(<var>μ</var><sub>1</sub>, <var>μ</var><sub>2</sub>) |
broken subscript
| and in order befoer moving onm to the next [=stratum=]. | ||
| A [=stratum=] is evaluated by first evaluating | ||
| each of the [=run-once rule=] of that stratum, and then evaluating | ||
| [=general rules=] of thestratum repeatedly until no new triples are produced. |
There was a problem hiding this comment.
we do not have a corresponding definition (i.e. ) for general rules yet
There was a problem hiding this comment.
| [=general rules=] of thestratum repeatedly until no new triples are produced. | |
| [=general rules=] of the stratum repeatedly until no new triples are produced. |
also
| of `R1` depends on `R2`. | ||
| The dependency is an [=open dependency=] if `R1` does not have an | ||
| [=assignment element=] and if all the [=triple patterns=] | ||
| of `R1` that depend `R2` occur only as [=triple pattern elements=] |
There was a problem hiding this comment.
| of `R1` that depend on `R2` occur only as [=triple pattern elements=] |
| :father rdfs:subClassOf: :familyRelationship . | ||
| :monther rdfs:subClassOf: :familyRelationship . |
There was a problem hiding this comment.
| :father rdfs:subClassOf: :familyRelationship . | |
| :monther rdfs:subClassOf: :familyRelationship . | |
| :father rdfs:subClassOf :familyRelationship . | |
| :mother rdfs:subClassOf :familyRelationship . |
| <p> | ||
| Rules involving assignment are [=run-once rules=]. Rules with assignment | ||
| are run after all the rules that could produce the data that they depend on | ||
| Rules involving [assignments] and rules that create blank nodes in their [=rule head=] are [=run-once rules=]. |
There was a problem hiding this comment.
| Rules involving [assignments] and rules that create blank nodes in their [=rule head=] are [=run-once rules=]. | |
| Rules involving [=assignment elements=] and rules that create blank nodes in their [=rule head=] are [=run-once rules=]. |
| [=stratification=] of the rule set, where each stratum is executed completely | ||
| and in order befoer moving onm to the next [=stratum=]. | ||
| A [=stratum=] is evaluated by first evaluating | ||
| each of the [=run-once rule=] of that stratum, and then evaluating |
There was a problem hiding this comment.
| each of the [=run-once rule=] of that stratum, and then evaluating | |
| each of the [=run-once rules=] of that stratum, and then evaluating |
|
|
||
| <p>A conforming | ||
| <dfn | ||
| data-lt="shapes rules language document|shapes rules document|ruleset document" |
There was a problem hiding this comment.
| data-lt="shapes rules language document|shapes rules document|ruleset document|shapes rules language documents|shapes rules documents|ruleset documents" |
added plural forms
| if rElt is a negation expression with body elements N: | ||
| SEQ1 = {} | ||
| for each solution <var>μ</var> in SEQ: | ||
| S = sequence{ <var>μ</var> } | ||
| NEG = evalRuleElements(N, S, G) | ||
| if NEG is empty | ||
| add <var>μ</var> to SEQ1 | ||
| endif | ||
| endfor | ||
| endif | ||
|
|
||
| if rElt is an assignment with variable V and expression expr | ||
| SEQ1 = {} | ||
| for each solution S in SEQ: | ||
| let x = evalFunction(expr, S) | ||
| if x is not an error: | ||
| add(V, x) to S | ||
| add S to SEQ1 | ||
| else | ||
| # Error: drop solution S | ||
| endif | ||
| endfor | ||
| endif |
There was a problem hiding this comment.
the latter algo uses a bare S for a single solution, while S is also used as a one-element sequence in the negation branch => we should align those two
There was a problem hiding this comment.
earlier we state:
let rule R = (H, B) where
H is the sequence of triple templates in the head
B is the sequence of triple pattern elements,
condition elements, negation elements,
and assignment elements in the body
which binds H to the head templates.
But here:
# Evaluate rule head
let H = empty set
for each <var>μ</var> in SEQ:
we then reuse H as the output-triple accumulator.
and here: for each triple template TT in head we refer to "head" (which is in theory not bound anymore)
suggestion:
| # Evaluate rule head | |
| let HOut = empty set | |
| for each <var>μ</var> in SEQ: | |
| for each triple template TT in H: | |
| add subst(<var>μ</var>, TT) to HOut | |
| result eval(R, G) is HOut |
Where is it wrong in the spec? I could only find it in the "Document Conventions" and it is BTW: #496 (comment)
Added to the changes. |
Improvements from rules document review