Redland RDF Library Manual |
---|
The Virtuoso Redland RDF Provider is an implementation of the Storage API, Model and Query interfaces of the Redland framework for RDF. This provider enables the execution of queries via the Redland Rasqal query engine or via Virtuoso query engine directly against the Virtuoso OpenSource Quad Store.
The Virtuoso Redland RDF Provider uses ODBC as the data access mechanism for communicating the Virtuoso Quad Store and requires the Virtuoso ODBC Driver be installed on the Redland client and a suitable ODBC DSN be configured for connecting to the target Virtuoso Quad Store instance.
The provider has been tested against the Redland 1.0.8 version currently available for download. Virtuoso is capable of efficiently handle large amounts of data and has been tested with upto 1B triples.
There are several options required with the virtuoso storage in order to connect to the database. These are:
dsn
for the ODBC datasource name
user
for the database server user name
password
for the database server password
database
for the database name (not the storage name)
host
for the database server hostname
charset
for the database charset to use
NOTE: Take care exposing the password as for example, program
arguments or environment variables. The rdfproc
utility can with help this by reading the password from standard
input. Inside programs, one way to prevent storing the password in a
string is to construct a Redland hash of the storage options such as
via librdf_hash_from_string
and use
librdf_new_storage_with_options
to create a storage.
The rdfproc utility source code demonstrates this.
The storage name parameter given to the storage constructor
librdf_new_storage
is used inside the virtuoso store to
allow multiple stores inside one Virtuoso database instance as
parameterised with the above options.
This store always provides contexts; the boolean storage option
contexts
is not checked.
Examples:
/* A new Virtuoso store */ storage=librdf_new_storage(world, "virtuoso", "db1", "dsn='Local Virtuoso',user='demo',password='demo'"); /* A different, existing Virtuoso store in the same database as above */ storage=librdf_new_storage(world, "virtuoso", "db2", "dsn='Local Virtuoso',user='demo',password='demo'"); /* An existing Virtuoso store on a different database server */ storage=librdf_new_storage(world, "virtuoso", "http://red3", "dsn='Remote Virtuoso',user='demo',password='demo'"); /* Opening with an options hash */ options=librdf_new_hash(world, NULL); librdf_hash_from_string(options, "dsn='Local Virtuoso',user='demo'"); librdf_hash_put_strings(options, "password", user_password); storage=librdf_new_storage_with_options(world, "virtuoso", "http://red3", options);
In PHP:
# An existing store $storage=librdf_new_storage($world, 'virtuoso', 'db4', "dsn='Local Virtuoso',user='demo',password='demo'");
Summary:
Persistent
Suitable for extremely large models, 1B+ triples
Indexed and optimized
Possibility of free text searching
Contexts always provided