Skip to content

Commit

Permalink
Edits to section 7 in response to https://lists.w3.org/Archives/Publi…
Browse files Browse the repository at this point in the history
  • Loading branch information
HolgerKnublauch committed Nov 28, 2016
1 parent 71caba4 commit 9e3c9c4
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions shacl/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4061,23 +4061,26 @@ <h3>Evaluation</h3>
<section id="sparql-targets">
<h2>SPARQL-based Targets (sh:target)</h2>
<p>
SHACL Full provides facilities to specify custom targets.
SHACL Full provides facilities to specify custom targets, using <code>sh:target</code>.
Similar to constraints, targets may either be <a href="#SPARQLTarget"><span class="term">SPARQL-based targets</span></a> or
<a href="#SPARQLTargetType"><span class="term">SPARQL-based target types</span></a> in a higher-level vocabulary.
All subjects of <code>sh:target</code> triples must be IRIs.
</p>
<section id="SPARQLTarget">
<h3>Targets using sh:SPARQLTarget</h3>
<p>
SPARQL-based targets must be <a>SHACL instances</a> of <code>sh:SPARQLTarget</code>, which is a <a>SHACL subclass</a> of <code>sh:Target</code>.
The SPARQL queries linked to a <a>target</a> via <code>sh:select</code> must be of the query form <code>SELECT</code>.
The SELECT queries must project to the result variable <code>this</code>.
The resulting target consists of all distinct bindings for the variable <code>this</code>.
The SPARQL queries linked to a <a>target</a> via <code>sh:select</code> must be of the query form <code>SELECT</code> (after applying the <a href="#sparql-prefixes">prefix handling rules</a>).
The SELECT queries must return the result variable <code>this</code> as the only result variable.
The resulting <a>focus nodes</a> are the distinct bindings for the variable <code>this</code>.
</p>
<p>
The SELECT queries must also be executable when converted to an ASK query and with a pre-bound value for <code>?this</code>.
The set of bindings for <code>?this</code> that return <code>true</code> for such ASK queries must be identical to the set produced by the SELECT query.
This design makes sure that SHACL Full processors can validate whether a given shape applies to a given individual focus node.
While the SELECT queries can be used to identify all focus nodes for a given shape, SHACL processors sometimes also need to find all shapes for which a given node needs to be validated against.
For this reason, the following semantic restriction applies to SELECT queries used in SPARQL-based targets.
Informally, SHACL Full processors can derive an equivalent ASK query from the SELECT query, pre-bind the potential focus node, and check whether the node needs to be validated against the shape that has the given target.
Formally, let <code>A</code> be a SPARQL ASK query that is produced by replacing the <a href="https://www.w3.org/TR/sparql11-query/#rSelectClause">SelectClause</a> with <code>ASK</code> in the outermost SELECT query.
Let <code>rs</code> be the set of nodes returned as <a>bindings</a> for the variable <code>this</code> in the result table of the SELECT query.
Then <code>A</code> must return <code>true</code> if and only if the variable <code>this</code> is <a href="#pre-binding">pre-bound</a> with a value from <code>rs</code>.
SHACL Full processors MAY produce a failure if this rule is violated.
</p>
<p>
The following example illustrates a well-formed SPARQL-based target that produces all persons born in the USA:
Expand All @@ -4101,11 +4104,15 @@ <h3>Targets using sh:SPARQLTarget</h3>
<h3>SPARQL-based Target Types</h3>
<p>
The class <code>sh:TargetType</code> can be used to declare high-level vocabularies for targets.
Similar to constraint components, such targets take <a>parameters</a> that are interpreted when the target is evaluated.
The class <code>sh:SPARQLTargetType</code> is an <code>rdfs:subClassOf sh:TargetType</code> for target types that specify a SPARQL SELECT query via the property <code>sh:select</code>.
Similar to constraint components, the parameter values become <a href="#pre-binding">pre-bound variables</a> in such SPARQL queries.
The class <code>sh:SPARQLTargetType</code> is an <code>rdfs:subClassOf sh:TargetType</code> for target types based on SPARQL.
Instances of this class must specify a SPARQL SELECT query via the property <code>sh:select</code>,
and this query must fulfill the same syntactic and semantic rules as <a href="#SPARQLTarget">SPARQL-based Targets</a>.
</p>
<p>
Similar to constraint components, such targets take <a>parameters</a> and
the parameter values become <a href="#pre-binding">pre-bound variables</a> in the associated SPARQL queries.
The parameter values of such targets must not be blank nodes.
All parameters of target types are expected to have <code>sh:maxCount 1</code>.
All parameters of target types must have at most one value for the same subject.
Similar to constraint components, target types may also have values for the property <a href="#labelTemplate"><code>sh:labelTemplate</code></a>.
</p>
<p>
Expand Down

4 comments on commit 9e3c9c4

@kcoyle
Copy link
Contributor

@kcoyle kcoyle commented on 9e3c9c4 Nov 30, 2016

Choose a reason for hiding this comment

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

"While the SELECT queries can be used to identify all focus nodes for a given shape, SHACL processors sometimes also need to find all shapes for which a given node needs to be validated against."

Not at all clear what this means. Please give a fuller explanation, then we can try to work out the wording.

@kcoyle
Copy link
Contributor

@kcoyle kcoyle commented on 9e3c9c4 Nov 30, 2016

Choose a reason for hiding this comment

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

"All parameters of target types must have at most one value for the same subject."

-> Parameters of target types [what's a "target type"?] must have no more than one value per subject.

[is it clear what "subject" refers to here?]

@kcoyle
Copy link
Contributor

@kcoyle kcoyle commented on 9e3c9c4 Nov 30, 2016

Choose a reason for hiding this comment

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

"The class sh:TargetType can be used to declare high-level vocabularies for targets."

What's a "high level vocabulary"? Aren't these classes for targets?

@HolgerKnublauch
Copy link
Contributor Author

Choose a reason for hiding this comment

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

On your first comment: This is meant to say that the operation needs to be applied in the inverse direction. Sometimes you have the shape as a starting point and need to find the focus nodes for it, but other times you have a focus node and need to find the shapes that it is targeted by.

On your second comment, I have switched to the following, hoping it's clearer:

"The parameter values of such targets must not be blank nodes, and the same target must have no more than one value per parameter."

On high-level vocabulary, we have used that term many more times in the document. If we want to get rid of it, we'd need to do it everywhere. The intention is to explain that users don't need to write SPARQL but are provided with a higher-level vocabulary. Maybe such a sentence in the beginning would define it?

Please sign in to comment.