Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 130 additions & 24 deletions shacl12-inf-rules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -656,26 +656,42 @@ <h3>Document Conventions</h3>
<tr>
<th>Prefix</th>
<th>Namespace</th>
<th>Informal Name</th>
</tr>
<tr>
<td><code>rdf:</code></td>
<td><code>http://www.w3.org/1999/02/22-rdf-syntax-ns#</code></td>
<td>RDF</td>
</tr>
<tr>
<td><code>rdfs:</code></td>
<td><code>http://www.w3.org/2000/01/rdf-schema#</code></td>
<td>RDFS</td>
</tr>
<tr>
<td><code>srl:</code></td>
<td><code>http://www.w3.org/ns/shacl-rules#</code></td>
<td>SHACL Rules</td>
</tr>
<tr>
<td><code>shnex:</code></td>
<td><code>http://www.w3.org/ns/shnex#</code></td>
<td>SHACL Node Expressions</td>
</tr>
<tr>
<td><code>sh:</code></td>
<td><code>http://www.w3.org/ns/shacl#</code></td>
<td>SHACL</td>
</tr>
<tr>
<td><code>xsd:</code></td>
<td><code>http://www.w3.org/2001/XMLSchema#</code></td>
<td>XML Schema</td>
</tr>
<tr>
<td><code>ex:</code></td>
<td><code>http://example.com/ns#</code></td>
<td>Example</td>
</tr>
</table>
<p>
Expand Down Expand Up @@ -917,39 +933,40 @@ <h2>Concrete Syntax forms for Shapes Rules</h2>
<pre class="example-rules">
PREFIX : &lt;http://example/&gt;
PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
PREFIX shr &lt;http://www.w3.org/ns/shacl-rules#&gt;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so is this now shr or slr?

PREFIX sh: &lt;http://www.w3.org/ns/shacl#&gt;
PREFIX sparql: &lt;http://www.w3.org/ns/sparql#&gt;

