Skip to content

YAML-LD support #4

@Ostrzyciel

Description

@Ostrzyciel

After a discussion with the JSON-LD WG, they pointed out that the future YAML-LD (now part of the JSON-LD WG charter) could be a good fit for RDF Messages, as an RDF Message Log serialization.

The YAML-LD draft spec already proposes to use the existing YAML feature called "YAML Streams" where subsequent YAML documents in one file are separated with ---. See the spec draft: https://json-ld.github.io/yaml-ld/spec/#streams

Example from that draft:

"@base": https://schema.org
"@id": https://w3.org/yaml-ld/
"@type": WebContent
name: YAML-LD
---
"@base": https://schema.org
"@id": https://www.w3.org/TR/json-ld11/
"@type": WebContent
name: JSON-LD

However, this is not really intended to denote discrete messages. A YAML-LD stream is transformed into an array at the root node in JSON-LD, yielding this:

[
  {
    "@base": "https://schema.org",
    "@id": "https://w3.org/yaml-ld/",
    "@type": "WebContent",
    "name": "YAML-LD"
  },
  {
    "@base": "https://schema.org",
    "@id": "https://www.w3.org/TR/json-ld11/",
    "@type": "WebContent",
    "name": "JSON-LD"
  }
]

See JSON-LD 1.1 section 4.1: https://www.w3.org/TR/json-ld11/#advanced-context-usage

These are NOT multiple JSON-LD documents; rather this is a single JSON-LD document with multiple contexts.

I see two ways out of this:

  • A) we introduce new syntax (comments?) for RDF Message Logs and keep the YAML-LD usage of YAML Streams as-is
  • B) we nicely ask the JSON-LD WG if they would be willing to drop the current use of YAML Streams in favor of reserving it for future use with RDF Message Logs.

I would try with B), because YAML-LD is not yet standardized and it can still be changed. It would also allow the JSON-LD group to later get for free compatibility between YAML-LD streams and NDJSON-LD.

Any opinions welcome!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions