Soprano  2.9.4
Soprano (aka QRDF) - A modular RDF storage framework

Soprano is a Qt-based pluggable framework for RDF storage and parsing. It tries to provide a highly usable interface to several Resource Description Framework (RDF) storage solutions.

Overview

Soprano centers around the Soprano::Model class which represents one storage set. A Soprano::Model is basically a set of RDF quadruples, i.e. Soprano::Statement. The actual storage is done via Soprano::Backend plugins. All query operations return Soprano::Iterator instances. Iterator is an explicitly shared class which is very easy to understand and use.

Soprano makes the distinction between two types of Models: Soprano::StorageModel and Soprano::FilterModel. The former is intended to be the basic Model which actually stores the data while the latter can be stacked on top of a Soprano::StorageModel to perform certain filter operations. These filter operations can range from very basic things such as disallowing any write operation (Soprano::Util::ReadOnlyModel) to more complex things such as full text indexing of all literal statements (Soprano::Index::IndexFilterModel) or exporting the Model via D-Bus (Soprano::Server::DBusExportModel).

Apart from storage Soprano provides a system for RDF parser and serializer plugins. For more details on parsing or serializing RDF data see the Soprano::Parser and Soprano::Serializer classes.

Soprano comes with a built in Server and Client implementations allowing remote repositories to be built quickly. Soprano::Client::SparqlModel provides a client to arbitrary SPARQL (SPARQL Protocol and RDF Query Language) Http services.

Quickstart

(Also see the Soprano Howto for details on building Soprano applications)

Create an RDF Model:

Fill it with statements:

model->addStatement( Soprano::Statement( QUrl( "http://mysite.org/data#A"), Soprano::Vocabulary::RDFS::label(), Soprano::LiteralValue( "A test resource" ) ) );

Read the data back:

while( it.next() ) {
displayStatement( *it );
}

Query the data:

Soprano::QueryResultIterator it = model->executeQuery( "select ?r where { ?r ?p ?o . }", Soprano::Query::QueryLanguageSparql );
while( it.next() ) {
displayResult( it.binding( "r" ) );
}

Contents

The following sections contain further information on the usage of Soprano.

Soprano::Model::executeQuery
virtual QueryResultIterator executeQuery(const QString &query, Query::QueryLanguage language, const QString &userQueryLanguage=QString()) const =0
QUrl
Soprano::Model::addStatement
virtual Error::ErrorCode addStatement(const Statement &statement)=0
Soprano::LiteralValue
Represents a literal value of an RDF Node.
Definition: literalvalue.h:67
Soprano::Vocabulary::RDFS::label
SOPRANO_EXPORT QUrl label()
Soprano::Statement
A Statement instance represents one RDF quadruple.
Definition: statement.h:48
Soprano::Query::QueryLanguageSparql
@ QueryLanguageSparql
Definition: sopranotypes.h:131
Soprano::QueryResultIterator
An iterator for query results.
Definition: queryresultiterator.h:109
Soprano::createModel
SOPRANO_EXPORT Model * createModel(const BackendSettings &settings=BackendSettings())
Soprano::Model
A Model is the central class in Soprano. It is a queryable collection of RDF quadruples,...
Definition: model.h:95
Soprano::StatementIterator
An iterator that provides a stream of Statements.
Definition: statementiterator.h:76
Soprano::QueryResultIterator::binding
Node binding(const QString &name) const
Soprano::Iterator::next
bool next()
Soprano::Model::listStatements
virtual StatementIterator listStatements(const Statement &partial) const =0