Semantic MediaWiki and related extensions
Public Member Functions | Public Attributes | List of all members
SMW\SPARQLStore\RepositoryConnection Interface Reference
Inheritance diagram for SMW\SPARQLStore\RepositoryConnection:
Inheritance graph
[legend]

Public Member Functions

 getRepositoryClient ()
 
 select ( $vars, $where, $options=[], $extraNamespaces=[])
 
 ask ( $where, $extraNamespaces=[])
 
 delete ( $deletePattern, $where, $extraNamespaces=[])
 
 doQuery ( $sparql)
 
 doUpdate ( $sparql)
 
 doHttpPost ( $payload)
 

Public Attributes

const QUERY_ENDPOINT = 1
 
const UPDATE_ENDPOINT = 2
 
const DATA_ENDPOINT = 4
 

Detailed Description

GNU GPL v2+

Since
2.2
Author
mwjames
Markus Krötzsch

Member Function Documentation

◆ ask()

SMW\SPARQLStore\RepositoryConnection::ask (   $where,
  $extraNamespaces = [] 
)

The function declares the standard namespaces wiki, swivt, rdf, owl, rdfs, property, xsd, so these do not have to be included in $extraNamespaces.

Parameters
$wherestring WHERE part of the query, without surrounding { }
$extraNamespacesarray (associative) of namespaceId => namespaceUri
Returns
RepositoryResult

Implemented in SMW\SPARQLStore\RepositoryConnectors\GenericRepositoryConnector.

◆ delete()

SMW\SPARQLStore\RepositoryConnection::delete (   $deletePattern,
  $where,
  $extraNamespaces = [] 
)

The function declares the standard namespaces wiki, swivt, rdf, owl, rdfs, property, xsd, so these do not have to be included in $extraNamespaces.

Parameters
$deletePatternstring CONSTRUCT pattern of tripples to delete
$wherestring condition for data to delete
$extraNamespacesarray (associative) of namespaceId => namespaceUri
Returns
boolean stating whether the operations succeeded

Implemented in SMW\SPARQLStore\RepositoryConnectors\GenericRepositoryConnector, and SMW\SPARQLStore\RepositoryConnectors\VirtuosoRepositoryConnector.

◆ doHttpPost()

SMW\SPARQLStore\RepositoryConnection::doHttpPost (   $payload)

Execute a HTTP-based SPARQL POST request according to http://www.w3.org/2009/sparql/docs/http-rdf-update/. The method throws exceptions based on GenericHttpDatabaseConnector::mapHttpRequestError(). If errors occur and this method does not throw anything, then an empty result with an error code is returned.

Note
This protocol is not part of the SPARQL standard and may not be supported by all stores. To avoid using it, simply do not provide a data endpoint URL when configuring the SPARQL database. If used, the protocol might lead to a better performance since there is less parsing required to fetch the data from the request.
Some stores (e.g. 4Store) support another mode of posting data that may be implemented in a special database handler.
Parameters
string$payloadTurtle serialization of data to send
Returns
boolean

Implemented in SMW\SPARQLStore\RepositoryConnectors\GenericRepositoryConnector, and SMW\SPARQLStore\RepositoryConnectors\FourstoreRepositoryConnector.

◆ doQuery()

SMW\SPARQLStore\RepositoryConnection::doQuery (   $sparql)

Execute a SPARQL query and return an RepositoryResult object that contains the results. The method throws exceptions based on GenericHttpDatabaseConnector::mapHttpRequestError(). If errors occur and this method does not throw anything, then an empty result with an error code is returned.

Note
This function sets the graph that is to be used as part of the request. Queries should not include additional graph information.
Parameters
string$sparqlcomplete SPARQL query (SELECT or ASK)
Returns
RepositoryResult

Implemented in SMW\SPARQLStore\RepositoryConnectors\GenericRepositoryConnector, SMW\SPARQLStore\RepositoryConnectors\FourstoreRepositoryConnector, and SMW\SPARQLStore\RepositoryConnectors\FusekiRepositoryConnector.

◆ doUpdate()

SMW\SPARQLStore\RepositoryConnection::doUpdate (   $sparql)

Execute a SPARQL update and return a boolean to indicate if the operations was successful. The method throws exceptions based on GenericHttpDatabaseConnector::mapHttpRequestError(). If errors occur and this method does not throw anything, then false is returned.

Note
When this is written, it is not clear if the update protocol supports a default-graph-uri parameter. Hence the target graph for all updates is generally encoded in the query string and not fixed when sending the query. Direct callers to this function must include the graph information in the queries that they build.
Parameters
string$sparqlcomplete SPARQL update query (INSERT or DELETE)
Returns
boolean

Implemented in SMW\SPARQLStore\RepositoryConnectors\GenericRepositoryConnector, SMW\SPARQLStore\RepositoryConnectors\VirtuosoRepositoryConnector, and SMW\SPARQLStore\RepositoryConnectors\FourstoreRepositoryConnector.

◆ getRepositoryClient()

SMW\SPARQLStore\RepositoryConnection::getRepositoryClient ( )

The function returns connection details required for establishing an active repository connection.

Since
2.5
Returns
RepositoryClient

Implemented in SMW\SPARQLStore\RepositoryConnectors\GenericRepositoryConnector.

◆ select()

SMW\SPARQLStore\RepositoryConnection::select (   $vars,
  $where,
  $options = [],
  $extraNamespaces = [] 
)

The function declares the standard namespaces wiki, swivt, rdf, owl, rdfs, property, xsd, so these do not have to be included in $extraNamespaces.

Parameters
$varsmixed array or string, field name(s) to be retrieved, can be '*'
$wherestring WHERE part of the query, without surrounding { }
$optionsarray (associative) of options, e.g. array( 'LIMIT' => '10' )
$extraNamespacesarray (associative) of namespaceId => namespaceUri
Returns
RepositoryResult

Implemented in SMW\SPARQLStore\RepositoryConnectors\GenericRepositoryConnector.

Member Data Documentation

◆ DATA_ENDPOINT

const SMW\SPARQLStore\RepositoryConnection::DATA_ENDPOINT = 4

Flag denoting endpoints being capable of SPARQL HTTP graph management

◆ QUERY_ENDPOINT

const SMW\SPARQLStore\RepositoryConnection::QUERY_ENDPOINT = 1

Flag denoting endpoints being capable of querying

◆ UPDATE_ENDPOINT

const SMW\SPARQLStore\RepositoryConnection::UPDATE_ENDPOINT = 2

Flag denoting endpoints being capable of updating


The documentation for this interface was generated from the following file:

About | General disclaimer | Privacy policy