- From: Filip Kolarik <filip26@gmail.com>
- Date: Mon, 16 Sep 2024 22:18:09 +0200
- To: Gregg Kellogg <gregg@greggkellogg.net>
- Cc: RDF-star WG <public-rdf-star-wg@w3.org>, JSON-LD Working Group <public-json-ld-wg@w3.org>
- Message-ID: <CADRK2_MJgNyJ36KJS4bH_nGY9m2WMOLOPo30+VCL7GsHZZZqhg@mail.gmail.com>
Hi Gregg, thank you for the examples. I like the compactness of @graph annotations and I wonder how to annotate a record, i.e. a group of statements represented as a JSON object. Would something like this be possible? { @context: ... @id: ... firstName: .. lastName: .. @annotation: { created: source: } } This should result in a list of statements (created, source,) about statements (@id firstName, .., @id lastName ...,). Best, Filip On Mon, Sep 16, 2024 at 2:47 AM Gregg Kellogg <gregg@greggkellogg.net> wrote: > A follow on to this, with some hypothetical multi-statement reifiers > acting like graphs. Consider JSON-LD Example 115 [1] about making > statements about a graph. > > { > "@context": { > "generatedAt": { > "@id": "http://www.w3.org/ns/prov#generatedAtTime", > "@type": "http://www.w3.org/2001/XMLSchema#dateTime" > }, > "Person": "http://xmlns.com/foaf/0.1/Person", > "name": "http://xmlns.com/foaf/0.1/name", > "knows": {"@id": "http://xmlns.com/foaf/0.1/knows", "@type": "@id"} > }, > "@id": "http://example.org/foaf-graph", > "generatedAt": "2012-04-09T00:00:00", > "@graph": [ > { > "@id": "http://manu.sporny.org/about#manu", > "@type": "Person", > "name": "Manu Sporny", > "knows": "https://greggkellogg.net/foaf#me" > }, { > "@id": "https://greggkellogg.net/foaf#me", > "@type": "Person", > "name": "Gregg Kellogg", > "knows": "http://manu.sporny.org/about#manu" > } > ] > } > > This results in the following TriG: > > @prefix foaf: <http://xmlns.com/foaf/0.1/> . > @prefix prov: <http://www.w3.org/ns/prov#> . > @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . > @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . > > <http://example.org/foaf-graph> prov:generatedAtTime "2012-04-09T00:00:00"^^xsd:dateTime . > > <http://example.org/foaf-graph> { > <http://manu.sporny.org/about#manu> a foaf:Person; > foaf:name "Manu Sporny"; > foaf:knows <https://greggkellogg.net/foaf#me> . > > <https://greggkellogg.net/foaf#me> a foaf:Person; > foaf:name "Gregg Kellogg"; > foaf:knows <http://manu.sporny.org/about#manu> . > } > > If you were to use @reifier instead of @graph, you’d get something like > the following Turtle: > > @prefix foaf: <http://xmlns.com/foaf/0.1/> . > @prefix prov: <http://www.w3.org/ns/prov#> . > @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . > @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . > > <http://example.org/foaf-graph> prov:generatedAtTime "2012-04-09T00:00:00"^^xsd:dateTime; > rdf:reifies <<( <http://manu.sporny.org/about#manu> a foaf:Person )>>, > <<( <http://manu.sporny.org/about#manu> foaf:name “Manu Sporny” )>>, <<( <http://manu.sporny.org/about#manu> foaf:knows <https://greggkellogg.net/foaf#me> )>>, <<( <https://greggkellogg.net/foaf#me> a foaf:Person )>>, <<( <https://greggkellogg.net/foaf#me> foaf:name “Gregg Kellogg” )>>, <<( <https://greggkellogg.net/foaf#me> foaf:knows <http://manu.sporny.org/about#manu> )>> . > > Gregg Kellogg > gregg@greggkellogg.net > > [1] https://www.w3.org/TR/json-ld11/ > > On Sep 14, 2024, at 1:13 PM, Gregg Kellogg <gregg@greggkellogg.net> wrote: > > 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 Monday, 16 September 2024 20:18:25 UTC