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

Public Member Functions

 __construct (array $printRequests, SMWQuery $query, array $results, SMWStore $store, $furtherRes=false)
 
 setResolverJournal (ResolverJournal $ResolverJournal)
 
 getResolverJournal ()
 
 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)
 

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

◆ __construct()

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

◆ addErrors()

SMWQueryResult::addErrors ( array  $errors)

Adds an array of erros.

Parameters
array$errors

◆ getColumnCount()

SMWQueryResult::getColumnCount ( )

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

Returns
integer

◆ getCount()

SMWQueryResult::getCount ( )

Return number of available results.

Returns
integer

◆ getCountValue()

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

◆ getErrors()

SMWQueryResult::getErrors ( )

Return error array, possibly empty.

Returns
array

◆ getExcerpts()

SMWQueryResult::getExcerpts ( )
Since
3.0
Returns
Excerpts|null

◆ getHash()

SMWQueryResult::getHash (   $type = null)

Returns result hash value

Since
1.9
Returns
string

◆ getLink()

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

◆ getNext()

SMWQueryResult::getNext ( )

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

Returns
SMWResultArray[]|false

◆ getPrintRequests()

SMWQueryResult::getPrintRequests ( )

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

Returns
PrintRequest[]

◆ getQuery()

SMWQueryResult::getQuery ( )

Returns the query object of the current result set

Since
1.8
Returns
SMWQuery

◆ getQueryLink()

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.

Parameters
string | false$caption
Returns
SMWInfolink

◆ getQueryString()

SMWQueryResult::getQueryString ( )

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

Returns
string

◆ getResolverJournal()

SMWQueryResult::getResolverJournal ( )
Since
2.4
Returns
ResolverJournal

◆ getResults()

SMWQueryResult::getResults ( )

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

Returns
SMWDIWikiPage[]

◆ getScoreSet()

SMWQueryResult::getScoreSet ( )
Since
3.0
Returns
ScoreSet|null

◆ getStore()

SMWQueryResult::getStore ( )

Get the SMWStore object that this result is based on.

Returns
SMWStore

◆ hasFurtherResults()

SMWQueryResult::hasFurtherResults ( )

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

Returns
boolean

◆ isFromCache()

SMWQueryResult::isFromCache ( )
Since
2.4
Returns
boolean

◆ reset()

SMWQueryResult::reset ( )
Since
2.3

◆ serializeToArray()

SMWQueryResult::serializeToArray ( )
See also
DISerializer::getSerializedQueryResult
Since
1.7
Returns
array

◆ setCountValue()

SMWQueryResult::setCountValue (   $countValue)
Since
2.0
Parameters
integer$countValue

◆ setExcerpts()

SMWQueryResult::setExcerpts ( Excerpts  $excerpts)

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

Since
3.0
Parameters
Excerpts$excerpts

◆ setFromCache()

SMWQueryResult::setFromCache (   $isFromCache)
Since
2.4
Parameters
boolean$isFromCache

◆ setResolverJournal()

SMWQueryResult::setResolverJournal ( ResolverJournal  $ResolverJournal)
Since
3.0
Parameters
ResolverJournal$resolverJournal

◆ setScoreSet()

SMWQueryResult::setScoreSet ( ScoreSet  $scoreSet)

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

Since
3.0
Parameters
ScoreSet$scoreSet

◆ setSerializerVersion()

SMWQueryResult::setSerializerVersion (   $version)
Since
3.0

◆ toArray()

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

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

About | General disclaimer | Privacy policy