Datasets in JSON-LD are horriblely ugly and not navigable
"@graph": [
{
"@id": "http://example.org/graphs/1",
"@graph": {
"@id": "http://example.org/people/gavin",
"http://example.com/vocab#name": "Gavin"
}
},
{
"@id": "http://example.org/graphs/2",
"@graph": {
"@id": "http://example.org/people/manu",
"http://example.com/vocab#name": "Manu"
}
},
{
"@id": "http://example.org/graphs/3",
"@graph": {
"@id": "http://example.org/people/Lehn",
"http://example.com/vocab#name": "Lehn"
}
}]
}
The outer @graph is syntax cruft and has no meaning.
Example from real data: https://gist.github.com/gcarothers/5889134 a replacement design might look like: https://gist.github.com/gcarothers/5889145 creating a @dataset which then uses normal JSON-LD keys to specify each graph.
This could be useful in a separate spec, but it might not take a different keyword to do it. Something we didn't get to in 1.0 is the ability to have node definitions which are indexed from an object, rather than being in an array form; there are likely elements that could be added to a context which would indicate that the values of the object containing the context are to be treated as IDs, with their values the node definition (with an optional @id, which MUST resolve to the same IRI). This would pretty much eat the RDF/JSON use case. Doing this for graph names would be pretty similar.
This would be a nice JSON-LD 1.1 feature.
If you don't mind a couple of extra triples you could do something like this:
{
"@context": {
"dataset": { "@id": "_:dataset", "@container": "@index" }
},
"dataset": {
"http://example.org/graphs/1":
{
"@id": "http://example.org/graphs/1",
"@graph": {
"@id": "http://example.org/people/gavin",
"http://example.com/vocab#name": "Gavin"
}
},
"http://example.org/graphs/2":
{
"@id": "http://example.org/graphs/2",
"@graph": {
"@id": "http://example.org/people/manu",
"http://example.com/vocab#name": "Manu"
}
},
"http://example.org/graphs/3":
{
"@id": "http://example.org/graphs/3",
"@graph": {
"@id": "http://example.org/people/Lehn",
"http://example.com/vocab#name": "Lehn"
}
}
}
}
The outer
@graphis syntax cruft and has no meaning.
You don't need to use it if you don't need to specify a context at the same time:
[
{
"@id": "http://example.org/graphs/1",
"@graph": {
"@id": "http://example.org/people/gavin",
"http://example.com/vocab#name": "Gavin"
}
},
...
]
is valid as well.
This is likely solved using the @container: @graph proposal from #195; this would certainly make datasets more navigable.
I propose closing this with no change; please 👍 or 👎 to close.
Seems like #481 and #195 address this concern.