This wiki has been archived and is now read-only.

JSON-LD Data Model

From RDF Working Group Wiki
Jump to: navigation, search

JSON data model

  • A JSON text is a serialized object or array.
  • An object is an unordered collection of zero or more name/value pairs, where a name is a string.
  • An array is an ordered sequence of zero or more values.
  • A JSON value MUST be an object, array, number, or string, or one of the following three literal names: false null true
  • A string is a sequence of zero or more Unicode characters [UNICODE].

JSON-LD data model

  1. A JSON-LD data model instance consists of a default JSON-LD graph and zero or more named JSON-LD graphs.
  2. A named JSON-LD graph is a pair <id,graph> where id is an IRI or blank node, and graph is a JSON-LD graph.
  3. A JSON-LD graph is a directed graph, consisting of a collection (@@ set?) of nodes and a collection (@@ set?) of edges.
  4. Every node is an IRI, blank node, list, or JSON-LD value.
  5. The tail and head of every edge must be members of the set of nodes. The tail of every edge is an IRI or blank node; the head of every edge may be any kind of node. Every edge is labelled with an IRI or blank node.
  6. The edge labels are called properties.
  7. An IRI is an absolute IRI.
  8. A blank node, a.k.a. unlabeled node, is a node identified with an unlabeled node identifier. Unlabeled node identifiers are scoped to the document if provided by the author; they are automatically assigned otherwise.
  9. A list is an ordered sequence of IRIs, blank nodes, and JSON-LD values.
  10. A JSON-LD value is either a string, or a boolean, or a number, or a typed literal, or a language-tagged string.
  11. A typed literal consists of a value, which is a Unicode string, and a type, which is an IRI.
  12. A language-tagged string consists of a value, which is a Unicode string, and a BCP-47 language tag.
  13. A node cannot have two outgoing edges with the same label where the head of the edge are lists.
  14. @@ are nodes shared between graphs?
  15. @@ scope of blank node labels
  16. @@ @type is special; a bag of IRIs
  17. @@ Everything (edges, nodes) is bags, not sets
  18. @@ Graph requires that a node in the default graph with the same IRI exists

Differences to the RDF data model

  1. Graph names can be blank nodes.
  2. Unconnected nodes (IRIs, blank nodes or values) are supported.
  3. Edge labels may be blank nodes.
  4. Lists are part of the data model.
  5. Language maps are part of the data model.
  6. Graphs/datasets are "allowed" in the object position.
    1. Are they? If expressed, it is the graph name that is in the object position, not the graph itself. This becomes clear when flattening --Gregg Kellogg 18:23, 30 October 2012 (UTC))
    2. If we are going to interpret language maps as being part of the data model, I don't see how we can ignore that you can put a JSON object that represents a named graph as the 'object' of a JSON-LD statement. I do agree that this is super-pedantic and I honestly don't have a very strong opinion about how it's interpreted (as it has no effect on the use of JSON-LD). I also admit that both perspectives are reasonable ones to hold. That said, I think stating that you can place graphs in the object position of JSON-LD statements is more correct than stating that what we're doing is just placing a graph name in the object position. Manu Sporny 16:51, 1 November 2012 (UTC)
  7. Supports “plain” strings, numbers and booleans, separately from typed literals.
  8. Language tags are not normalized to lower case.
  9. @@ Scope of blank node labels? [seems to be same as in TriG]