This is an automated email from the ASF dual-hosted git repository. andy pushed a commit to branch rdf-star in repository https://gitbox.apache.org/repos/asf/jena-site.git
commit f422fb1674314f998b6cffabb1b815fa8df5dac8 Author: Andy Seaborne <a...@apache.org> AuthorDate: Wed Jan 12 11:39:44 2022 +0000 Update RDF-star terminology --- source/documentation/rdf-star/__index.md | 44 +++++++++++++++++++------------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/source/documentation/rdf-star/__index.md b/source/documentation/rdf-star/__index.md index b61bc39..f5c57a7 100644 --- a/source/documentation/rdf-star/__index.md +++ b/source/documentation/rdf-star/__index.md @@ -17,7 +17,7 @@ Example: << :john foaf:name "John Smith" >> dct:source <http://example/directory> . ``` -The part `<< :john foaf:name "John Smith" >>` is an embedded triple and refers to the triple with subject `:john`, property `foaf:name` and object `"John Smith"`. +The part `<< :john foaf:name "John Smith" >>` is a quoted triple and refers to the triple with subject `:john`, property `foaf:name` and object `"John Smith"`. Triple terms can be in the subject or object position. @@ -25,9 +25,10 @@ Jena provides support for RDF-star and the related SPARQL-star. * Turtle, N-Triples, TriG and N-Quads extended for Triple Terms syntax, input and output. There is no output in RDF/XML. -* SPARQL extended with Triple Term syntax for graph matching -* SPARQL Result formats for JSON and XML extended to support Triple Terms in results. +* SPARQL extended with Triple Term syntax for graph matching. +* SPARQL Result formats for JSON and XML extended to support quoted triples in results. * Support in the Model API. +* Translation to and from RDF reification. All this is active by default in Fuseki. @@ -38,13 +39,13 @@ as well as in-memory databases is supported. ## RDF-star -RDF-star syntax for embedded triples is added to the parsers for Turtle, N-Triples, TriG and N-Quads. +RDF-star syntax for quoted triples is added to the parsers for Turtle, N-Triples, TriG and N-Quads. -Datasets may have graphs that have embedded triples that refer to triples anywhere, not just in the same graph. +Datasets may have graphs that have quoted triples that refer to triples anywhere, not just in the same graph. ## SPARQL-star -Matches for embedded triples: +Matches for quoted triples: ```sparql SELECT ?name { <<:john foaf:name ?name >> dct:source <http://example/directory> } @@ -75,25 +76,24 @@ SELECT (<< ?s ?p ?o>> AS ?t) { } ``` -### SPARQL Functions related to embedded triples +### SPARQL Functions related to quoted triples -These functions cause an expression error if passed the wrong type of arguments. `afn:` -is a prefix for `<http://jena.apache.org/ARQ/function#>`. +These functions cause an expression error if passed the wrong type of arguments. | Function | Description | |----------------------|------------------------ | -| `TRIPLE(?s, ?p, ?o)` | Create an embedded triple from s/p/o | -| `isTRIPLE(?t)` | Return true if the argument value is an embedded triple | -| `SUBJECT(?t)` | Return the subject of the embedded triple | -| `PREDICATE(?t)` | Return the predicate (property) of the embedded triple | -| `OBJECT(?t)` | Return the object of the embedded triple | +| `TRIPLE(?s, ?p, ?o)` | Create a quoted triple from s/p/o | +| `isTRIPLE(?t)` | Return true if the argument value is a quoted triple | +| `SUBJECT(?t)` | Return the subject of the quoted triple | +| `PREDICATE(?t)` | Return the predicate (property) of the quoted triple | +| `OBJECT(?t)` | Return the object of the quoted triple | ### SPARQL results The syntaxes for SPARQL results from a SELECT query, `application/sparql-results+json`, -`application/sparql-results+xml` are extended to include embedded triples: +`application/sparql-results+xml` are extended to include quoted triples: -The embedded triple `<< _:b0 <http://example/p> 123 >>` is encoded, in +The quoted triple `<< _:b0 <http://example/p> 123 >>` is encoded, in `application/sparql-results+json` as: ```json @@ -124,13 +124,21 @@ and similarly in `application/sparql-results+xml`: ## Model API -RDF-star embedded triples are treated as `Resource` to preserve the typed Model API. +RDF-star quoted triples are treated as `Resource` to preserve the typed Model API. They occur in the subject and object positions. -A `Resource` contains a `Statement` object if the underlying RDF term is an RDF-star embedded triple. +A `Resource` contains a `Statement` object if the underlying RDF term is an RDF-star quoted triple. New methods include: * `Statement Resource.getStatement()` * `Resource Model.createResource(Statement)` * `Resource ResourceFactory.createStatement` + +## Reification + +`org.apache.jena.system.RDFStar` provides functions to translate RDF-star into +RDF reification, and translate it back again to RDF-star. + +Translating back to RDF-star relies on the consistency constraint that there is +only one reification for each unique quoted triple term.