RDF-star (or RDF*) allows marking up triple with meta information such as source, quality, believability, or other attributes, thus extending the RDF graph model by including statements about statements.

There is a draft spec which describes RDF-star/SPARQL-star syntax and semantics. There is also a W3C working group page where you can find links to the various working documents.

RDF-star specification is not final or official yet, but it will likely become part of RDF-1.2 standards.

The main part of the RDF-star specification is the concept of quoted triple, where quoted has similar meaning to quotation in Lisp. Here's an excerpt from the spec draft:

It may be apt to draw a parallel between "quoted" triples and quoted expressions in the programming language Lisp. Expressions in Lisp (called "s-expressions") are interpreted through a process called "evaluation", and as a result they have a value. A quoted expression evaluates to the expression itself - you can imagine that quoting prevents the expression from being evaluated. In RDF (as well as in RDF-star), asserting a triple (i.e., considering it to be "true") serves as the analogue of evaluation. Triples are asserted, unless (in RDF-star) they are quoted which, effectively, prevents the triple from being asserted - thus a quoted triple stands by itself and we assign no truth value to it.

Quoted triples, as opposed to regular, asserted, triples, do not represent statements in the database. They are merely parts of other triples and only have meaning when referenced by asserted triples.

For example, in the following Turtle document

@prefix : <>.  
<< _:a :name "Alice" >> :statedBy :bob. 

there's only one triple:

<SOMETHING :statedBy :bob> 

but SOMETHING here happens to be not a single IRI or blank node, but a whole triple. At the same time, only <SOMETHING :statedBy :bob> is a statement in this dataset. The triple that this statement quotes, the <_:a :name "Alice">, is not a statement, so the SPARQL query

PREFIX : <>  
SELECT ?who { ?who :name "Alice" } 

will not return any results. The only way to get to a quoted triple is through an asserted triple that references it. The following query

PREFIX : <>  
SELECT ?who { << ?who :name "Alice" >> :statedBy :bob } 

will return a single result.

This is a very simple example that demonstrates the core idea of quoted triples. Please check out the spec for more examples that can all be run in AllegroGraph on an RDF-star-enabled repository.

RDF-star support in AllegroGraph

AllegroGraph provides opt-in support for RDF-star semantics on per-repository basis. The current implementation fully passes the existing test suite, but since the spec is still a draft and may still change in the future, AllegroGraph RDF-star semantics implementation can be considered experimental and therefore is not enabled by default.

AllegroGraph supports loading and exporting RDF-star data in the following RDF-star formats:

Since RDF-star is likely to become part of RDF-1.2 specs, these formats are not treated as separate syntaxes. Instead, when an AllegroGraph repository has RDF-star semantics enabled, the standard parsers and serializers will automatically handle RDF-star data. For example, if the user wants to load Turtle-star data, they can simply load it as Turtle data provided that the underlying repository has RDF-star semantics enabled. Similarly, if the user wants to export RDF-star data in Turtle-star format, they need to specify "Turtle" as the output format and if the underlying repository does contain quoted triples, they will be automatically written in Turtle-star format.

For efficiency purposes, AllegroGraph represents quoted triples as regular triples marked in a certain way. Quoted triples are also unified, so various asserted triples might be refering to the same quoted triple. Because of this, when we delete a triple that references a quoted triple, we don't touch the quoted triple because it might still be referenced by another triple. This may cause some quoted triple to become garbage or dangling quoted triples, that is quoted triples that are not referenced by any asserted triples. These do not affect query execution or triple store operations but are reflected in the triple count.

Enabling and disabling RDF-star mode

By default, RDF-star mode must be explicitly enabled for a given repository to be able to handle RDF-star data and SPARQL-star queries. This can be done in one of the following ways:

Finally, for AllegroGraph Lisp client users, a Lisp API is also provided. It consists of three functions that operate on current triple store:

 (db.agraph:enable-rdf-star-mode &key db)  
 (db.agraph:disable-rdf-star-mode &key db)  
 (db.agraph:rdf-star-mode-p &key db) 

Please note that at some point RDF-star will become part of the RDF-1.2 standard, and will be no longer be an opt-in feature, at which point most of these options will become obsolete and will be deprecated.

Known implementation issues

  1. Due to internal representation of the quoted triples, RDF-star mode can only be disabled when there are no quoted triples in the triple store. This is somewhat complicated by the fact that the repository can contain garbage quoted triples (see above). These garbage quoted triples are hard to delete selectively and can only be deleted for sure by deleting all triples in the triple store. So in order to disable RDF-star mode for a repository that contains quoted triples, you need to delete all triples, which makes enabling RDF-star mode operating effectively a one-way operation.

  2. Since quoted triples should not be interpreted as statements in the database they should not be counted towards total triple count for a repository but currently they are counted. This will be changed in the future versions of AllegroGraph once the spec matures.