-
Notifications
You must be signed in to change notification settings - Fork 8
Description
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 _
:
- I can have more readable YAML without quoting keys (see
Example with context
below) - I can write this in JavaScript:
label._none // with Language Indexing, if the label has no lang tag
label._value // with langString
instead of
label["@none"]
label["@value"]
(see JSON-LD Language Indexing)
JSON-LD takes a per-keyword approach, i.e. you can define keyword aliases, eg
"@context":{
"type":"@type",
"id":"@id",
"lang":"@language",
"none":"@none"
}
A more uniform way in YAML-LD could be to specify the prefix char ($
or _
or even empty) with an option.
@
is the default.- option name:
- where can it be used:
- as command line or config param of a yaml-ld tool?
- in the YAML-LD context.
Example with context (TODO make more)
"@context":
"@sigil": $
$base: http://example.org/resource/
$vocab: http://example.org/ontology/
$graph:
$id: bart
spouse: marge
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?
\@context:
\@sigil: $
$base: http://example.org/resource/
$vocab: http://example.org/ontology/
$graph:
$id: bart
spouse: marge
JSON Schema includes some $
keywords:
"$schema, $vocabulary, $defs, $ref, $id, $anchor, $comment, $dynamicRef, $dynamicAnchor`
- on one hand, if we come up with some YAML beast to combine YAML-LD Context and YAML Schema (see Polyglot Modeling #19, I think @OR13 uses such things) it would be nice to use the same sigil for keywords
- on the other hand, we should look out for conflicts
@id
is a conflict with $id@vocab
is a near-conflict with$vocabulary
(i.e. could be confusing)
- But maybe there is no problem if these keywords are localized to the Context vs Schema parts?
- After all,
@id
is already "overloaded" in JSON-LD:
- After all,
"@container": "@id" # Node Identifier Indexing
"@id": "bart" # Node identifier
"@id": {"@id": "bart", "age": 42} # triple, for which RDF-star annotations will follow
Related issues:
- Even if YAML presentation ("cosmetic") controls #42 is rejected, this still applies since it affects YAML use in programs
- I think we can close Pospone discussion on "$" and "@" #9 because it has a lot of great discussion but it's unfocused: @ioggstream do you agree?