kg-construct / rml-core

RML-Core: Main features for RDF generation with RML
https://w3id.org/rml/core/spec
Creative Commons Attribution 4.0 International
12 stars 8 forks source link

Include the validation of templates in the SHACL shapes #79

Open chrdebru opened 5 months ago

chrdebru commented 5 months ago

I believe that checking the validity of templates should be included in the shapes. I'm not sure whether SPARQL's regular expressions allow for recursion, but it can be achieved by:

This can be achieved for a SPARQL constraint component.

DylanVanAssche commented 5 months ago

SHACL can do regex, once the listed regex is tested and test cases are provided with valid and invalid templates, we can add it.

dachafra commented 3 days ago

Tasks required:

@DylanVanAssche could you take care of this?

DylanVanAssche commented 3 days ago

Define a few test-cases with invalid templates. AFAIK, these are the 'rules':

A string template is a format string that can be used to build strings from multiple components. It can apply [reference expressions](https://kg-construct.github.io/rml-core/spec/docs/#dfn-reference-expression) by enclosing them in curly braces ({ and }). The following syntax rules apply to valid [string templates](https://kg-construct.github.io/rml-core/spec/docs/#dfn-string-template):

    1. Pairs of unescaped curly braces MUST enclose valid [reference expressions](https://kg-construct.github.io/rml-core/spec/docs/#dfn-reference-expression).
   2. Curly braces that do not enclose [reference expressions](https://kg-construct.github.io/rml-core/spec/docs/#dfn-reference-expression) MUST be escaped by a backslash character (\). This also applies to curly braces within [reference expressions](https://kg-construct.github.io/rml-core/spec/docs/#dfn-reference-expression).
    3.Backslash characters (\) MUST be escaped by preceding them with another backslash character, yielding (\\). This also applies to backslashes within [reference expressions](https://kg-construct.github.io/rml-core/spec/docs/#dfn-reference-expression).
    4.There SHOULD be at least one pair of unescaped curly braces.

from spec.

Anything missing? If not, we need to have 4 invalid test cases, one for each rule.

dachafra commented 2 days ago

I don't think so, please proceed :-)