- From: Holger Knublauch <holger@topquadrant.com>
- Date: Thu, 13 Aug 2015 16:15:19 +1000
- To: RDF Data Shapes Working Group <public-data-shapes-wg@w3.org>
On 8/13/2015 16:09, Simon Steyskal wrote:
> Hi!
>
>> The message is defined by the surrounding template, using sh:message.
>> I cannot think of other important information that could not be
>> generalized.
>
> I thought that the results of the SELECT query were responsible for
> "populating" the sh:message.
> In the sense that, if e.g. one wants to specify the node that has
> violated a constraint in the message too, ?this (retrieved from the
> query results) would have to be used.
Yes correct. A naive implementation would auto-generate a query such as
SELECT ?this ?subject ?predicate (?value AS ?object) ?datatype
WHERE {
?this ?predicate ?value .
FILTER (!sh:hasDatatype(?value, ?datatype)) .
}
based on the sh:validationFunction=sh:hasDatatype triple. It walks
through the result set and for each row produces one violation, using
the sh:message attached to the template. If the sh:message = "Your
literal must have datatype {?datatype}" then the engine can determine
that ?datatype is needed to populate the message, and therefore needs to
be projected out from the SELECT. The same applies to ?this or the other
variables. (I have implemented this today to confirm that it works).
HTH
Holger
Received on Thursday, 13 August 2015 06:15:55 UTC