Help:SPARQLStore GenericHttpDatabaseConnector

From semantic-mediawiki.org
Jump to: navigation, search
SPARQLStoreSPARQLStore/RepositoryConnectorHelp:SPARQLStore GenericHttpDatabaseConnector
SPARQLStore/RepositoryConnector/Generic
Default access point for the SPARQLStore
Further Information
Short name: Generic (Default)
Provided by: Semantic MediaWiki
Added: 2.0
Removed: still in use
Keyword : RDF · SPARQLStore · Database connector
Table of Contents

To configure SMW to use a SPARQL database, you need to know the location of the SPARQL query service and the location of the SPARQL update service. Optionally, you can also make use of a service that supports the SPARQL over HTTP protocol for updates (if used, SMW will prefer this method over SPARQL Update for simple update requests; it can be omitted if problems occur). The locations of these web services then must be given in LocalSettings.php, as in the following example:

Configuration

$smwgDefaultStore = 'SMWSparqlStore';
$smwgSparqlDatabaseConnector = 'default';                          # using the default connector
$smwgSparqlQueryEndpoint = 'http://localhost:8080/sparql/';        # location of query service
$smwgSparqlUpdateEndpoint = 'http://localhost:8080/update/';       # location of update service
$smwgSparqlDataEndpoint = 'http://localhost:8080/data/';           # location of SPARQL over HTTP service (set it to ''; in case of problems)
$smwgSparqlDefaultGraph = 'http://example.org/mydefaultgraphname'; # optional name of default graph

The first line tells SMW to use the SPARQL store implementation to store data (instead of the SMWSQLStore2 that is the default). The remaining lines provide the relevant service locations, where the last two lines can be omitted. In many cases, $smwgSparqlDataEndpoint should rather not be set since most stores have their own protocol for posting.

By default, SMW will use a generic SPARQL connector that is based on recent SPARQL documents. Some RDF databases might not be fully compatible with this or might need special tweaks to make use of advanced, non-standard features. Special settings therefore should be used with some stores.

Custom database connectors

Stores that are conforming to the official SPARQL and SPARQL Update standards should mostly work out of the box. In many cases, the setting $smwgSparqlDataEndpoint = ''; should be used, since support for the (optional) data endpoint protocol is not well tested.

To take advantage of special features of your store, a modified implementation can be created easily by subclassing GenericHttpDatabaseConnector together with changing the $smwgSparqlDatabase setting. Other examples include:

  • FourstoreHttpDatabaseConnector
  • VirtuosoHttpDatabaseConnector