The RDF Database (RDFDB) library defines a lightweight, consistent interface for accessing RDF stores in PHP using the SPARQL query and update language
PHP
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
4store add info on 4store installation Aug 5, 2010
drupal add drupal wrapper module Sep 16, 2010
tests add 4store driver with tests Aug 26, 2010
README.txt more details on the rationale behind this library Nov 2, 2010
README_4store.txt make the README file less drupal specific Aug 26, 2010
README_virtuoso.txt improve documentation in README and README_virtuoso Aug 26, 2010
dev.php add library files Aug 16, 2010
http.inc
index.php add library files Aug 16, 2010
rdfdb.inc parseConnectionInfo() does not exist in RDFDB Sep 16, 2010
rdfdb.query.inc - add new SelectCustomQuery and rdfdb_query for raw SPARQL queries (u… Aug 25, 2010
rdfdb.query_4store.inc add 4store driver with tests Aug 26, 2010
rdfdb.query_arc2.inc fix minor docs issues in arc2 driver Aug 25, 2010
rdfdb.query_virtuoso.inc add query_update to virtuoso driver with a custom HTTP client Aug 25, 2010
rdfdb_4store.inc remove non used ARC2_RemoteStore_Rdfdb since we use http.inc for now. Aug 27, 2010
rdfdb_arc2.inc remove non used ARC2_RemoteStore_Rdfdb since we use http.inc for now. Aug 27, 2010
rdfdb_virtuoso.inc add query_update to virtuoso driver with a custom HTTP client Aug 25, 2010
related.txt add library files Aug 16, 2010

README.txt

The RDF Database (RDFDB) library defines a lightweight, consistent interface for accessing RDF stores in PHP using the SPARQL query and update language. Each RDF store driver that implements the RDFDB interface can expose store-specific features as regular extension functions. Note that in order to use this interface you must use a store-specific RDFDB driver to access a SPARQL endpoint. RDFDB provides a data-access abstraction layer, which means that, regardless of which store you're using, you use the same functions and syntax to issue SPARQL queries.

The RDF Database library provides a standard, vendor-agnostic abstraction layer for accessing RDF stores. The API is designed to preserve the syntax and power of SPARQL 1.1 as much as possible, but also:

    * to support multiple RDF database servers easily;
    * to provide a structured interface for the dynamic construction of queries;
    * to enforce security checks and other good practices;
    * to provide developers with a clean interface for intercepting and modifying a site's queries.
    * no cURL or Zend dependency.

== Rationale ==

In an ideal world, all RDF stores would implement SPARQL 1.1 once it reaches W3C recommendation status. Today, however, we are still seeing a lot of disparity among the RDF stores available to developers. Many of them are solid, reliable and scalable implementions of quads stores. It is our hope that the internal complexity of this library will decrease overtime, or even become unecessary in the coming years. Note however that even after several decades, SQL vendors still use some proprietary syntax.

Examples of disparities which RDFDB takes away:
- 4store uses different endpoints for read and update queries. Updates in 4store is done using a RESTful set of HTTP requests (PUT, DELETE, POST).
- ARC2 uses its own SPARQL+ syntax.


== Drivers ==

Because different RDF stores require different sorts of interaction, the RDF database layer requires a driver for each database type. RDFDB currently include drivers for ARC2, 4store and Virtuoso.

== Connections ==

A connection is an object of class RdfdbConnection. Every RDF database to which your application connects has a single connection object associated with it. That connection object must be subclassed for each individual driver.

== Queries ==

A query is an SPARQL statement that will be sent to a database connection. Queries use object-oriented query builders. A "query object" refers to an instance of a query builder for one of the various query types. Only the SPARQL queries of the following types are supported: SELECT, INSERT DATA, DELETE DATA, CLEAR.

== Connection key ==

A connection key is a unique identifier for a given RDF database connection. The connection key must be unique for a given site, and there must always be a connection of "default" that will be the primary database. Note that at the moment, we do not yet make use of the target key, so it should be left as default for now. Each driver may have different configuration depending on what is appropriate for it.

$databases['rdfdb1']['default'] = array(
  'driver' => 'arc2',
  'endpoint' => 'http://localhost/arc2_endpoint.php',
  'apikey' => 'somekey',
);
$databases['rdfdb2']['default'] = array(
  'driver' => '4store',
  'endpoint' => 'http://localhost:8080/sparql/',
);


== Resources ==

SPARQL portal
http://www.w3.org/standards/techs/sparql

SPARQL 1.1
http://www.w3.org/TR/sparql11-query/
http://www.w3.org/TR/sparql11-update/
http://www.w3.org/TR/sparql11-protocol/
http://www.w3.org/TR/sparql11-http-rdf-update/