JSON-LD Data Model
From RDF Working Group Wiki
Revision as of 20:08, 7 November 2012 by Rcygania2
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
- A JSON-LD data model instance consists of a default JSON-LD graph and zero or more named JSON-LD graphs.
- 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.
- A JSON-LD graph is a directed graph, consisting of a collection (@@ set?) of nodes and a collection (@@ set?) of edges.
- Every node is an IRI, blank node, list, or JSON-LD value.
- 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.
- The edge labels are called properties.
- An IRI is an absolute IRI.
- 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.
- A list is an ordered sequence of IRIs, blank nodes, and JSON-LD values.
- A JSON-LD value is either a string, or a boolean, or a number, or a typed literal, or a language-tagged string.
- A typed literal consists of a value, which is a Unicode string, and a type, which is an IRI.
- A language-tagged string consists of a value, which is a Unicode string, and a BCP-47 language tag.
- A node cannot have two outgoing edges with the same label where the head of the edge are lists.
- @@ are nodes shared between graphs?
- @@ scope of blank node labels
- @@ @type is special; a bag of IRIs
- @@ Everything (edges, nodes) is bags, not sets
- @@ Graph requires that a node in the default graph with the same IRI exists
Differences to the RDF data model
- Graph names can be blank nodes.
- Unconnected nodes (IRIs, blank nodes or values) are supported.
- Edge labels may be blank nodes.
- Lists are part of the data model.
- Language maps are part of the data model.
- Graphs/datasets are "allowed" in the object position.
- 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))
- 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)
- Supports “plain” strings, numbers and booleans, separately from typed literals.
- Language tags are not normalized to lower case.
- @@ Scope of blank node labels? [seems to be same as in TriG]