MediaWiki REL1_32
|
Simple SPARQL client. More...
Public Member Functions | |
__construct ( $url, HttpRequestFactory $requestFactory) | |
appendUserAgent ( $agent) | |
Append specific string to user agent. | |
getUserAgent () | |
Get current user agent. | |
query ( $sparql, $rawData=false) | |
Query SPARQL endpoint. | |
setClientOptions ( $options) | |
Set client options. | |
setTimeout ( $timeout) | |
Set query timeout (in seconds) | |
setUserAgent ( $agent) | |
Set user agent string. | |
Public Attributes | |
const | MAX_GET_SIZE = 2048 |
Limit on how long can be the query to be sent by GET. | |
Private Member Functions | |
extractData ( $data, $rawData=false) | |
Extract data from SPARQL response format. | |
Private Attributes | |
string | $endpoint |
SPARQL endpoint URL. | |
array | $options = [] |
Client options. | |
HttpRequestFactory | $requestFactory |
int | $timeout = 30 |
Query timeout (seconds) | |
string | $userAgent |
User agent for HTTP requests. | |
Simple SPARQL client.
Definition at line 31 of file SparqlClient.php.
MediaWiki\Sparql\SparqlClient::__construct | ( | $url, | |
HttpRequestFactory | $requestFactory | ||
) |
string | $url | SPARQL Endpoint |
HttpRequestFactory | $requestFactory |
Definition at line 71 of file SparqlClient.php.
References MediaWiki\Sparql\SparqlClient\$requestFactory, and Http\userAgent().
MediaWiki\Sparql\SparqlClient::appendUserAgent | ( | $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.
string | $agent |
Definition at line 129 of file SparqlClient.php.
|
private |
Extract data from SPARQL response format.
The response must be in format described in: https://www.w3.org/TR/sparql11-results-json/
array | $data | SPARQL result |
bool | $rawData | Whether to return only values or full data objects |
Definition at line 197 of file SparqlClient.php.
Referenced by MediaWiki\Sparql\SparqlClient\query().
MediaWiki\Sparql\SparqlClient::getUserAgent | ( | ) |
Get current user agent.
Definition at line 103 of file SparqlClient.php.
References MediaWiki\Sparql\SparqlClient\$userAgent.
MediaWiki\Sparql\SparqlClient::query | ( | $sparql, | |
$rawData = false |
|||
) |
Query SPARQL endpoint.
string | $sparql | query |
bool | $rawData | Whether to return only values or full data objects |
SparqlException |
Definition at line 143 of file SparqlClient.php.
References MediaWiki\Sparql\SparqlClient\$options, $request, MediaWiki\Sparql\SparqlClient\$timeout, MediaWiki\Sparql\SparqlClient\$userAgent, MediaWiki\Sparql\SparqlClient\extractData(), options(), and wfAppendQuery().
MediaWiki\Sparql\SparqlClient::setClientOptions | ( | $options | ) |
Set client options.
array | $options |
Definition at line 94 of file SparqlClient.php.
References MediaWiki\Sparql\SparqlClient\$options, and options().
MediaWiki\Sparql\SparqlClient::setTimeout | ( | $timeout | ) |
Set query timeout (in seconds)
int | $timeout |
Definition at line 82 of file SparqlClient.php.
References MediaWiki\Sparql\SparqlClient\$timeout.
MediaWiki\Sparql\SparqlClient::setUserAgent | ( | $agent | ) |
Set user agent string.
Mote it is not recommended to completely override user agent for most applications.
string | $agent |
Definition at line 116 of file SparqlClient.php.
|
private |
SPARQL endpoint URL.
Definition at line 54 of file SparqlClient.php.
|
private |
Client options.
Definition at line 60 of file SparqlClient.php.
Referenced by MediaWiki\Sparql\SparqlClient\query(), and MediaWiki\Sparql\SparqlClient\setClientOptions().
|
private |
Definition at line 65 of file SparqlClient.php.
Referenced by MediaWiki\Sparql\SparqlClient\__construct().
|
private |
Query timeout (seconds)
Definition at line 48 of file SparqlClient.php.
Referenced by MediaWiki\Sparql\SparqlClient\query(), and MediaWiki\Sparql\SparqlClient\setTimeout().
|
private |
User agent for HTTP requests.
Definition at line 42 of file SparqlClient.php.
Referenced by MediaWiki\Sparql\SparqlClient\getUserAgent(), and MediaWiki\Sparql\SparqlClient\query().
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.
Referenced by MediaWiki\Sparql\SparqlClientTest\optionsProvider().