Result
class 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
Create a new SPARQL Result object
Get the query result type (boolean/bindings)
Return the boolean value of the query result
Return true if the result of the query was true.
Return false if the result of the query was false.
Return the number of fields in a query result of type bindings.
Return the number of rows in a query result of type bindings.
Get the field names in a query result of type bindings.
Return a human readable view of the query result.
Create a new EasyRdf\Resource or EasyRdf\Literal depending on the type of data passed in.
XML Result Parser: this function is called when an XML element starts
XML Result Parser: this function is called when text is encountered
XML Result Parser: this function is called when an XML element ends
Parse a SPARQL result in the XML format into the object.
Parse a SPARQL result in the JSON format into the object.
Magic method to return value of the result to string
Details
at line 78
__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 EasyRdf\Sparql_Client.
at line 98
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'.
at line 111
bool
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.
at line 120
bool
isTrue()
Return true if the result of the query was true.
at line 129
bool
isFalse()
Return false if the result of the query was false.
at line 138
int
numFields()
Return the number of fields in a query result of type bindings.
at line 147
int
numRows()
Return the number of rows in a query result of type bindings.
at line 156
array
getFields()
Get the field names in a query result of type bindings.
at line 171
string
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.
at line 261
protected
newTerm($data)
Create a new EasyRdf\Resource or EasyRdf\Literal depending on the type of data passed in.
at line 283
startElementHandler($parser)
XML Result Parser: this function is called when an XML element starts
at line 335
textHandler($parser)
XML Result Parser: this function is called when text is encountered
at line 344
endElementHandler($parser)
XML Result Parser: this function is called when an XML element ends
at line 369
protected
parseXml($data)
Parse a SPARQL result in the XML format into the object.
at line 390
protected
parseJson($data)
Parse a SPARQL result in the JSON format into the object.
at line 425
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.