Semantic MediaWiki and related extensions
Public Member Functions | Protected Attributes | List of all members
SMWQueryResult Class Reference

Public Member Functions

 __construct (array $printRequests, SMWQuery $query, array $results, SMWStore $store, $furtherRes=false)
 
 getInMemoryEntityProcessList ()
 
 setFromCache ($isFromCache)
 
 isFromCache ()
 
 getStore ()
 
 getNext ()
 
 getCount ()
 
 getResults ()
 
 reset ()
 
 getQuery ()
 
 getColumnCount ()
 
 getPrintRequests ()
 
 getQueryString ()
 
 hasFurtherResults ()
 
 setCountValue ($countValue)
 
 getCountValue ()
 
 getErrors ()
 
 addErrors (array $errors)
 
 getQueryLink ($caption=false)
 
 getLink ()
 
 serializeToArray ()
 
 toArray ()
 
 getHash ()
 

Protected Attributes

 $mResults
 
 $mPrintRequests
 
 $mFurtherResults
 
 $mQuery
 
 $mStore
 

Detailed Description

Objects of this class encapsulate the result of a query in SMW. They provide access to the query result and printed data, and to some relevant query parameters that were used.

Standard access is provided through the iterator function getNext(), which returns an array ("table row") of SMWResultArray objects ("table cells"). It is also possible to access the set of result pages directly using getResults(). This is useful for printers that disregard printouts and only are interested in the actual list of pages.

GNU GPL v2 or later

Author
Markus Krötzsch
Jeroen De Dauw < jeroe.nosp@m.nded.nosp@m.auw@g.nosp@m.mail.nosp@m..com >

Constructor & Destructor Documentation

SMWQueryResult::__construct ( array  $printRequests,
SMWQuery  $query,
array  $results,
SMWStore  $store,
  $furtherRes = false 
)

Initialise the object with an array of SMWPrintRequest objects, which define the structure of the result "table" (one for each column).

TODO: Update documentation

Parameters
PrintRequest[]$printRequests
SMWQuery$query
SMWDIWikiPage[]$results
SMWStore$store
boolean$furtherRes

Member Function Documentation

SMWQueryResult::addErrors ( array  $errors)

Adds an array of erros.

Parameters
array$errors
SMWQueryResult::getColumnCount ( )

Return the number of columns of result values that each row in this result set contains.

Returns
integer
SMWQueryResult::getCount ( )

Return number of available results.

Returns
integer
SMWQueryResult::getCountValue ( )
Since
2.0
Returns
integer|null
SMWQueryResult::getErrors ( )

Return error array, possibly empty.

Returns
array
SMWQueryResult::getHash ( )

Returns result hash value

Since
1.9
Returns
string
SMWQueryResult::getInMemoryEntityProcessList ( )
Since
2.4
Returns
InMemoryEntityProcessList
SMWQueryResult::getLink ( )
Deprecated:
since 2.5, use QueryResult::getQueryLink

Returns an SMWInfolink object with the QueryResults print requests as parameters.

Since
1.8
Returns
SMWInfolink
SMWQueryResult::getNext ( )

Return the next result row as an array of SMWResultArray objects, and advance the internal pointer.

Returns
SMWResultArray[]|false
SMWQueryResult::getPrintRequests ( )

Return array of print requests (needed for printout since they contain property labels).

Returns
PrintRequest[]
SMWQueryResult::getQuery ( )

Returns the query object of the current result set

Since
1.8
Returns
SMWQuery
SMWQueryResult::getQueryLink (   $caption = false)

Create an SMWInfolink object representing a link to further query results. This link can then be serialised or extended by further params first. The optional $caption can be used to set the caption of the link (though this can also be changed afterwards with SMWInfolink::setCaption()). If empty, the message 'smw_iq_moreresults' is used as a caption.

Deprecated:
since SMW 1.8
Parameters
string | false$caption
Returns
SMWInfolink
SMWQueryResult::getQueryString ( )

Returns the query string defining the conditions for the entities to be returned.

Returns
string
SMWQueryResult::getResults ( )

Return an array of SMWDIWikiPage objects that make up the results stored in this object.

Returns
SMWDIWikiPage[]
SMWQueryResult::getStore ( )

Get the SMWStore object that this result is based on.

Returns
SMWStore
SMWQueryResult::hasFurtherResults ( )

Would there be more query results that were not shown due to a limit?

Returns
boolean
SMWQueryResult::isFromCache ( )
Since
2.4
Returns
boolean
SMWQueryResult::reset ( )
Since
2.3
SMWQueryResult::serializeToArray ( )
See also
DISerializer::getSerializedQueryResult
Since
1.7
Returns
array
SMWQueryResult::setCountValue (   $countValue)
Since
2.0
Parameters
integer$countValue
SMWQueryResult::setFromCache (   $isFromCache)
Since
2.4
Parameters
boolean$isFromCache
SMWQueryResult::toArray ( )

Returns a serialized SMWQueryResult object with additional meta data

This methods extends the serializeToArray() for additional meta that are useful when handling data via the api

Note
should be used instead of SMWQueryResult::serializeToArray() as this method contains additional informaion
Since
1.9
Returns
array

Member Data Documentation

SMWQueryResult::$mFurtherResults
protected
SMWQueryResult::$mPrintRequests
protected
SMWQueryResult::$mQuery
protected
SMWQueryResult::$mResults
protected
SMWQueryResult::$mStore
protected

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