Skip to content

Compacting graph container with multiple nodes broken #143

Closed
@gkellogg

Description

@gkellogg

As described in w3c/json-ld-framing#27 (comment), there is an issue when compacting named graphs with multiple top-level nodes under a property with @container: @graph.

Consider the following:

{
  "@context": {
    "@version": 1.1,
    "@vocab": "http://example.org/"
  },
  "input": {
    "@graph": [
      {"value": "x"},
      {"value": "y"}
    ]
  }
}

When compacted using:

{
  "@context": {
    "@version": 1.1,
    "@vocab": "http://example.org/",
    "input": {"@container": "@graph"}
  }
}

Generates the following:

{
  "@context": {
    "@version": 1.1,
    "@vocab": "http://example.org/",
    "input": {"@container": "@graph"}
  },
  "input": [
    {"value": "x"},
    {"value": "y"}
  ]
}

But this describes two different named graphs.

We should either not select the term for compaction if there is more than one top-level node, or use either @graph or @included to wrap them all together, which pretty much undoes the affect of @container: @graph.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions