JSON-LD is a JSON-based serialization syntax for Linked Data and Resource Description Framework (RDF) datasets. JSON-LD facilities are typically used to interpret otherwise idiomatic and ad hoc JSON documents as RDF datasets, or to express RDF Datasets in idiomatic JSON.
JSON-LD provides a rich set of tools, some with complex semantics, to accommodate the many idiomatic ad hoc data representations in common use by JSON-based applications. In particular, JSON-LD allows a JSON document to reference additional external context documents, without which the initial document can’t be parsed to an RDF dataset. Popular implementations of the full JSON-LD toolset (such as jsonld.js) comprise thousands of lines and hundreds (or thousands) of Kbytes of JavaScript.
This project proposes the “Terse” profile, a simplified, constrained, backward-compatible profile of JSON-LD, inspired by Turtle (the Terse RDF Triple Language). The Terse profile is intended for pure Linked Data applications that don’t require compatibility with ad hoc JSON documents, and therefore don’t require the complexity of the full JSON-LD toolset. It leverages the ubiquity of JSON document parsers for most popular programming languages and environments (including web browsers) to eliminate the need to load large parser implementations for common RDF serialization formats (such as Turtle) typically used in pure Linked Data applications. Conforming documents are intended to be easy for humans and computers to read and write.
The reference implementation, which parses documents
conforming to this profile, is about 220 lines of non-minified JavaScript
with a compressed transfer size of about 2300 bytes. Graphs are parsed into
interconnected Plain Old JavaScript Objects. Parsed graphs can be rendered
to a JSON-LD tree representation rooted from any node, or to an array of RDF
triples. This implementation intentionally doesn’t expand @list
s into RDF
Lists, since the RDF List construct is much harder to work with than JavaScript
Array
s. Also, this implementation only processes URIs, since web browser
JavaScript doesn’t provide native IRI processing functions. IRIs in documents
will be converted to URIs according to JavaScript’s URL
API.
The Terse profile is provisionally identified by the URI
http://zenomt.com/ns/jsonld-terse
A test page exercises the reference implementation.
Documentation for the reference implementation is coming soon. Meanwhile, please see the test page for an example of how to use it.
A work-in-progress proposal for an HTTP API framework based on the Terse profile is described in Terse JSON-LD API.
Copyright © 2024 Michael Thornburgh. All rights reserved.
SPDX-License-Identifier: MIT