W3C home > Mailing lists > Public > public-data-shapes-wg@w3.org > November 2016

Re: shapes-ISSUE-193 (Focus nodes): Targets can be refined; focus nodes do not change

From: Holger Knublauch <holger@topquadrant.com>
Date: Thu, 3 Nov 2016 16:44:37 +1000
To: public-data-shapes-wg@w3.org
Message-ID: <cb17bc62-70b5-3134-e8cf-4ad4dc4d59ea@topquadrant.com>


On 3/11/2016 14:34, Karen Coyle wrote:
>
>
> On 11/2/16 6:31 PM, Holger Knublauch wrote:
>>
>>
>> On 28/10/2016 2:50, RDF Data Shapes Working Group Issue Tracker wrote:
>>> shapes-ISSUE-193 (Focus nodes): Targets can be refined; focus nodes do
>>> not change
>>>
>>> http://www.w3.org/2014/data-shapes/track/issues/193
>>>
>>> Raised by: Karen Coyle
>>> On product:
>>>
>>> Focus nodes are defined as "A node in the data graph that is validated
>>> against a shape is called a focus node."
>>>
>>> Section 2. further defines focus nodes like this:
>>>
>>> "The set of focus nodes for a shape may be identified as follows:
>>>
>>> *specified in a shape using targets and filters,
>>> *specified in any constraint that references a shape in parameters of
>>> shape-based constraint components (i.e. sh:shape) or logical
>>> constraint components (i.e. sh:or),
>>> *specified as input to the SHACL processor for validating specific
>>> nodes from the data graph against the shape, or
>>>
>>> Shapes can also provide non-validating information, such as labels and
>>> comments."
>>>
>>> (That last sentence is a non sequitur because the section is about
>>> focus nodes only.)
>>>
>>> Section 2.1 says:
>>>
>>> "2.1 Targets
>>>
>>> A target provides one way to specify potential focus nodes for a 
>>> shape."
>>>
>>> and
>>>
>>> "Not all target nodes become focus nodes. When a shape includes
>>> filters, filters can remove nodes specified by targets from the set of
>>> the shape’s focus nodes."
>>>
>>> This seems to state that the nodes specified by targets ARE focus
>>> nodes. I would end this after "targets" in the second sentence.
>>
>> Done:
>> https://github.com/w3c/data-shapes/commit/c1855ed19630c9262bbe058e7880887e86dc56dd 
>>
>>
>>
>>>
>>> Then, section 2.2 says:
>>>
>>> "2.2 Filter Shapes
>>>
>>> A filter is a shape in the shapes graph that further refines the focus
>>> nodes in the data graph that are validated against a constraint or all
>>> the constraints of a shape."
>>>
>>> Again, this says that there are focus nodes that are refined - but
>>> above it seems to say that only the actual nodes that are validated
>>> are focus nodes. Instead, filters act on targets, not focus nodes.
>>
>> No, filter shapes *do* act on focus nodes, not (only) on targets.
>> Filters are *always* evaluated, even if a shape is "directly"
>> referenced, e.g. by ShEx-style targetless invocation or when they are a
>> result of sh:shape only.
>
> This is what contradicts the definition of focus nodes. On the one 
> hand, only nodes that are actually validated are focus nodes. On the 
> other, focus nodes exist before filters are applied, since filters can 
> act on them. So the question is: when is a focus node "born"? If a 
> focus node is something that can be further refined with a filter, 
> then the original definition is not correct because there are focus 
> nodes that are not the final validation node, since filters (which I 
> assume are not validations) can further refine them.
>
> Again, the statement in 2. is:
> "A node in the data graph that is validated against a shape is called 
> a focus node."
>
> That defines focus nodes as "those that are validated against a shape."
>
> Then the definition for targets says:
> "Not all target nodes become focus nodes. When a shape includes 
> filters, filters can remove nodes specified by targets." This doesn't 
> mention focus nodes, and seems to me to be correct.
>
> This was my original question, and it goes something like this:
>
> Possibility A:
>
> Apply a target = focusNode1
> Apply a filter to focusNode1 = focusNode2
> Apply a constraint to focusNode2 = focusNode3
>
> Possibility B:
>
> Apply a target = targetResult
> Apply a filter to targetResult = filterResult
> Apply a constrain to filterResult = focusNode
>
> In other words which of these are focus nodes? From the definition, it 
> seems like only the final nodes, after targets, filters, and 
> constraints are applied, are focus nodes. But you seem to be referring 
> to an "intermediate" focus node. I think that focus node should be 
> reserved for the final selected node that is validated.

The first sentence of the Targets section states

     A target provides one way to specify *potential* focus nodes.

Maybe "potential focus nodes" would be a term to use for the 
"intermediate" filterResult nodes that are in between targets and 
focusNodes?

Note that an engine may push the evaluation of the filters into the 
validation itself. Each filterShape can be translated into an equivalent 
sh:or. So a SPARQL query that is produced from a constraint that has a 
filter may simply have a SPARQL FILTER at the beginning, before the 
actual body of the query starts. This blurs the lines between those 
stages quite a bit. Some implementations may indeed do the filtering as 
a pre-processing step, others may treat them just like focus nodes and 
do the filter as part of the constraint execution.

I did a search for "focus node" across the current document I don't see 
a specific contradiction of our use of that term. Is there still a 
specific problem left?

I also wonder how we can get feedback about this whole feature. This WG 
seems to continue to struggle with the filter shape concept. We still 
have the option to replace it with a sh:disabled true flag. The WG is 
far from representative of the potential user group. If external people 
struggle with this feature, we may do the adoption of SHACL a disservice 
if we over-complicate it.

Holger
Received on Thursday, 3 November 2016 06:45:13 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 3 November 2016 06:45:13 UTC