Manual:SparqlClient.php

This code implements simple SPARQL client, which connects to given endpoint, runs a query and fetches the results.

Constructing
To construct the client, you should supply endpoint URL and HTTP request factory object. The factory can be obtained as:

Querying
Executes SPARQL query, and returns the array of rows, each representing variable => value map. If  is set, then the value represents encoded RDF value as specified in SPARQL 1.1 Query Results JSON Format. If it is not set (default), the value is just string.

If an error happens,  will be thrown.

Other methods
Sets HTTP client options, as defined by  class.

Sets query timeout, in seconds. The default is 30 seconds. Note that the query time is also limited by the SPARQL endpoint timeout settings.

Appends custom string to HTTP client agent string. The default user agent is HTTP client user agent string with " " appended. This is useful to distinguish between SPARQL requests from different parts of the application.