Sparql\Client | EasyRdf API Documentation (original) (raw)

classClient

Class for making SPARQL queries using the SPARQL 1.1 Protocol

Methods

__construct(string queryUri,stringqueryUri, string queryUri,stringupdateUri = null)

Create a new SPARQL endpoint client

string

getQueryUri()

Get the URI of the SPARQL query endpoint

string

getUpdateUri()

Get the URI of the SPARQL update endpoint

query(string $query)

Make a query to the SPARQL endpoint

int

countTriples(string $condition = '?s ?p ?o')

Count the number of triples in a SPARQL 1.1 endpoint

listNamedGraphs(string $limit = null)

Get a list of named graphs from a SPARQL 1.1 endpoint

update(string $query)

Make an update request to the SPARQL endpoint

insert($data, $graphUri = null)

No description

updateData($operation, data,data, data,graphUri = null)

No description

clear($graphUri, $silent = false)

No description

request($type, $query)

No description

convertToTriples($data)

No description

string

preprocessQuery(string $query)

Adds missing prefix-definitions to the query

Response|Response

executeQuery(string processedquery,stringprocessed_query, string processedquery,stringtype)

Build http-client object, execute request and return a response

Graph|Result

parseResponseToQuery(Response|Response $response)

Parse HTTP-response object into a meaningful result-object.

setHeaders($client, name,name, name,value)

Proxy function to allow usage of our Client as well as Zend\Http v2.

Details

at line 70

**__construct**(string <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>q</mi><mi>u</mi><mi>e</mi><mi>r</mi><mi>y</mi><mi>U</mi><mi>r</mi><mi>i</mi><mo separator="true">,</mo><mi>s</mi><mi>t</mi><mi>r</mi><mi>i</mi><mi>n</mi><mi>g</mi></mrow><annotation encoding="application/x-tex">queryUri, string </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8778em;vertical-align:-0.1944em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">q</span><span class="mord mathnormal">u</span><span class="mord mathnormal" style="margin-right:0.03588em;">ery</span><span class="mord mathnormal" style="margin-right:0.10903em;">U</span><span class="mord mathnormal" style="margin-right:0.02778em;">r</span><span class="mord mathnormal">i</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal">s</span><span class="mord mathnormal">t</span><span class="mord mathnormal" style="margin-right:0.02778em;">r</span><span class="mord mathnormal">in</span><span class="mord mathnormal" style="margin-right:0.03588em;">g</span></span></span></span>updateUri = null)

Create a new SPARQL endpoint client

If the query and update endpoints are the same, then you only need to give a single URI.

at line 91

string**getQueryUri**()

Get the URI of the SPARQL query endpoint

at line 100

string**getUpdateUri**()

Get the URI of the SPARQL update endpoint

at line 109

**getUri**()

at line 126

Result|[Graph](../../EasyRdf/Graph.html) **query**(string $query)

Make a query to the SPARQL endpoint

SELECT and ASK queries will return an object of type EasyRdf\Sparql\Result.

CONSTRUCT and DESCRIBE queries will return an object of type EasyRdf\Graph.

at line 142

int**countTriples**(string $condition = '?s ?p ?o')

Count the number of triples in a SPARQL 1.1 endpoint

Performs a SELECT query to estriblish the total number of triples.

Counts total number of triples by default but a conditional triple pattern can be given to count of a subset of all triples.

at line 162

[Resource](../../EasyRdf/Resource.html)[]**listNamedGraphs**(string $limit = null)

Get a list of named graphs from a SPARQL 1.1 endpoint

Performs a SELECT query to get a list of the named graphs

at line 188

[Response](../../EasyRdf/Http/Response.html) **update**(string $query)

Make an update request to the SPARQL endpoint

Successful responses will return the HTTP response object

Unsuccessful responses will throw an exception

at line 193

**insert**($data, $graphUri = null)

at line 208

protected **updateData**($operation, <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>d</mi><mi>a</mi><mi>t</mi><mi>a</mi><mo separator="true">,</mo></mrow><annotation encoding="application/x-tex">data, </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">d</span><span class="mord mathnormal">a</span><span class="mord mathnormal">t</span><span class="mord mathnormal">a</span><span class="mpunct">,</span></span></span></span>graphUri = null)

at line 222

**clear**($graphUri, $silent = false)

at line 241

protected **request**($type, $query)

at line 258

protected **convertToTriples**($data)

at line 280

protected string**preprocessQuery**(string $query)

Adds missing prefix-definitions to the query

Overriding classes may execute arbitrary query-alteration here

at line 304

protected Response|Response **executeQuery**(string <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>p</mi><mi>r</mi><mi>o</mi><mi>c</mi><mi>e</mi><mi>s</mi><mi>s</mi><mi>e</mi><msub><mi>d</mi><mi>q</mi></msub><mi>u</mi><mi>e</mi><mi>r</mi><mi>y</mi><mo separator="true">,</mo><mi>s</mi><mi>t</mi><mi>r</mi><mi>i</mi><mi>n</mi><mi>g</mi></mrow><annotation encoding="application/x-tex">processed_query, string </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.9805em;vertical-align:-0.2861em;"></span><span class="mord mathnormal">p</span><span class="mord mathnormal">rocesse</span><span class="mord"><span class="mord mathnormal">d</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight" style="margin-right:0.03588em;">q</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.2861em;"><span></span></span></span></span></span></span><span class="mord mathnormal">u</span><span class="mord mathnormal" style="margin-right:0.03588em;">ery</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal">s</span><span class="mord mathnormal">t</span><span class="mord mathnormal" style="margin-right:0.02778em;">r</span><span class="mord mathnormal">in</span><span class="mord mathnormal" style="margin-right:0.03588em;">g</span></span></span></span>type)

Build http-client object, execute request and return a response

at line 387

protected Graph|Result**parseResponseToQuery**(Response|Response $response)

Parse HTTP-response object into a meaningful result-object.

Can be overridden to do custom processing

Proxy function to allow usage of our Client as well as Zend\Http v2.

Zend\Http\Client only accepts an array as first parameter, but our Client wants a name-value pair.