Re: Human-readable error messages in an R2RML validator

Hi Richard,

thanks for sharing this, which is relevant for

https://www.w3.org/2014/data-shapes/wiki/Requirements#Human-readable_Violation_Messages

which currently has some objections. I notice that you are (also) using 
a string template mechanism with placeholders such as {varName}. I 
believe we could/should use something similar for the values of 
sh:message. This may address some concerns by Jose, because it would 
allow the constraints/templates to only produce the human-readable 
messages on demand, from an abstract validation data structure (sh:root, 
sh:path etc). SHACL templates already have a simple outline for such a 
mechanism, inherited from SPIN:

     http://w3c.github.io/data-shapes/shacl/#template-labelTemplate

In many examples that I have seen though, simple value replacements are 
not sufficient, and messages need to be assembled more dynamically. So I 
think there remains value in having the fallback to produce sh:message 
strings as part of the WHERE clause.

Question: do you have any specific grammar for the string substitution 
templates, and do you see a realistic way to also support conditional 
insertions, e.g. "Count must be > {?minCount}. Count must be < 
{?maxCount}" so that the min and max sections only appear if a template 
has a value for ?min/maxCount?

Holger


On 3/19/2015 23:36, Richard Cyganiak wrote:
> Here’s some input that might be relevant to the discussion about human-readable validation reports.
>
> This is part of a validator for R2RML documents, implemented in Java. R2RML documents are often authored by hand in Turtle. Therefore, to be helpful, a validator must provide concrete, detailed and specific error messages. I think that most of what this particular validator does, should be doable in SHACL.
>
> The following file contains all the error messages that the validator can generate:
>
> https://github.com/d2rq/d2rq/blob/develop/src/org/d2rq/validation/Message.java
>
> Some of these are “high-level” stuff, where one could imagine the error message being hardcoded in the SHACL processor, for example:
>
>      DUPLICATE_VALUE(Level.Error,
>          "Duplicate value for {property}",
>          "The resource {resource} has multiple values for {property} ({objects}); only one is allowed.”),
>
> But most are specific to R2RML, and the human-readable error message would have to be supplied in the SHACL document for R2RML, for example:
>
>      INVALID_COLUMN_NAME(Level.Error, "Malformed column name {string}",
>          "Malformed column name {string} in property {property} of {resource}: {details}.”),
>
>      ONLY_ALLOWED_IF_TERM_TYPE_LITERAL(Level.Error,
>          "{property} not allowed for this term type”,
>          "The property {property} is only allowed on term maps that generate literals, but the rr:termType of {resource} is not rr:Literal.”),
>
>      POSSIBLE_UNSAFE_SEPARATOR_IN_IRI_TEMPLATE(Level.Warning,
>          "Possible unsafe separator in IRI template”,
>          "Column references in the {property} of {resource} ({object}) are separated by a possibly unsafe delimiter. It is recommended that IRI sub-delim characters are used to delimit column references in IRI templates."),
>
> For reference, each validation message has the following fields:
>
>      Level level;
>      String messageTitle;
>      String messageTemplate;
>      Resource subject;
>      List<Property> predicates;
>      List<RDFNode> objects;
>      String detailCode;
>      String details;
>
> Best,
> Richard

Received on Friday, 20 March 2015 03:21:19 UTC