EasyRdf API Documentation
Class

EasyRdf_Sparql_Result

class EasyRdf_Sparql_Result extends ArrayIterator

Class for returned for SPARQL SELECT and ASK query responses.

Constants

SPARQL_XML_RESULTS_NS

A constant for the SPARQL Query Results XML Format namespace

Methods

__construct(string $data, string $mimeType)

Create a new SPARQL Result object

string getType()

Get the query result type (boolean/bindings)

boolean getBoolean()

Return the boolean value of the query result

boolean isTrue()

Return true if the result of the query was true.

boolean isFalse()

Return false if the result of the query was false.

integer numFields()

Return the number of fields in a query result of type bindings.

integer numRows()

Return the number of rows in a query result of type bindings.

array getFields()

Get the field names in a query result of type bindings.

dump(string $format = 'html')

Return a human readable view of the query result.

string __toString()

Magic method to return value of the result to string

Details

at line 66
public __construct(string $data, string $mimeType)

Create a new SPARQL Result object

You should not normally need to create a SPARQL result object directly - it will be constructed automatically for you by EasyRdfSparqlClient.

Parameters

string $data The SPARQL result body
string $mimeType The MIME type of the result

at line 86
public string getType()

Get the query result type (boolean/bindings)

ASK queries return a result of type 'boolean'. SELECT query return a result of type 'bindings'.

Return Value

string The query result type.

at line 99
public boolean getBoolean()

Return the boolean value of the query result

If the query was of type boolean then this method will return either true or false. If the query was of some other type then this method will return null.

Return Value

boolean The result of the query.

at line 108
public boolean isTrue()

Return true if the result of the query was true.

Return Value

boolean True if the query result was true.

at line 117
public boolean isFalse()

Return false if the result of the query was false.

Return Value

boolean True if the query result was false.

at line 126
public integer numFields()

Return the number of fields in a query result of type bindings.

Return Value

integer The number of fields.

at line 135
public integer numRows()

Return the number of rows in a query result of type bindings.

Return Value

integer The number of rows.

at line 144
public array getFields()

Get the field names in a query result of type bindings.

Return Value

array The names of the fields in the result.

at line 156
public dump(string $format = 'html')

Return a human readable view of the query result.

This method is intended to be a debugging aid and will return a pretty-print view of the query result.

Parameters

string $format Either 'text' or 'html'

at line 376
public string __toString()

Magic method to return value of the result to string

If this is a boolean result then it will return 'true' or 'false'. If it is a bindings type, then it will dump as a text based table.

Return Value

string A string representation of the result.