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

Public Member Functions

 __construct (array $header=[], array $data=[], array $comments=[], $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.
 
const ERROR_UNREACHABLE = 1
 Error code: service unreachable; result will be empty.
 
const ERROR_INCOMPLETE = 2
 Error code: results might be incomplete (e.g. due to some resource limit being reached)
 

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

◆ __construct()

SMW\SPARQLStore\QueryEngine\RepositoryResult::__construct ( array  $header = [],
array  $data = [],
array  $comments = [],
  $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

◆ current()

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

◆ getComments()

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

◆ getErrorCode()

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

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

Returns
integer error code

◆ getNumericValue()

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

◆ isBooleanTrue()

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

◆ key()

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

◆ next()

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

◆ numRows()

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

Get the number of rows in the result object.

Returns
integer number of result rows

◆ rewind()

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

Reset iterator to position 0. Standard method of Iterator.

◆ setErrorCode()

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

◆ valid()

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

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

Returns
boolean

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

About | General disclaimer | Privacy policy