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

Keyword for embedding nodes

From: Erik Isaksson <erikis@kth.se>
Date: Mon, 25 Feb 2013 12:33:23 +0100
Message-ID: <CAK9bEGz=eXKot8GN3YFP6aNL6pEOcppGsnWq44wpVzimc5AAEA@mail.gmail.com>
To: JSON-LD CG <public-linked-json@w3.org>
Hi,

I'd just like to mention an alternative for grouping nodes in the default graph.

Instead of something like @default (like @graph but for the default
graph) that I suggested earlier, there could be a keyword such as
@node that embeds node objects, without any parent-child relationship.

Such a keyword could be useful in many situations, both in the default
and in named graphs, wherever embedding of node objects that reference
each other is desired. This could be done without having to otherwise
modify the document structure (such as having to put all node objects
under @graph in the top-level object). And of course, in the case of
wanting to use a shared context for multiple nodes at the document's
top-level, @node could be used instead of @graph (and it would
therefore be possible to remove @graph's special semantics of
expressing the default graph in a top-level object without other
properties than @graph and @context).

I really like how it is possible in JSON-LD to either use an approach
based purely on embedding, or an approach based on having multiple,
flattened nodes at the top-level. With a keyword such as @node, it
would be possible to combine some of the strengths of both approaches.

A modified example 47: Using @node to apply a shared context to a
group of nodes in the default graph
{
  "@context": ...,
  "@node":
  [
    {
      "@id": "http://manu.sporny.org/i/public",
      "@type": "foaf:Person",
      "name": "Manu Sporny",
      "knows": "http://greggkellogg.net/foaf#me"
    },
    {
      "@id": "http://greggkellogg.net/foaf#me",
      "@type": "foaf:Person",
      "name": "Gregg Kellogg",
      "knows": "http://manu.sporny.org/i/public"
    }
  ]
}

Modifying Manu's example of two graphs (I think this makes it more
clear that there are two nodes that are labels for two separate
graphs):
{
  "@context": ...,
  "@node": [
    {
      "@graph": {
        "name": "Joe"
      }
    },
    {
      "@graph": {
        "name": "Susan"
      }
    }
  ]
}

Best regards,
Erik
Received on Monday, 25 February 2013 11:33:54 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:25:39 GMT