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

Public Member Functions

 __construct (array $printRequests, Query $query, array $results, Store $store, $furtherRes=false)
 
 getFieldItemFinder ()
 
 setItemJournal (ItemJournal $itemJournal)
 
 getItemJournal ()
 
 setFromCache ( $isFromCache)
 
 setScoreSet (ScoreSet $scoreSet)
 
 getScoreSet ()
 
 setExcerpts (Excerpts $excerpts)
 
 getExcerpts ()
 
 isFromCache ()
 
 getStore ()
 
 getNext ()
 
 getCount ()
 
 getResults ()
 
 reset ()
 
 getQuery ()
 
 getColumnCount ()
 
 getPrintRequests ()
 
 getQueryString ()
 
 hasFurtherResults ()
 
 setCountValue ( $countValue)
 
 getCountValue ()
 
 getErrors ()
 
 addErrors (array $errors)
 
 getQueryLink ( $caption=false)
 
 getLink ()
 
 setSerializerVersion ( $version)
 
 serializeToArray ()
 
 toArray ()
 
 getHash ( $type=null)
 

Public Attributes

const QUICK_HASH = 'quick'
 

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 ResultArray 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+

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

Constructor & Destructor Documentation

◆ __construct()

SMW\Query\QueryResult::__construct ( array  $printRequests,
Query  $query,
array  $results,
Store  $store,
  $furtherRes = false 
)
Parameters
PrintRequest[]$printRequests
Query$query
SMWDIWikiPage[]$results
Store$store
boolean$furtherRes

Member Function Documentation

◆ addErrors()

SMW\Query\QueryResult::addErrors ( array  $errors)

Adds an array of erros.

Parameters
array$errors

◆ getColumnCount()

SMW\Query\QueryResult::getColumnCount ( )

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

Returns
integer

◆ getCount()

SMW\Query\QueryResult::getCount ( )

Return number of available results.

Returns
integer

◆ getCountValue()

SMW\Query\QueryResult::getCountValue ( )
Since
2.0
Returns
integer|null

◆ getErrors()

SMW\Query\QueryResult::getErrors ( )

Return error array, possibly empty.

Returns
array

◆ getExcerpts()

SMW\Query\QueryResult::getExcerpts ( )
Since
3.0
Returns
Excerpts|null

◆ getFieldItemFinder()

SMW\Query\QueryResult::getFieldItemFinder ( )
Since
3.1
Returns
FieldItemFinder

◆ getHash()

SMW\Query\QueryResult::getHash (   $type = null)

Returns result hash value

Since
1.9
Returns
string

◆ getItemJournal()

SMW\Query\QueryResult::getItemJournal ( )
Since
2.4
Returns
ItemJournal

◆ getLink()

SMW\Query\QueryResult::getLink ( )
Deprecated:
since 2.5, use QueryResult::getQueryLink

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

Since
1.8
Returns
SMWInfolink

◆ getNext()

SMW\Query\QueryResult::getNext ( )

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

Returns
ResultArray[]|false

◆ getPrintRequests()

SMW\Query\QueryResult::getPrintRequests ( )

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

Returns
PrintRequest[]

◆ getQuery()

SMW\Query\QueryResult::getQuery ( )

Returns the query object of the current result set

Since
1.8
Returns
Query

◆ getQueryLink()

SMW\Query\QueryResult::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.

Parameters
string | false$caption
Returns
SMWInfolink

◆ getQueryString()

SMW\Query\QueryResult::getQueryString ( )

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

Returns
string

◆ getResults()

SMW\Query\QueryResult::getResults ( )

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

Returns
SMWDIWikiPage[]

◆ getScoreSet()

SMW\Query\QueryResult::getScoreSet ( )
Since
3.0
Returns
ScoreSet|null

◆ getStore()

SMW\Query\QueryResult::getStore ( )

Get the Store object that this result is based on.

Returns
Store

◆ hasFurtherResults()

SMW\Query\QueryResult::hasFurtherResults ( )

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

Returns
boolean

◆ isFromCache()

SMW\Query\QueryResult::isFromCache ( )
Since
2.4
Returns
boolean

◆ reset()

SMW\Query\QueryResult::reset ( )
Since
2.3

◆ serializeToArray()

SMW\Query\QueryResult::serializeToArray ( )
See also
DISerializer::getSerializedQueryResult
Since
1.7
Returns
array

◆ setCountValue()

SMW\Query\QueryResult::setCountValue (   $countValue)
Since
2.0
Parameters
integer$countValue

◆ setExcerpts()

SMW\Query\QueryResult::setExcerpts ( Excerpts  $excerpts)

Only available by some stores that support the retrieval of excerpts.

Since
3.0
Parameters
Excerpts$excerpts

◆ setFromCache()

SMW\Query\QueryResult::setFromCache (   $isFromCache)
Since
2.4
Parameters
boolean$isFromCache

◆ setItemJournal()

SMW\Query\QueryResult::setItemJournal ( ItemJournal  $itemJournal)
Since
3.0
Parameters
ItemJournal$itemJournal

◆ setScoreSet()

SMW\Query\QueryResult::setScoreSet ( ScoreSet  $scoreSet)

Only available by some stores that support the computation of scores.

Since
3.0
Parameters
ScoreSet$scoreSet

◆ setSerializerVersion()

SMW\Query\QueryResult::setSerializerVersion (   $version)
Since
3.0

◆ toArray()

SMW\Query\QueryResult::toArray ( )

Returns a serialized QueryResult 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 QueryResult::serializeToArray() as this method contains additional informaion
Since
1.9
Returns
array

Member Data Documentation

◆ QUICK_HASH

const SMW\Query\QueryResult::QUICK_HASH = 'quick'

When generating a hash just iterates over available subjects, not the entire object structure.


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

About | General disclaimer | Privacy policy