Skip to content

Ensure that blank node identifiers for anonymous graphs are reused #26

@gkellogg

Description

@gkellogg

From w3c/json-ld-syntax#30 (comment), @ericprud notes the problem with using ShEx, or anything else, to match the content of a named graph with only blank node subjects. Consider the following JSON-LD (from expansion test 0079):

{
  "@context": {
    "@version": 1.1,
    "input": {"@id": "foo:input", "@container": "@graph"},
    "value": "foo:value"
  },
  "input": {
    "value": "x"
  }
}

Currently, this will generate TriG similar to the following:

@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

 [ <foo:input> _:b1] .

_:b1 {
   [ <foo:value> "x"] .
}

and expanded JSON-LD:

[{
  "foo:input": [{
    "@graph": [{
      "foo:value": [{"@value": "x"}]
    }]
  }]
}]

Following the link from _:b1 as an object to the graph using that name is feasible, but finding an unnamed subject within that graph can't really be done, for any reasonably complex named graph.

This proposal would cause the expansion algorithm to re-use the blank-node identifier naming the graph for the implicitly named subject contained within the graph, generating the following TriG:

@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

 [ <foo:input> _:b1] .

_:b1 {
   _:b1 <foo:value> "x" .
}

This makes it possible to follow the chain from the object identifying the graph to the primary subject of that graph. Provisions must be made for forms in which there are multiple unnamed subjects within the named 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