Home

Contents
Preface

RDF Database and SPARQL

Data Representation
RDF and SPARQL API and SQL
SPARQL Implementation Extent
SPARQL and XQuery
SPARQL Protocol End Point

14.3. SPARQL Implementation Extent

Virtuoso's RDF support is at an early implementation stage. The SPARQL language is fairly complete but none of the support functions such as data loading or triple storage are optimized. Many pieces of the present implementation that are written in Virtuoso/PL will be rewritten in C for performance.

Also, the triple store has no specific security model. Thus access rights of the tables and stored procedures involved in the process dictate who can access these features.

All triples of all graphs are stored in a single default system table called DB.DBA.RDF_QUAD. This will change in the next release, where a complex meta-schema system will be introduced for allowing graphs to be stored in different tables, potentially having different index structures, optionally also full text index on long object values. The meta-schema support will also make it possible to map native SQL tables into the RDF SPARQL -queriable space, as well as introduce finer-grained security.

Hence the RDF subsystem is offered for review but is not a productized whole. Benchmark results obtained with it are tentative and reflect a non-optimized state.

The current implementation does not support some SPARQL features.

On the other hand, Virtuoso implements some extensions to SPARQL . One extension, 'DEFINE ...' clause, e.g., 'define output:valmode "LONG"' is described above.

Virtuoso also allows use of expressions in some places where SPARQL only allows constant expressions or variables. For example, the values list of SELECT may contain arbitrary expressions in parenthesis as well as variable names. Expressions may also appear in triples of CONSTRUCT pattern or WHERE pattern: an expression can be used instead of constant or variable name for subject, predicate or object. In this case, an expression is surrounded by backquotes.

The following return all distinct 'fragment' parts of all subjects in all graphs that have some predicate whose value is equal to 2+2.

SQL>sparql select distinct (bif:subseq (?s, bif:strchr (?s, '#')))
   where {
     graph ?g {
       ?s ?p `2+2` .
       filter (! bif:isnull (bif:strchr (?s, '#') ) )
     } };

callret
VARCHAR
----------
#four

14.3.1. SPARQL and XQuery

In the current implementation, the XQuery Function Library is not available from SPARQL .

As a termporary workaround, string parsing functions are made available, because they are widely used in W3C DAWG examples and the like. They are

xsd:boolean (in strg any) returns integer
xsd:dateTime (in strg any) returns datetime
xsd:double (in strg varchar) returns double precision
xsd:float (in strg varchar) returns float
xsd:integer (in strg varchar) returns integer

(assuming that the query contains declaration 'PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>')