MediaWiki
1.34.0
|
Simple SPARQL client. More...
Public Member Functions | |
__construct ( $url, HttpRequestFactory $requestFactory) | |
appendUserAgent ( $agent) | |
Append specific string to user agent. More... | |
getUserAgent () | |
Get current user agent. More... | |
query ( $sparql, $rawData=false) | |
Query SPARQL endpoint. More... | |
setClientOptions ( $options) | |
Set client options. More... | |
setTimeout ( $timeout) | |
Set query timeout (in seconds) More... | |
setUserAgent ( $agent) | |
Set user agent string. More... | |
Public Attributes | |
const | MAX_GET_SIZE = 2048 |
Limit on how long can be the query to be sent by GET. More... | |
Private Member Functions | |
extractData ( $data, $rawData=false) | |
Extract data from SPARQL response format. More... | |
Private Attributes | |
string | $endpoint |
SPARQL endpoint URL. More... | |
array | $options = [] |
Client options. More... | |
HttpRequestFactory | $requestFactory |
int | $timeout = 30 |
Query timeout (seconds) More... | |
string | $userAgent |
User agent for HTTP requests. More... | |
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, $status, MediaWiki\Sparql\SparqlClient\$timeout, MediaWiki\Sparql\SparqlClient\$userAgent, MediaWiki\Sparql\SparqlClient\extractData(), 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.
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.