:ruleSet-1
rdf:type sh:RuleSet;
sh:data (
rdf:type srl:RuleSet;
srl:data (
&lt;&lt;( :x :p 1 )&gt;&gt;
&lt;&lt;( :x :q 2 )&gt;&gt;
);
sh:ruleSet (
srl:ruleSet (
[
rdf:type sh:Rule;
sh:head (
[ sh:subject [ sh:var "x" ] ; sh:predicate :bothPositive; sh:object true ]
rdf:type srl:Rule;
srl:head (
[ srl:subject [ srl:var "x" ] ; srl:predicate :bothPositive; srl:object true ]
)
sh:body (
[ sh:subject [ sh:var "x" ]; sh:predicate :p; sh:object [ sh:var "v1" ] ]
[ sh:expr [ sparql:greaterThan ( [ sh:var "v1" ] 0 ) ] ]
[ sh:subject [ sh:var "x" ] ; sh:predicate :q; sh:object [ sh:var "v2" ] ]
[ sh:expr [ sparql:greaterThan ( [ sh:var "v2" ] 0 ) ] ]
srl:body (
[ srl:subject [ srl:var "x" ]; srl:predicate :p; srl:object [ srl:var "v1" ] ]
[ srl:expr [ sparql:greaterThan ( [ srl:var "v1" ] 0 ) ] ]
[ srl:subject [ srl:var "x" ] ; srl:predicate :q; srl:object [ srl:var "v2" ] ]
[ srl:expr [ sparql:greaterThan ( [ srl:var "v2" ] 0 ) ] ]
);
]
[
rdf:type sh:Rule;
sh:head (
[ sh:subject [ sh:var "x" ] ; sh:predicate :oneIsZero ; sh:object true ]
rdf:type srl:Rule;
srl:head (
[ srl:subject [ srl:var "x" ] ; srl:predicate :oneIsZero ; srl:object true ]
)
sh:body (
[ sh:subject [ sh:var "x" ] ; sh:predicate :p ; sh:object [ sh:var "v1" ] ]
[ sh:subject [ sh:var "x" ] ; sh:predicate :q ; sh:object [ sh:var "v2" ] ]
[ sh:expr [ sparql:function-or (
[ sparql:equals ( [ sh:var "v1" ] 0 ) ]
[ sparql:equals ( [ sh:var "v2" ] 0 ) ]
srl:body (
[ srl:subject [ srl:var "x" ] ; srl:predicate :p ; srl:object [ srl:var "v1" ] ]
[ srl:subject [ srl:var "x" ] ; srl:predicate :q ; srl:object [ srl:var "v2" ] ]
[ srl:expr [ sparql:function-or (
[ sparql:equals ( [ srl:var "v1" ] 0 ) ]
[ sparql:equals ( [ srl:var "v2" ] 0 ) ]
) ]
]
);
Expand All @@ -971,10 +988,7 @@ <h3>RDF Rules Syntax</h3>
</ul>
</div>
<div class="ednote">
<p>Describe how the abstract model maps to triples??.
way round - copes with extra triples.
Output is the instance of the abtract model that generates the triples -
but need to define "maximal".
<p>Alternative: Describe how the abstract model maps to triples.
</p>
</div>

Expand Down Expand Up @@ -1144,6 +1158,98 @@ <h4>Evaluation of a Rule Set</h4>
</section>
</section>

<section id="drafting">
<h2>Drafting Notes</h2>
<section id="attach-shape-rule">
<h2>Attaching Rules to Shapes</h2>
<div class="ednote">
<p>@@ Discussion</p>
<p>
See SHACL AF <a href="https://www.w3.org/TR/shacl-af/#rules-syntax">`sh:rule`</a>,
which describes <a href="https://w3c.github.io/shacl/shacl-af/index.html#TripleRule">triple rules</a>,
with a special case of <a href="https://w3c.github.io/shacl/shacl-af/index.html#PropertyValueRule"> property value rules</a>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
with a special case of <a href="https://w3c.github.io/shacl/shacl-af/index.html#PropertyValueRule"> property value rules</a>
with special cases
of <a href="https://w3c.github.io/shacl/shacl-af/index.html#PropertyValueRule"> property value rules</a>

and <a href="https://www.w3.org/TR/shacl-af/#SPARQLRule">SPARQL Rules</a> (AKA "CONSTRUCT rules").
</p>
<p><a href="https://github.com/w3c/data-shapes/issues/517">Core issue 517 : classification shapes</a></p>
<p>
How much compatibility?
At one level, nothing needs top done because they have separate evaluation
and it is only a matter of whether an engine supports them or not.
It might be helpful to say when they happen (before 1.2 Rules - seea also defaul values)
and can infer if they generate infered triple.
Comment on lines +1176 to +1179
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
At one level, nothing needs top done because they have separate evaluation
and it is only a matter of whether an engine supports them or not.
It might be helpful to say when they happen (before 1.2 Rules - seea also defaul values)
and can infer if they generate infered triple.
At one level, nothing needs to be done because they have separate evaluation
and it is only a matter of whether an engine supports them or not.
It might be helpful to say when they happen (before 1.2 Rules — see also default values)
and can infer whether they generate inferred triple.

</p>
<ul>
<li>Extends to `rdf:type srl:Rule`</li>
<li>Uses `sh:this` and `$this`
(see <a href="rule-parameterization">Rule Parameterization</a>)</li>
</ul>
</div>
</section>

<section id="rule-parameterization">
<h2>Parameterization</h2>
<div class="ednote">
<p>@@ Discussion</p>
<p> Define a new rule that is another rule with some variables already set</p>
<ul>
<li>Where do the setting come from?</li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<li>Where do the setting come from?</li>
<li>Where do the settings come from?</li>

<li>Is is just one "row" or a data table?</li>
<li>Logically, some `BIND` steps at the start of the rule body</li>
</ul>
</div>
</section>

<section id="evaluation2">
<h2>More on evaluation</h2>
<div class="ednote">
<p>@@ Discussion</p>
<p>The main evaluatiuon description creates all inferred triple using
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<p>The main evaluatiuon description creates all inferred triple using
<p>The main evaluation description creates all inferred triples using

the datalog "naive" algorithm.</p>
<p>Do we need to talk about backward evaluation and stratification?</p>

</div>
</section>

<section id="negation">
<h2>Negation as semi-positive datalog</h2>
<div class="ednote">
<p>@@ Discussion</p>
<p>Negation (e.g. via SPARQL `NOT EXISTS`/`EXISTS`) can allowed if
the pattern is executed only one the base data graph, not including the
inferred graph. i.e. inferred triples are not seen.
Or stratification - not seeing inferred tripels from the current stratum.
Comment on lines +1217 to +1220
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<p>Negation (e.g. via SPARQL `NOT EXISTS`/`EXISTS`) can allowed if
the pattern is executed only one the base data graph, not including the
inferred graph. i.e. inferred triples are not seen.
Or stratification - not seeing inferred tripels from the current stratum.
<p>Negation (e.g., via SPARQL `NOT EXISTS`/`EXISTS`) can be allowed if
the pattern is executed only on the base data graph, not including the
inferred graph, i.e., inferred triples are not seen.
Or stratification not seeing inferred triples from the current stratum.

</p>
<p>Priority for this feature?</p>
</div>
</section>

<section id="other">
<h2>Assignment restrictions</h3>
<div class="ednote">
<p>@@ Discussion</p>
<p>
Assignment takes the rule lanuage outside datalog.
Can we define when it is "safe"? (e.g. triples involving the assignment
are not mentioned in the body of any other rule).
Comment on lines +1231 to +1233
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Assignment takes the rule lanuage outside datalog.
Can we define when it is "safe"? (e.g. triples involving the assignment
are not mentioned in the body of any other rule).
Assignment takes the rule language outside datalog.
Can we define when it is "safe" (e.g., triples involving the assignment
are not mentioned in the body of any other rule)?

</p>
<p>Do we need "order" in the syntax?</p>
</div>
</section>
<section id="tuples">
<h2>Work space named tuples</h3>
<div class="ednote">
<p>@@ Discussion</p>
<p>
Currently, SHACL Rules is, in datatlog-speak, only unnamed 3-tuples.
To support "programming" in rules, should we allow transient (not part of the output,
only during rulset evaluation) named n-tuples? <br/>
e.g. <code>name(termOrVar, ...)</code>, possibly with a unique marker e.g. <code>`</code>
giving <code>`name(termOrVar, ...)</code>.
Comment on lines +1243 to +1247
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Currently, SHACL Rules is, in datatlog-speak, only unnamed 3-tuples.
To support "programming" in rules, should we allow transient (not part of the output,
only during rulset evaluation) named n-tuples? <br/>
e.g. <code>name(termOrVar, ...)</code>, possibly with a unique marker e.g. <code>`</code>
giving <code>`name(termOrVar, ...)</code>.
Currently, SHACL Rules are, in datatlog-speak, only unnamed 3-tuples.
To support "programming" in rules, should we allow transient (not part of the output,
only during rulset evaluation) named n-tuples? <br/>
e.g., <code>name(termOrVar, ...)</code>, possibly with a unique marker, e.g.,
<span class="codepoint" translate="no"><bdi lang="en">&#x0060;</bdi>
<code class="uname">U+0060 grave accent</code></span>
giving <code>`name(termOrVar, ...)</code>.

</p>
</div>
</section >
</section>

<section id="shapes-rules-grammar">
<h2>Shapes Rules Language Grammar</h2>

Expand Down