Semantic MediaWiki and related extensions
Public Member Functions | Public Attributes | Protected Attributes | List of all members
SMW\SPARQLStore\QueryEngine\RepositoryResult Class Reference
Collaboration diagram for SMW\SPARQLStore\QueryEngine\RepositoryResult:
Collaboration graph
[legend]

Public Member Functions

 __construct (array $header=array(), array $data=array(), array $comments=array(), $errorCode=self::ERROR_NOERROR)
 
 numRows ()
 
 getErrorCode ()
 
 setErrorCode ($errorCode)
 
 getComments ()
 
 isBooleanTrue ()
 
 getNumericValue ()
 
 rewind ()
 
 current ()
 
 next ()
 
 key ()
 
 valid ()
 

Public Attributes

const ERROR_NOERROR = 0
 Error code: no errors occurred. More...
 
const ERROR_UNREACHABLE = 1
 Error code: service unreachable; result will be empty. More...
 
const ERROR_INCOMPLETE = 2
 Error code: results might be incomplete (e.g. due to some resource limit being reached) More...
 

Protected Attributes

 $header
 
 $data
 
 $comments
 
 $errorCode
 

Detailed Description

Class for accessing SPARQL query results in a unified form. The data is structured in tabular form, with each cell containing some SMWExpElement. Rows should always have the same number of columns, but the datatype of the cells in each column may not be uniform throughout the result.

GNU GPL v2+

Since
1.6
Author
Markus Krötzsch

Constructor & Destructor Documentation

SMW\SPARQLStore\QueryEngine\RepositoryResult::__construct ( array  $header = array(),
array  $data = array(),
array  $comments = array(),
  $errorCode = self::ERROR_NOERROR 
)

Initialise a result set from a result string in SPARQL XML format.

Parameters
$headerarray mapping SPARQL variable names to column indices
$dataarray of array of (SMWExpElement or null)
$commentsarray of string comments if the result contained any
$errorCodeinteger an error code

Member Function Documentation

SMW\SPARQLStore\QueryEngine\RepositoryResult::current ( )

Return the current result row. Standard method of Iterator.

Returns
array of (SMWExpElement or null), or false at end of data
SMW\SPARQLStore\QueryEngine\RepositoryResult::getComments ( )

Return a list of comment strings found in the SPARQL result. Comments are used by some RDF stores to provide additional information or warnings that can thus be accessed.

Returns
array of string
SMW\SPARQLStore\QueryEngine\RepositoryResult::getErrorCode ( )

Return error code. SMWSparqlResultWrapper::ERROR_NOERROR (0) indicates that no error occurred.

Returns
integer error code
SMW\SPARQLStore\QueryEngine\RepositoryResult::getNumericValue ( )

Check if the result is what one would get for a SPARQL SELECT COUNT query, and return the corresponding integer value. Returns 0 in all other cases (including the case that the results do not look at all like the result of a SELECT COUNT query).

Returns
integer
SMW\SPARQLStore\QueryEngine\RepositoryResult::isBooleanTrue ( )

Check if the result is what one would get for a SPARQL ASK query that returned true. Returns false in all other cases (including the case that the results do not look at all like the result of an ASK query).

Returns
boolean
SMW\SPARQLStore\QueryEngine\RepositoryResult::key ( )

Return the next result row and advance the internal pointer. Standard method of Iterator.

Returns
array of (SMWExpElement or null), or false at end of data
SMW\SPARQLStore\QueryEngine\RepositoryResult::next ( )

Return the next result row and advance the internal pointer. Standard method of Iterator.

Returns
array of (SMWExpElement or null), or false at end of data
SMW\SPARQLStore\QueryEngine\RepositoryResult::numRows ( )

Get the number of rows in the result object.

Returns
interger number of result rows
SMW\SPARQLStore\QueryEngine\RepositoryResult::rewind ( )

Reset iterator to position 0. Standard method of Iterator.

SMW\SPARQLStore\QueryEngine\RepositoryResult::setErrorCode (   $errorCode)

Set the error code of this result set. This is used for allowing callers to add additional errors discovered only later on. It does not allow removing existing errors, since it will not accept SMWSparqlResultWrapper::ERROR_NOERROR as a parameter.

Parameters
$errorCodeinteger error code
SMW\SPARQLStore\QueryEngine\RepositoryResult::valid ( )

Return true if the internal pointer refers to a valid element. Standard method of Iterator.

Returns
boolean

Member Data Documentation

SMW\SPARQLStore\QueryEngine\RepositoryResult::$comments
protected
SMW\SPARQLStore\QueryEngine\RepositoryResult::$data
protected
SMW\SPARQLStore\QueryEngine\RepositoryResult::$errorCode
protected
SMW\SPARQLStore\QueryEngine\RepositoryResult::$header
protected
const SMW\SPARQLStore\QueryEngine\RepositoryResult::ERROR_INCOMPLETE = 2

Error code: results might be incomplete (e.g. due to some resource limit being reached)

const SMW\SPARQLStore\QueryEngine\RepositoryResult::ERROR_NOERROR = 0

Error code: no errors occurred.

const SMW\SPARQLStore\QueryEngine\RepositoryResult::ERROR_UNREACHABLE = 1

Error code: service unreachable; result will be empty.


The documentation for this class was generated from the following file: