Giter Club home page Giter Club logo

Comments (7)

DylanVanAssche avatar DylanVanAssche commented on September 27, 2024 1

Escaping is tricky, especially since we use the same escape character in reference formulations as Turtle. If we write in something else then Turtle, we only need to escape once, other 2x.

In non-Turtle you can write \{ and escape it
In Turtle you must write \\{ to escape it.

However in 2 you might be confused if the \\ is escaping the { or means \ as token. Spoiler alert: you need to do \\\ in Turtle for \ in a reference formulation.

from rml-core.

DylanVanAssche avatar DylanVanAssche commented on September 27, 2024

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

from rml-core.

dachafra avatar dachafra commented on September 27, 2024

Tasks required:

  • Test the regex provided and ensure that the constraint is correct
  • Define test-cases with valid templates (I think this is by default now and it's not required)
  • Define a few test-cases with invalid templates.

@DylanVanAssche could you take care of this?

from rml-core.

DylanVanAssche avatar DylanVanAssche commented on September 27, 2024

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.

from rml-core.

dachafra avatar dachafra commented on September 27, 2024

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

from rml-core.

chrdebru avatar chrdebru commented on September 27, 2024

Is escaping really that tricky? You just need to load the file into a graph and indicate the format, no? Only then do we need to test the regex. That said, implementers can rely on ill-founded assumptions, so the test cases should provide redundant ones for RDF/XML, N-Quads, and even JSON-LD.

from rml-core.

DylanVanAssche avatar DylanVanAssche commented on September 27, 2024

Is escaping really that tricky? You just need to load the file into a graph and indicate the format, no?

If you use tools, they take care of that. It is mostly tricky if you write mappings manually. This is purely a developer experience thing. Since Turtle and the template-syntax use the same escape character / it becomes tricky when writing by hand.

from rml-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.