- From: Gregg Kellogg <gregg@greggkellogg.net>
- Date: Sat, 14 Sep 2024 13:13:16 -0700
- To: RDF-star WG <public-rdf-star-wg@w3.org>, JSON-LD Working Group <public-json-ld-wg@w3.org>
The JSON-LD CG (specifically, Pierre-Antoine, Niklas and myself) started a draft on JSON-LD-star [1] in 2020. Since then, the target has changed, so we’ve created an issue to consider how this might adapt to Triple Terms, Reifying Triples, and Annotations [2].
Basically, the idea is to add three new keywords to JSON-LD, @reifies, @triple, and @annotation. JSON-LD encodes RDF iin JSON using Node Objects, which can represent a subject/identifier, @type and properties based on key/value entries in a map. This proposal uses @reifies, @triple, and @annotation as special properties to encode triple terms.
At the most fundamental level, @triple is intended to encode a single triple with an @id and a single-valued property.
{
"@context": {
"@base": "http://example.org/",
"@vocab": "http://example.org/",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
},
"rdf:reifies": {
"@triple": {
"@id": "bob",
"age": 42
}
},
"certainty": 0.8
}
This would be equivalent to the following Turtle:
BASE <http://example.org/>
PREFIX : <http://example.org/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#”>
[ rdf:reifies <<( :bob :age 42 ))> ]; :certainty: 0.8 .
In this case, since there is no explicit @id at the top level, a blank node is generated, which is used as the reifier.
The @reifies keyword can be used to compact this, and holds the potentially for reifying more than one triple:
{
"@context": {
"@base": "http://example.org/",
"@vocab": "http://example.org/",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
},
“@id”: “reifier”,
"@reifies": {
"@id": "bob",
"age": 42
},
"certainty": 0.8
}
The example shows a single triple, but in principle, @reifies could take an array of objects, each with a different @id, and each object may have one or more properties; each of these could turn into a separate triple term referenced by the same reifier. This perticular example uses an expicit reifier, so the resulting Turtle would be:
BASE <http://example.org/>
PREFIX : <http://example.org/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#”>
:reifier rdf:reifies <<( :bob :age 42 ))>; :certainty: 0.8 .
It’s an open question if downstream relationships would also be reified; they’re not in Turtle.
The annotation syntax is similar to Turtle:
{
"@context": {
"@base": "http://example.org/",
"@vocab": "http://example.org/"
},
"@id": "bob",
"age": {
"@value": 42,
"@annotation": {
"@id": "_:anno",
"certainty": 0.8
}
}
}
In this case, the annotation may have it’s own reifier assigned (here ’s _:anno), or one can be assigned automatically. This would be equivalent to the following Turtle:
:bob :age 42 ~ _:anno {| :certainty 8.0E-1 |} .
Note that in the Reification example, the @refiies keyword acts much like @graph. If it were restated as follows, it would use the named graph syntax, which is common in Verifiable Claims.
{
"@context": {
"@base": "http://example.org/",
"@vocab": "http://example.org/",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
},
"@id": "reifier",
"@graph": {
"@id": "bob",
"age": 42
},
"certainty": 0.8
}
This results in the following TriG.
BASE <http://example.org/>
PREFIX : <http://example.org/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#”>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> .
:reifier :certainty 8.0E-1 .
:reifier {
:bob :age 42 .
}
This suggests that there may be a way to describe named graphs using reification.
Gregg Kellogg
gregg@greggkellogg.net
[1] https://json-ld.github.io/json-ld-star/
[2] https://github.com/json-ld/json-ld-star/issues/49
Received on Saturday, 14 September 2024 20:13:33 UTC