zazuko/rdf-validate-shacl

Use of '<' character in report messages is confusing.

MPvHarmelen opened this issue · 1 comments

In the example below, the validator prints Value is not < value of <http://schema.org/deathDate>. The message is correct, however, the use of the character < tends to cause confusion, as the same characters, < and >, are also used to delimit IRIs. Would it be possible to use the words less than or greater than instead?

const n3 = require("n3");
const factory = require('rdf-ext');
const SHACLValidator = require('rdf-validate-shacl');

const shapesTtl = `
@prefix schema: <http://schema.org/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .

schema:PersonShape
    a sh:NodeShape ;
    sh:targetClass schema:Person ;
    sh:property [
        sh:path schema:birthDate ;
        sh:lessThan schema:deathDate ;
    ] .
`;

const dataTtl = `
@prefix ex: <http://example.org/ns#> .
@prefix schema: <http://schema.org/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

ex:Bob
    a schema:Person ;
    schema:birthDate "1971-07-07"^^xsd:date ;
    schema:deathDate "1968-09-10"^^xsd:date .
`;


async function run() {
  const parser = new n3.Parser();
  const shapes = await factory.dataset(parser.parse(shapesTtl));
  const data = await factory.dataset(parser.parse(dataTtl));

  const validator = new SHACLValidator(shapes, { factory });
  const report = await validator.validate(data);

  for (const result of report.results) {
    console.log(result.message[0].value);
  }
}

run();

That's a good point. I'll probably make the change.