Skip to content

Commit

Permalink
ISSUE-170: Removed dependency on SPARQL EXISTS
Browse files Browse the repository at this point in the history
  • Loading branch information
HolgerKnublauch committed Jan 12, 2017
1 parent a54c661 commit 66729cf
Showing 1 changed file with 9 additions and 41 deletions.
50 changes: 9 additions & 41 deletions shacl/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ <h2>Revision History</h2>
The detailed list of changes and their diffs can be found in the <a href="https://github.com/w3c/data-shapes/commits/gh-pages/shacl/index.html">Git repository</a>.
</p>
<ul>
<li><b>2017-01-12</b>: Removed dependency on SPARQL EXISTS (<a href="http://www.w3.org/2014/data-shapes/track/issues/170">ISSUE-170</a>)</li>
<li><b>2017-01-12</b>: Renamed sh:Shape to sh:NodeShape, sh:PropertyConstraint to sh:PropertyShape and sh:Constraint to sh:Shape. Targets can now be applied to every such shape. The term "constraint" now refers to parameter values at a shape. Limited sh:sourceConstraint to SPARQL-based constraints. Renamed sh:shapeValidator to sh:nodeValidator. Other related changes. (<a href="http://www.w3.org/2014/data-shapes/track/issues/211">ISSUE-211</a>)</li>
<li><b>2017-01-12</b>: Moved SPARQL-based targets, derived properties and functions into a separate document (not normative WG note) to reduce scope, switched to using SHACL-SPARQL for Core + SPARQL-based constraints and components</li>
<li><b>2017-01-10</b>: Added syntax highlighting to make syntax rules (ill-formed shapes) more explicit</li>
Expand Down Expand Up @@ -2504,7 +2505,7 @@ <h4>sh:languageIn</h4>
the <a href="https://www.w3.org/TR/sparql11-query/#func-langMatches">SPARQL langMatches</a> function.
</div>
</div>
<div class="def def-sparql">
<!-- div class="def def-sparql">
<div class="def-header">SPARQL DEFINITION (Must evaluate to true for each value node $value)</div>
<pre class="def-sparql-body">
ASK {
Expand All @@ -2516,7 +2517,7 @@ <h4>sh:languageIn</h4>
}
}
}</pre>
</div>
</div-->
<p>
The following example shape states that all values of <code>ex:prefLabel</code>
can be either in English or Māori.
Expand Down Expand Up @@ -2574,7 +2575,7 @@ <h4>sh:uniqueLang</h4>
used by at least two <a>value nodes</a>.
</div>
</div>
<div class="def def-sparql">
<!-- div class="def def-sparql">
<div class="def-header">SPARQL DEFINITION (Must return no results for the given $PATH)</div>
<pre class="def-sparql-body">
SELECT DISTINCT $this ?lang
Expand All @@ -2590,7 +2591,7 @@ <h4>sh:uniqueLang</h4>
FILTER (?otherValue != ?value &amp;&amp; ?lang = lang(?otherValue)) .
}
}</pre>
</div>
</div-->
<pre class="example-shapes">
ex:UniqueLangExampleShape
a sh:NodeShape ;
Expand Down Expand Up @@ -3353,7 +3354,7 @@ <h3>sh:closed, sh:ignoredProperties</h3>
and the object of the triple as its <code>sh:value</code>.
</div>
</div>
<div class="def def-sparql">
<!-- div class="def def-sparql">
<div class="def-header">SPARQL DEFINITION (Must return no results)</div>
<pre class="def-sparql-body">
SELECT $this (?predicate AS ?path) ?value
Expand All @@ -3372,7 +3373,7 @@ <h3>sh:closed, sh:ignoredProperties</h3>
}
}))
}</pre>
</div>
</div -->
<p>
The following example illustrates the use of <code>sh:closed</code> in a shape to specify the condition
that certain focus nodes only have values for <code>ex:exampleProperty1</code> and <code>ex:exampleProperty2</code>.
Expand Down Expand Up @@ -3426,14 +3427,14 @@ <h4>sh:hasValue</h4>
A <a>validation result</a> MUST be produced if the RDF term specified by <code>sh:hasValue</code> is not among the <a>value nodes</a>.
</div>
</div>
<div class="def def-sparql">
<!-- div class="def def-sparql">
<div class="def-header">SPARQL DEFINITION (Must return no results for the given $PATH)</div>
<pre class="def-sparql-body">
SELECT $this
WHERE {
FILTER NOT EXISTS { $this $PATH $hasValue }
}</pre>
</div>
</div-->
<pre class="example-shapes">
ex:StanfordGraduate
a sh:NodeShape ;
Expand Down Expand Up @@ -4099,38 +4100,6 @@ <h3>Validators based on SPARQL ASK Queries</h3>
The ASK queries return <code>true</code> if and only if a given <a>value node</a>
(represented by the pre-bound variable <code>value</code>) conforms to the constraint.
</p>
<p>
Prior to evaluation, a SHACL-SPARQL processor transforms the provided ASK query into a SELECT query using the following templates.
The resulting SELECT query can then be evaluated using the same algorithm as for <a href="#SPARQLSelectValidator-evaluation">SELECT-based validators</a>.
The processor drops the ASK keyword, any top-level dataset clauses and solution modifiers, leaving only the <code>GroupGraphPattern</code> including the outermost <code>{...}</code> pair.
This block then substitutes <code>...</code> in the template.
</p>
<p>Template for <code>sh:NodeShape</code> context:</p>
<pre>
SELECT $this ?value
WHERE {
BIND ($this AS ?value) .
FILTER NOT EXISTS ...
}</pre>
<p>Template for <code>sh:PropertyShape</code> context:</p>
<pre>
SELECT DISTINCT $this ?value
WHERE {
$this $PATH ?value .
FILTER NOT EXISTS ...
}</pre>
<div class="issue" data-number="170" title="SPARQL EXISTS">
The WG is awaiting input from the <a href="https://www.w3.org/community/sparql-exists/">SPARQL Maintenance (EXISTS) Community Group</a>
on potential changes to the semantics of EXISTS.
</div>
<p>
Note that the template above includes a <code>DISTINCT</code> keyword because a SPARQL path expression may
return the same <code>?value</code> multiple times, yet each <a>value node</a> is only validated once.
</p>
<p>
Once the corresponding template has been applied, the resulting SELECT query will be evaluated using the same approach as outlined <a href="#SPARQLSelectValidator-evaluation">above</a>.
Actual SHACL implementations may of course use a different approach internally, as long as the results are equivalent to the described approach.
</p>
<p>
The following example declares a constraint component using an ASK query.
</p>
Expand Down Expand Up @@ -4186,7 +4155,6 @@ <h2>Pre-binding of Variables in SPARQL Queries</h2>
<p class="issue" data-number="68" title="Pre-binding of Variables in SPARQL">
The following definition of what pre-binding means has not been approved by the WG yet,
and is work in progress.
The WG is also awaiting input from the <a href="https://www.w3.org/community/sparql-exists/">SPARQL Maintenance (EXISTS) Community Group</a>.
</p>
<p>
Some features of the SPARQL-based extension mechanism of SHACL-SPARQL rely on the concept of <dfn data-lt="pre-binding|pre-bind|pre-bound|pre-bound variables|pre-binds">pre-binding of variables</dfn>.
Expand Down

0 comments on commit 66729cf

Please sign in to comment.