W3C home > Mailing lists > Public > public-linked-json@w3.org > January 2013

Re: Examples of RDF datasets with multiple named graphs

From: Gregg Kellogg <gregg@greggkellogg.net>
Date: Tue, 15 Jan 2013 04:36:28 -0500
To: Conal Tuohy <conal.tuohy@versi.edu.au>
CC: JSON-LD <public-linked-json@w3.org>
Message-ID: <2CF8CFC2-7E53-473A-861D-40DBD81EFDCA@greggkellogg.net>
On Jan 15, 2013, at 5:30 AM, Conal Tuohy <conal.tuohy@versi.edu.au<mailto:conal.tuohy@versi.edu.au>> wrote:

It would be good if the spec included an example of a JSON-LD serialization of a dataset which contained multiple named graphs.

Yes, I can see how it might not be clear how to create more than one named graph. An example such as the following can go in the spec:

{
  "@context": {
    "foaf": "http://xmlns.com/foaf/0.1/",
    "mbox": {"@id": "foaf:mbox", "@type": "@id"},
    "name": "foaf:name",
    "publisher": "http://purl.org/dc/elements/1.1/publisher"
  },
  "@graph": [
    {
      "@id": "http://example.org/bob",
      "publisher": "Bob",
      "@graph": {
        "name": "Bob",
        "mbox": "mailto:bob@oldcorp.example.org"
      }
    }, {
      "@id": "http://example.org/alice",
      "publisher": "Alice",
      "@graph": {
        "name": "Alice",
        "mbox": "mailto:alice@work.example.org"
      }
    }
  ]
}

This is based on Example 3 from the TriG draft [1]:


# TriG Example Document
# This document contains a default graph and two named graphs.

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .


# default graph
    {
      <http://example.org/bob> dc:publisher "Bob" .
      <http://example.org/alice> dc:publisher "Alice" .
    }

<http://example.org/bob>
    {
       _:a foaf:name "Bob" .
       _:a foaf:mbox <mailto:bob@oldcorp.example.org> .
    }

<http://example.org/alice>
    {
       _:a foaf:name "Alice" .
       _:a foaf:mbox <mailto:alice@work.example.org> .
    }

Gregg

[1] https://dvcs.w3.org/hg/rdf/raw-file/default/trig/index.html

--
Conal Tuohy
HuNI<http://huni.net.au/> Technical Coordinator<http://apidictor.huni.net.au/trac/wiki/ConalSpace>
Victorian eResearch Strategic Initiative<http://versi.edu.au/about-us/versi-team#Con>
Skype: conal.tuohy
Twitter: @conal_tuohy<https://twitter.com/conal_tuohy>
Mobile: +61-466324297<tel:+61-466324297>
Received on Tuesday, 15 January 2013 09:37:14 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:18:35 UTC