-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Related to w3c/json-ld-syntax#389, #3.
TODO: scan these issues to extract more requirements.
Like any great W3C work, we should start with a Use Case Requirements specification / collection.
Until we have a repo (@gkellogg) where we can collect UCR per issue, let's use the following format. It could help UCR editors collect the issues:
- PRIO: Title (@ contacts)
- description
- considerations
- considerations
Notes:
- The checkbox shows which UCRs have been posted as distinct issues in this repo
- PRIO is MUST/COULD/SHOULD and is approximate and subjective, so let's not spend too much effort discussing them. This is specifically not a "requirement compliance" rating
- Can include contacts of people who suggested the idea, or could be interested to develop it further. Not intended to track authorship precisely
- Give a detailed description
- Give as many relevant considerations, examples and links as you can
Here we go
-
MUST: Least Surprise (@pchampin)
- YAML-LD should work the same as JSON-LD unless specific processor options are selected
- Since YAML is an extension of JSON, YAML-LD->RDF should produce the same as YAML->JSON-LD -> RDF,
- YAML-LD should cover all features of JSON-LD 1.1
-
MUST: Human Readability (@anatoly-scherbakov)
- One of the most important reasons to use YAML-LD is YAML's superior human readability and writability compared to JSON
- YAML-LD should provide "syntactic sugar" options to reduce the need for quoting (eg
$
instead of@
) - Eg see https://metacpan.org/pod/RDF::TrineX::Parser::Pretdsl (@tobyink)
-
MUST: Compatibility (@gkellogg)
- YAML-LD must be compatible with other related syntaxes (see "Polyglot Modeling")
- Eg using the
$
sigil ("namespace") will overlap with other existing uses. For example, JSON Schema has$schema, $vocabulary
and other other keywords that would not overlap with the JSON-LD keyword namespace (that uses the@
sigil)
-
SHOULD: YAML Intro (@VladimirAlexiev)
- The YAML-LD spec or UCR spec should provide an introduction to YAML, since the YAML spec is rather technical
- In particular, it should cover YAML extensions compared to JSON
-
SHOULD: Archetypical Examples (@VladimirAlexiev)
- The UCR spec should include archetypical YAML examples from various domains, eg software projects, modules, issues, etc
-
SHOULD: Shortcuts (@VladimirAlexiev)
- Should include some shorthand notations (micro-DSLs) for various purposes, eg
- https://metacpan.org/pod/RDF::Trine::Parser::ShorthandRDF and https://www.w3.org/wiki/ShorthandRDF (@tobyink)
- https://metacpan.org/pod/RDF::TrineX::Parser::Pretdsl in particular for CPAN modules described using DOAP (@tobyink)
←
forrdfs:domain
and→
forrdfs:range
(@anatoly-scherbakov)- Schema Salad concatenation of identifiers along the hierarchy of scopes (@tetron)
-
COULD: Versions (@VladimirAlexiev)
- Support all relevant YAML versions. These could include https://yaml.org/spec/1.0, https://yaml.org/spec/1.1, https://yaml.org/spec/1.2.2/
- But YAML is pretty stable: 12 years between 1.2.1 and 1.2.2 (https://yaml.com/blog/2021-10/new-yaml-spec/), so maybe just the latest one is relevant
-
SHOULD: Extensions (@VladimirAlexiev)
- Leverage YAML features over JSON. Quoting from the YAML spec "The YAML 1.0 specification was published in early 2004
The YAML 1.1 specification was published in 2005. Around this time, the developers became aware of JSON. By sheer coincidence, JSON was almost a complete subset of YAML (both syntactically and semantically). The YAML 1.2 specification was published in 2009. Its primary focus was making YAML a strict superset of JSON". - Some of them can be quite useful in an RDF context:
- Anchors and Aliases can represent non-tree graph structures and should mesh with JSON-LD Frames
- Leverage YAML features over JSON. Quoting from the YAML spec "The YAML 1.0 specification was published in early 2004
-
Tags are comparable to datatypes YAML-LD datatypes (and tags for datatypes) #17.
- the YAML json schema and core schema handle string, boolean, integer, float (the latter allows things like
-.inf
and.nan
). - https://yaml.org/type/ handles a wider set, in particular dates and datetimes. But please note these are considered deprecated in 1.2 and are being removed in 1.3 Remove timestamp examples from the 1.2 spec yaml/yaml-spec#268 (comment)
- Maybe we should define a YAML schema to handle more xsd datatypes?
- It should aim to eliminate problems related to the limited and non-standardized set of JSON literals. Eg the JSON number
12345678901234567890.12345
is converted to RDF literal"12345678901234567168"^^xsd:integer
(see jsonld playground) - And could even work as a replacement of
@type
, eg
- the YAML json schema and core schema handle string, boolean, integer, float (the latter allows things like
# short form using tags
dc:date: !xsd!date 2022-05-18
# instead of long form
dc:date:
@type: xsd:date
@value: 2022-05-18
-
COULD: Polyglot Modeling Polyglot Modeling #19
- For efficient RDF modeling, you need to define multiple related artefacts: ontology, shapes (SHACL (@HolgerKnublauch) or SHEX (@ericprud)), JSON-LD context, maybe JSON-LD frames, JSON schema or Avro schema
- Many communities like LD expression of their data, but mostly care about defining it with JSON schema (eg
w3c-ccg
@OR13 @nissimsan @msporny) - Many people have expressed the desire to define a unified or "technology independent"
- Most polyglot frameworks are YAML-based. Examples include:
- LinkML (github) (@cmungall)
- FHIR (@ericprud: this is not YAML-based, can you provide a link to implementation?)
- Schema Salad (@mr-c @tetron)
- A.ML and cloudinformationmodel
- SOML (@VladimirAlexiev)
- See eg Modeling tool requirements w3c-ccg/traceability-vocab#296 for a brief list of modeling framework requirements
- YAML-LD should not take over these modeling-framework efforts, but should show how they can be used together, show archetypical examples, and maybe make a comparison
-
- YAML-LD must include comprehensive conformance tests for all its features.
- In fact the features should be designed after agreed archetypical examples, so it's feasible for the development process to be "test-driven"
- It should replicate/re-render all JSON-LD tests. Despite no official support in the spec, the gazillion JSON-LD conformance tests are written in YAML: https://github.com/w3c/json-ld-syntax/tree/main/yaml