Soprano  2.7.56
Virtuoso Storage Backend

The Virtuoso storage backend provides access to Virtuoso servers. It can connect to already running servers as well as spawn its own local instance. The Virtuoso server is accessed via ODBC through the client library iODBC. Currently no other client libraries are supported (which also means that this backend can only be used on systems that have libiODBC which excludes Windows).

The name of the backend is virtuosobackend. Thus, to use it one simply has to load it as follows:

Supported Settings

The Virtuoso backend supports the following settings which can be passed to Soprano::Backend::createModel:

The settings above are user settings and have to be provided using Soprano::BackendOptionUser:

 Soprano::BackendSettings settings;
 // configure the used indexes
 settings << Soprano::BackendSetting( "indexes", "spog,posg,opsg" );

 // set the full text index to be updated every 10 minutes
 settings << Soprano::BackendSetting( "fulltextindex", "10" );

The following setting is required for starting a local instance of Virtuoso:

The following settings need to be provided to access an already running Virtuoso server:

Additional Features

Server Stopped Signal

Models created by the Virtuoso backend emit a non-standard signal which informs the client that the Virtuoso server went down. This signal is only emitted for Virtuoso instances that were started by the backend and has the following signature:

 void virtuosoStopped(bool normalExit);

The parameter normalExit is true if the instance went down as scheduled (deletion of the model) and false if the Virtuoso instance crashed or was killed by a third party. Typically a client would connect to the signal to properly re-create the model.

SQL Queries

It is possible to perform plain SQL queries through the Soprano API by using the sql user query language in Model::executeQuery:

 QString query = "select * from DB.DBA.RDF_GRAPH_GROUP";
 Soprano::QueryResultIterator it = model->executeQuery(query, Soprano::Query::QueryLanguageUser, "sql");

Virtuoso Specialities

Since Virtuoso is an SQL server and, thus, does store all RDF data in SQL tables it has some characteristics that are worth mentioning:

The Empty Graph

Virtuoso/SPAURL has no notion of the empty/default graph. Thus, by default, it is not possible to add statements to the empty/default graph. The Soprano backend works around this problem by introducing a special named graph which is used internally to store triples that belong to the default/empty graph.

This means that a conversion needs to take place whenever the empty graph or the special graph are encountered. This introduces a slight performance penalty. In the future an option might be introduced to disable this behaviour.

SQL Types

Virtuoso, being an SQL server, does not have specific types for boolean, decimal and others. They are all represented as SQL integer values.

The backend does solve this issue for boolean values only by introducing a fake datatype for boolean literals. This is converted internally so the user of the backend will never notice it. The only exception may be queries that contain filters. More input is needed here.