-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Array brackets as shortcuts conflicts with YAML #8
Comments
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 |
Everything actually, not a specify reference formulation or something, it is about the syntax for a POM for example:
The array is not 'equal' regarding the types, it is actually an object put into an array where Their comment was mostly about that the brackets suggest an array with |
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 Proposal Example with current syntax:
Example with proposed syntax:
Some further points for a discussion:
|
First, a minor clarification: you currently can do The current YARRRML syntax is a trade-off between (i) user-friendliness and (ii) maximally relying on the existing YAML syntax (and by extension, existing YAML parsers). By using the existing po: pom(foaf:name, $(name), en~lang) {
"po": "pom(foaf:name, $(name), en~lang)"
} i.e. this still requires some additional parsing on top of the YAML to JSON conversion. Not a huge deal, but that means your YARRRML-parser needs to take all kinds of quirks into account, e.g. when your reference formulation also contains po: [foaf:name, "$(na,me)", en~lang] or you could choose to add escaping to the YARRRML language, soemthing like below po: pom(foaf:name, $(na\,me), en~lang) So you now have to add support for escaping in your YARRRML parser. So now we need to add more documentation in YARRRML instead of relying on existing YAML. By using the po: [foaf:name, "$(na,me)", en~lang] becomes {
"po": [
"foaf:name",
"$(na,me)",
"en~lang"
]
} Honestly, I don't see an improvement there: the po is one big string that actually means a function (so semantically it's a bit similar to the current YARRRML syntaxt that is an array that actually means a function), the parser needs to do more work outside of the YAML spec, and the resulting line is in fact more verbose than the initial YARRRML syntax ( In the end, it's still just a shortcut (so then I'd rather remove the shortcut than add a lot of burden to the limited number of YARRRML developers), hopefully the object-style syntax is clear enough for lay people. We could update our tutorials etc to focus on the object-style syntax, if that would remove confusion. Another solution would be to start from a completely functional syntax (eg stemming from a functional programming language), but that feels like a big endeavor. Maybe an SDK to programmatically create mappings would make more sense then. |
Thanks for the feedback, @bjdmeest.
That's good to know since the specification shows only lists of POs and all examples I know of show lists, too.
Since I share this point of view regarding the trade-off, I would like to strengthen again the point, that POs are not common YAML lists, but fixed tuples. Reusing a syntax for different purposes does not mean that it gets more user-friendly. I see a conflict here because those PO-lists need specific treatment anyhow. When YAML was parsed and you run into an issue, this is just post-poned as if using Maybe the main point here is whether functional notation should be integrated in YARRRML, or not. I think, it helps regarding user-friendliness, since common YAML configurations are not using deeply nested dictionaries in a way, YARRRML does, e.g. considering conditions and nested functions. During mapping development, functional style notation with open and closing parentheses and fixed number of parameters help to get rid of indentation issues, too. Hence, I think this is even more user-friendly and at the same time considering compatibility with YAML syntax. |
During the VAIA course we received the following feedback:
Array brackets conflict with standard YAML as it is a shorthand for arrays.
Just putting it here so we can incorporate this later.
The text was updated successfully, but these errors were encountered: