-
Notifications
You must be signed in to change notification settings - Fork 8
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
sigil: change prefix char in context #51
Comments
IMO, its better to conform to string syntax than translate... dot notation isn't worth the complexity. I prefer to reuse as much JSON-LD syntax as possible with YAML-LD. IMO, adding another syntax will just make RDF usability even worse. |
@VladimirAlexiev I think you are right, the I will fix the examples in the spec. It is key to add the test code to the repo so that anyone can run the same tests. Sorry for the mistake. I agree on closing the discussion on $ vs @ since people that want to use $ can do it via the context you propose. Q: any luck in unreserving "@" in YAML ? We could propose to use another UTF-8 char for that :P @VladimirAlexiev |
It's not only about field access in programming languages, but also about YAML readability. Edited the description.
We're talking YAML usability.
Wouldn't it be nice to "construct a path" so you don't need to cross any boundaries, and can think about your data model rather than the various modeling mechanisms? Orie's LD additions use
No movement on yaml/yaml-spec#286 |
As I just noted in #11, I suggest we use contexts instead of some hard coded option to convert keywords. This is a much more generic mechanism. It seems fair to me to say that YAML-LD is actually a tool to build Semantic DSLs (Domain Specific Languages). Just like YAML is normally used: every configuration file or data file format based on YAML is actually a DSL. So the developers of YAML-LD aware systems will likely conceive their own syntaxes for these DSLs. Our Convenience Context would be merely a reusable example for such. Thoughts? |
Technically my additions are to OAS / JSON Schema, which is why we chose Where that is the convention. |
@anatoly-scherbakov I agree with you, that option (eg @gkellogg Can you come up with some twisted examples where the sigil is switched midway in a YAML file? (You can switch |
sigil
: change prefix char in context
sigil
: change prefix char in contextsigil
: change prefix char in context
sigil
: change prefix char in context
@BigBlueHat's idea is to create a "Convenience Context" with bare-word terms for keywords, which is already a common practice. Put it in the best practices document, and it handles most use. See his context at https://github.com/json-ld/convenience-context.
There are JSON-LD tests for this; generally term definitions are additive, although they can be removed by defining as |
@BigBlueHat The "Convenience Context" is a great idea.
Note: #85 is closely related. |
+1 to starting with |
@VladimirAlexiev said:
This would have been discussed in a meeting, and you can see all the minutes here. The thought was that this feature can be achieved easily using a context; otherwise, it would require more than simply transforming YAML to the internal representation, and could be subject to other errors. By creating aliases for say Otherwise, the processing steps are more involved, and potentially would deal with conflicts in overlapping terms (i.e., if |
Current Convenience Context in the spec does use |
@anatoly-scherbakov @gkellogg
I think that's enough, so would be happy to close this. Do you agree? |
@VladimirAlexiev thank you for pointing attention to this issue! I do agree; I believe we've arrived at a solution (via contexts), and provided example contexts. So I am closing this. |
As an information architect and developer.
I want to write YAML-LD keywords using identifier chars accepted in YAML and in my programming language.
So that I can access them using dot notation, rather than using "string index" bracketed notation.
Example: if the prefix char is
_
:Example with context
below)instead of
(see JSON-LD Language Indexing)
JSON-LD takes a per-keyword approach, i.e. you can define keyword aliases, eg
A more uniform way in YAML-LD could be to specify the prefix char (
$
or_
or even empty) with an option.@
is the default.prefix_char:
orsigil:
(I prefer that), see https://en.wikipedia.org/wiki/Sigil_(computer_programming), https://www.perl.com/article/on-sigils/, https://riptutorial.com/perl/example/20794/sigils, https://stackoverflow.com/questions/1091634/why-do-perl-variables-need-to-start-with-sigilsExample with context (TODO make more)
TODO: is there any way to avoid the use of
@
in the first 2 lines?@ioggstream and @anatoly-scherbakov I tried
\
escaping but it doesn't work at https://onlineyamltools.com/convert-yaml-to-json, maybe that convertor is non-conforming?JSON Schema includes some
$
keywords:"$schema, $vocabulary, $defs, $ref, $id, $anchor, $comment, $dynamicRef, $dynamicAnchor`
@id
is a conflict with $id@vocab
is a near-conflict with$vocabulary
(i.e. could be confusing)@id
is already "overloaded" in JSON-LD:Related issues:
The text was updated successfully, but these errors were encountered: