kg-construct / yarrrml-spec

A human readable text-based representation for declarative Linked Data generation rules.
https://w3id.org/kg-construct/yarrrml
1 stars 1 forks source link

Array brackets as shortcuts conflicts with YAML #8

Open DylanVanAssche opened 11 months ago

DylanVanAssche commented 11 months ago

During the VAIA course we received the following feedback:

it's a well-known shorthand in standard YAML... the use of square brackets here for YARRML conflicts that YAML shorthand

Array brackets conflict with standard YAML as it is a shorthand for arrays. Just putting it here so we can incorporate this later.

bjdmeest commented 11 months ago

For which specific case? Are you talking about, e.g. XPath? bc I would be hesitant to change the XPath syntax and just add a claim in the spec that, it the reference contains special characters such as [ and ], you should put the template in quotes

DylanVanAssche commented 11 months ago

Everything actually, not a specify reference formulation or something, it is about the syntax for a POM for example:

po:
  - [ foaf:name, $(name), en~lang ]

The array is not 'equal' regarding the types, it is actually an object put into an array where [0] matches the predicates, [1] matches the objects and en~lang the language tag as Literal.

Their comment was mostly about that the brackets suggest an array with [ and ] as in YAML but that it is not an 'array' in practice, but more like an object. Therefore, the shortcut felt a bit non-intuitive when you are used to YAML. I kinda see where this is coming from though. Not sure how to solve it though, just putting it here so we can think about it when standardizing YARRRML.

midorna commented 1 day ago

This issue is open for quite some time, and I agree with @DylanVanAssche's observations. Some thoughts on this were shared already with Dylan and Ben via email some months ago, which led to my proposal using a functional notation pom() for a future standard.

Proposal
Use pom(<predicate>, <object> [, <object type>]) as a template for a predicate-object mapping (POM) to avoid the current YAML list notation.
Lists of predicates and lists of objects are allowed, as defined in the current YARRRML specification. The third parameter, which can be used to define the object's type, is optional (default: xsd:string).

Example with current syntax:

...
    po: [[foaf:name, $(name), en~lang]]

Example with proposed syntax:

...
    po: [pom(foaf:name, $(name), en~lang)]

Some further points for a discussion: