Human-readable error messages in an R2RML validator

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 Thursday, 19 March 2015 13:36:44 UTC