MediaWiki master
MediaWiki\Sparql\SparqlClient Class Reference

Simple SPARQL client. More...

Public Member Functions

 __construct (string $url, HttpRequestFactory $requestFactory)
 
 appendUserAgent (string $agent)
 Append specific string to user agent.
 
 getUserAgent ()
 Get current user agent.
 
 query (string $sparql, bool $rawData=false)
 Query SPARQL endpoint.
 
 setClientOptions (array $options)
 
 setTimeout (int $timeout)
 Set query timeout (in seconds)
 
 setUserAgent (string $agent)
 Mote it is not recommended to completely override user agent for most applications.
 

Public Attributes

const MAX_GET_SIZE = 2048
 Limit on how long can be the query to be sent by GET.
 

Detailed Description

Simple SPARQL client.

Author
Stas Malyshev

Definition at line 31 of file SparqlClient.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Sparql\SparqlClient::__construct ( string $url,
HttpRequestFactory $requestFactory )
Parameters
string$urlSPARQL Endpoint
HttpRequestFactory$requestFactory

Definition at line 64 of file SparqlClient.php.

References $url, and MediaWiki\Http\HttpRequestFactory\getUserAgent().

Member Function Documentation

◆ appendUserAgent()

MediaWiki\Sparql\SparqlClient::appendUserAgent ( string $agent)

Append specific string to user agent.

This is the recommended way of specifying the user agent for specific applications of the SparqlClient inside MediaWiki and extension code.

Parameters
string$agent

Definition at line 119 of file SparqlClient.php.

◆ getUserAgent()

MediaWiki\Sparql\SparqlClient::getUserAgent ( )

Get current user agent.

Returns
string

Definition at line 95 of file SparqlClient.php.

◆ query()

MediaWiki\Sparql\SparqlClient::query ( string $sparql,
bool $rawData = false )

Query SPARQL endpoint.

Parameters
string$sparqlquery
bool$rawDataWhether to return only values or full data objects
Returns
array[] List of results, one row per array element Each row will contain fields indexed by variable name.
Exceptions
SparqlException

Definition at line 133 of file SparqlClient.php.

◆ setClientOptions()

MediaWiki\Sparql\SparqlClient::setClientOptions ( array $options)
Parameters
array$options
Returns
$this

Definition at line 86 of file SparqlClient.php.

◆ setTimeout()

MediaWiki\Sparql\SparqlClient::setTimeout ( int $timeout)

Set query timeout (in seconds)

Parameters
int$timeout
Returns
$this

Definition at line 75 of file SparqlClient.php.

◆ setUserAgent()

MediaWiki\Sparql\SparqlClient::setUserAgent ( string $agent)

Mote it is not recommended to completely override user agent for most applications.

See also
appendUserAgent() for recommended way of specifying user agent.
Parameters
string$agent

Definition at line 106 of file SparqlClient.php.

Member Data Documentation

◆ MAX_GET_SIZE

const MediaWiki\Sparql\SparqlClient::MAX_GET_SIZE = 2048

Limit on how long can be the query to be sent by GET.

Definition at line 36 of file SparqlClient.php.


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