Closed
Description
I just try to test my understanding...
Consider the following TriG dataset:
@prefix a <http://example.org/a> .
@prefix b <http://example.org/b> .
@prefix c <http://example.org/c> .
<http://example.org/gr1> {
a:something a:predicate "value1",
b:predicate c:something1 .
}
<http://example.org/gr2> {
a:something a:predicate "value2",
b:predicate c:something2 .
}
The only way to express this in JSON-LD to repeat a @context
, i.e.,
[
{
"@context" : {
"a": "http://example.org/a",
"b": "http://example.org/b",
"c": "http://example.org/c",
"b:predicate" : { "@type" : "@id" }
},
"@id" : "http://example.org/gr1",
"@graph" : {
"@id" : "a:something",
"a:predicate" : "value1",
"b:predicate" : "c:something1"
}
},
{
"@context" : {
"a": "http://example.org/a",
"b": "http://example.org/b",
"c": "http://example.org/c",
"b:predicate" : { "@type" : "@id" }
},
"@id" : "http://example.org/gr2",
"@graph" : {
"@id" : "a:something",
"a:predicate" : "value2",
"b:predicate" : "c:something2"
}
}
]
I.e., the context must be repeated.; there is no way of using a "global" context. I am not sure whether this is a problem in practice, but it may become one if JSON-ID is used for large datasets. In any case, this may have to be documented somewhere because it may not be 100% obvious for a first-time reader (best practices document?).
That being said: one way of handling that over the Web is if the server returns
[
{
"@id" : "http://example.org/gr1",
"@graph" : {
"@id" : "a:something",
"a:predicate" : "value1",
"b:predicate" : "c:something1"
}
},
{
"@id" : "http://example.org/gr2",
"@graph" : {
"@id" : "a:something",
"a:predicate" : "value2",
"b:predicate" : "c:something2"
}
}
]
and the @context
is returned via an HTTP Link. According to section 6, the processor is supposed to repeat the context for each element of the array...
Metadata
Metadata
Assignees
Labels
No labels