Skip to content

Remove @graph from spec #95

Closed
Closed
@lanthaler

Description

@lanthaler

While implementing my JSON-LD processor and discussing how @graph is supposed to work (see #94), I realized that we don't need it. It is, at least in its current form a complete duplication of @set. Look at the following simple example:

{
  "@context": {
    "name": "http://xmlns.com/foaf/0.1/name",
    "homepage": {
      "@id": "http://xmlns.com/foaf/0.1/homepage",
      "@type": "@id"
    }
  },
  "@graph": [
    {
      "name": "Manu Sporny",
      "homepage": "http://manu.sporny.org/"
    },
    {
      "name": "Markus Lanthaler",
      "homepage": "http://www.markus-lanthaler.com/"
    }
  ]
}

and now look at (the same document but @graph replaced with @set)

{
  "@context": {
    "name": "http://xmlns.com/foaf/0.1/name",
    "homepage": {
      "@id": "http://xmlns.com/foaf/0.1/homepage",
      "@type": "@id"
    }
  },
  "@set": [
    {
      "name": "Manu Sporny",
      "homepage": "http://manu.sporny.org/"
    },
    {
      "name": "Markus Lanthaler",
      "homepage": "http://www.markus-lanthaler.com/"
    }
  ]
}

Both will be expanded to

[
  {
    "http://xmlns.com/foaf/0.1/name": [ "Manu Sporny" ],
    "http://xmlns.com/foaf/0.1/homepage": [ { "@id": "http://manu.sporny.org/" } ]
  },
  {
    "http://xmlns.com/foaf/0.1/name": [ "Markus Lanthaler" ],
    "http://xmlns.com/foaf/0.1/homepage": [ { "@id": "http://www.markus-lanthaler.com/" } ]
  }
]

So there's really no advantage of having @graph at the moment. I would therefore propose to drop it for the time being.

PROPOSAL: Drop support for @graph.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions