2019, April 24th


Olivier Corby <olivier.corby@inria.fr>


This document presents an implementation of RDF* and SPARQL* [Hartig 2017] in Corese Semantic Web Factory.

Table of Contents

1. Introduction
2. Implementation
3. Extension

1. Introduction

RDF* is an extension of RDF where a triple can be the subject and/or the object of a triple. Otherly said, triples can have properties as with Property Graph.


RDF triples are RDF* triples. If t and t' are RDF* triples, t s o is also an RDF* triple as well as s p t and t p t'. The same holds for SPARQL with triple patterns instead of triples.


RDF* provides users with an extension or Turtle syntax. The same holds for SPARQL*.

<<s p o>> q r


us:Jim us:believe <<<<us:John foaf:knows us:James>> us:since 2015>>


2. Implementation

In Corese, we implement RDF* by means of "named triple" that is similar to named graph.


A named triple is a triple with a name which is either a bnode or an URI. Triple names are generated by the parser. The triple properties are attached to its name, as shown below. In addition to RDF* syntax, we introduce the syntax triple(s p o t) to say that t is the name of a triple s p o.

RDF* :   <<s p o>> q r
Corese : triple(s p o t) . t q r

An RDF* graph is a set of RDF* triples, hence there is only one occurrence of each triple whether named or not. This means that s p o and triple(s p o t) count as one triple s p o in the graph. In addition, in our implementation, all RDF* triples are asserted.

There may be several occurrences of the same RDF* triple in different named graphs. The triple annotations are part of each named graph, hence they may differ from one named graph to another. However, as the default graph is the union of the named graphs, triple annotations are all parts of the default graph.


SPARQL is extended to query RDF*.

select * where {
   <<?s foaf:knows ?o>> us:since ?d 

This query is equivalent to the query below, where variable ?t matches the triple name.

select * where {
    triple(?s foaf:knows ?o ?t) .
    ?t us:since ?d

We also extend SPARQL* syntax to query triple names.

select * where {
   <<?s foaf:knows ?o ?t>> us:since ?d 

SPARQL Update is extended following the same design pattern.

insert data {
    <<us:John foaf:knows us:James>> us:since 2015 .
insert {
    us:Jim us:believe <<<<us:John foaf:knows ?x>> us:since ?d>>
where  {
    <<us:John foaf:knows ?x>> us:since ?d .

Delete query needs to specify the triple name with an explicit variable in the delete and the where clause

delete {
    <<us:John foaf:knows ?x ?t>> us:since ?d>>
where  {
    <<us:John foaf:knows ?x ?t>> us:since ?d .

For this reason (i.e. triple variable) "delete data" does not work with RDF* triple, "delete where" with a variable must be used.

where {
    <<us:John foaf:knows us:James ?t>> us:since 2015 .


3. Extension

SPARQL is extended with a syntax for triples with more than two nodes.

triple(s p o ?t)

In addition, it is possible to match triple with additional nodes with the syntax shown below. Variable ?l is bound to the list of additional nodes, not counting subject and object. In case of a target triple witout additional nodes, the match succeeds and the list is empty.

triple(s p o | ?l)

It is possible to check the size of the list.

triple(s p o | ?l)
filter (xt:size(?l) > 0)

An alternative syntax enables users to match directly the cardinality of the list.

triple(s p o |?c| )
filter (?c > 0)



Olaf Hartig, RDF* and SPARQL*: An Alternative Approach to Annotate Statements in RDF, poster at ISWC 2017.