I updated the JSON Talk page [1] with an example of using the JSON-LD named-graph syntax to express provenance information about some facts, based on a discussion of the use case in the W3C RDF Working Group [2] trying to express the following:
ParisFact1 expresses "Paris locatedIn France ." ParisFact1 hasReference EncyclopediaBritannica, Wikipedia, Brockhaus. ParisFact2 Paris hasPopulation 7000000^^int ParisFact2 hasReference Wikipedia
The JSON-LD looks like the following:
{ "@context": { "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "ex": "http://example.org/", "xsd": "http://www.w3.org/2001/XMLSchema#", "ex:locatedIn": {"@type": "@id"}, "ex:hasPopulaton": {"@type": "xsd:integer"}, "ex:hasReference": {"@type": "@id"} }, "@graph": [ { "@id": "http://example.org/ParisFact1", "@type": "rdf:Graph", "@graph": { "@id": "http://example.org/location/Paris#this", "ex:locatedIn": "http://example.org/location/France#this" }, "ex:hasReference": ["http://www.britannica.com/", "http://www.wikipedia.org/", "http://www.brockhaus.de/"] }, { "@id": "http://example.org/ParisFact2", "@type": "rdf:Graph", "@graph": { "@id": "http://example.org/location/Paris#this", "ex:hasPopulation": 7000000 }, "ex:hasReference": "http://www.wikipedia.org/" } ] }
Which could be expressed in TriG as:
@prefix ex: http://example.org/ . @prefix rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# . @prefix xsd: http://www.w3.org/2001/XMLSchema# . { ex:ParisFact1 a rdf:Graph; ex:hasReference http://www.britannica.com/, http://www.wikipedia.org/, http://www.brockhaus.de/ . ex:ParisFact2 a rdf:Graph; ex:hasReference http://www.wikipedia.org/ . } ex:ParisFact1 { http://example.org/location/Paris#this ex:locatedIn http://example.org/location/France#this . } ex:ParisFact2 { http://example.org/location/Paris#this ex:hasPopulation 7000000 . }
Note that JSON-LD recently added support for named graphs [3].
Gregg
[1] http://meta.wikimedia.org/wiki/Talk:Wikidata/Data_model/JSON [2] http://www.w3.org/2011/rdf-wg/wiki/TF-Graphs-UC#.28C_priority.29_Wikidata [3] http://json-ld.org/spec/latest/json-ld-syntax/#named-graphs
Gregg