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

Public Member Functions

 __construct (Description $description=null, $context=false)
 
 isEmbedded ()
 
 setQueryMode ( $queryMode)
 
 getQueryMode ()
 
 setContextPage (DIWikiPage $contextPage=null)
 
 getContextPage ()
 
 setQuerySource ( $querySource)
 
 getQuerySource ()
 
 setQueryToken (QueryToken $queryToken=null)
 
 getQueryToken ()
 
 setMainLabel ( $mainlabel)
 
 getMainLabel ()
 
 setDescription (SMWDescription $description)
 
 getDescription ()
 
 setExtraPrintouts ( $extraprintouts)
 
 getExtraPrintouts ()
 
 clearErrors ()
 
 getErrors ()
 
 addErrors ( $errors)
 
 setQueryString ( $querystring)
 
 setOption ( $key, $value)
 
 getOption ( $key)
 
 getQueryString ( $fresh=false)
 
 getOffset ()
 
 setOffset ( $offset)
 
 setUnboundOffset ( $offset)
 
 getLimit ()
 
 setLimit ( $limit, $restrictinline=true)
 
 setUnboundLimit ( $limit)
 
 setSortKeys (array $sortKeys)
 
 getSortKeys ()
 
 applyRestrictions ()
 
 toArray ()
 
 getHash ()
 
 toString ()
 
 getQueryId ()
 

Public Attributes

const ID_PREFIX = '_QUERY'
 
const PROC_QUERY_TIME = 'proc.query.time'
 
const PROC_PRINT_TIME = 'proc.print.time'
 
const PROC_CONTEXT = 'proc.context'
 
const PROC_STATUS_CODE = 'proc.status.code'
 
const OPT_PARAMETERS = 'proc.parameters'
 
const NO_CACHE = 'no.cache'
 
const NO_DEPENDENCY_TRACE = 'no.dependency.trace'
 
const SCORE_SORT = 'score.sort'
 
 $sort = false
 
 $sortkeys = []
 
 $querymode = self::MODE_INSTANCES
 
- Public Attributes inherited from SMW\Query\QueryContext
const SPECIAL_PAGE = 1000
 
const INLINE_QUERY = 1001
 
const DEFERRED_QUERY = 1002
 
const CONCEPT_DESC = 1003
 
const CURTAILMENT_MODE = 1004
 
const MODE_INSTANCES = 1
 
const MODE_COUNT = 2
 
const MODE_DEBUG = 3
 
const MODE_NONE = 4
 

Detailed Description

Representation of queries in SMW, each consisting of a query description and various parameters. Some settings might also lead to changes in the query description.

Most additional query parameters (limit, sort, ascending, ...) are interpreted as in SMWRequestOptions (though the latter contains some additional settings).

Constructor & Destructor Documentation

◆ __construct()

SMWQuery::__construct ( Description  $description = null,
  $context = false 
)
Since
1.6
Parameters
Description$description
integer | boolean$context

Member Function Documentation

◆ applyRestrictions()

SMWQuery::applyRestrictions ( )

Apply structural restrictions to the current description.

◆ clearErrors()

SMWQuery::clearErrors ( )
Since
3.0

◆ getContextPage()

SMWQuery::getContextPage ( )
Since
2.3
Returns
DIWikiPage|null

◆ getExtraPrintouts()

SMWQuery::getExtraPrintouts ( )
Returns
PrintRequest[]

◆ getHash()

SMWQuery::getHash ( )
Note
Before 2.5, toArray was used to generate the content, as of 2.5 only parameters that influence the result of an query is included.
Since
2.1
Returns
string

◆ getMainLabel()

SMWQuery::getMainLabel ( )

Gets the mainlabel.

Since
1.6.
Returns
string

◆ getOption()

SMWQuery::getOption (   $key)
Since
2.5
Parameters
string | integer$key
Returns
mixed

◆ getQueryId()

SMWQuery::getQueryId ( )
Since
2.3
Returns
string

◆ getQueryMode()

SMWQuery::getQueryMode ( )
Since
2.5
Parameters
integer

◆ getQuerySource()

SMWQuery::getQuerySource ( )
Since
2.4
Returns
string

◆ getQueryString()

SMWQuery::getQueryString (   $fresh = false)
Since
1.7
Parameters
boolean$fresh
Returns
string

◆ getQueryToken()

SMWQuery::getQueryToken ( )
Since
2.5
Returns
QueryToken|null

◆ getSortKeys()

SMWQuery::getSortKeys ( )
Since
2.2
Returns
array

◆ isEmbedded()

SMWQuery::isEmbedded ( )
Since
3.0
Parameters
boolean

◆ setContextPage()

SMWQuery::setContextPage ( DIWikiPage  $contextPage = null)
Since
2.3
Parameters
DIWikiPage | null$contextPage

◆ setLimit()

SMWQuery::setLimit (   $limit,
  $restrictinline = true 
)

Set a limit for number of query results. The set limit might be restricted by the current offset so as to ensure that the number of the last considered result does not exceed the maximum amount of supported results. The function returns the chosen limit.

Note
It makes sense to have limit==0, e.g. to only show a link to the search special

◆ setMainLabel()

SMWQuery::setMainLabel (   $mainlabel)

Sets the mainlabel.

Since
1.6.
Parameters
string$mainlabel

◆ setOffset()

SMWQuery::setOffset (   $offset)

Set an offset for the returned query results. No offset beyond the maximal query limit will be set, and the current query limit might be reduced in order to ensure that no results beyond the maximal limit are returned. The function returns the chosen offset.

Todo:
The function should be extended to take into account whether or not we are in inline mode (not critical, since offsets are usually not applicable inline).

◆ setOption()

SMWQuery::setOption (   $key,
  $value 
)
Since
2.5
Parameters
string | integer$key
mixed$value

◆ setQueryMode()

SMWQuery::setQueryMode (   $queryMode)
Since
2.5
Parameters
integer

◆ setQuerySource()

SMWQuery::setQuerySource (   $querySource)
Since
2.4
Parameters
string

◆ setQueryToken()

SMWQuery::setQueryToken ( QueryToken  $queryToken = null)
Since
2.5
Parameters
QueryToken | null$queryToken

◆ setSortKeys()

SMWQuery::setSortKeys ( array  $sortKeys)
Note
format: "Property key" => "ASC" / "DESC" (note: order of entries also matters)
Since
2.2
Parameters
array$sortKeys

◆ setUnboundLimit()

SMWQuery::setUnboundLimit (   $limit)
Note
Sets an unbound limit that is independent from GLOBAL settings
Since
2.0
Parameters
integer$limit

◆ setUnboundOffset()

SMWQuery::setUnboundOffset (   $offset)
Note
Sets an unbound offset that is independent from GLOBAL settings
Since
3.0
Parameters
integer$offset

◆ toArray()

SMWQuery::toArray ( )

Returns serialized query details

The output is following the askargs api module convention

conditions The query conditions (requirements for a subject to be included) printouts The query printouts (which properties to show per subject) parameters The query parameters (non-condition and non-printout arguments)

Since
1.9
Returns
array

◆ toString()

SMWQuery::toString ( )
Since
2.5
Returns
string

Member Data Documentation

◆ NO_CACHE

const SMWQuery::NO_CACHE = 'no.cache'

Suppress a possible cache request

◆ NO_DEPENDENCY_TRACE

const SMWQuery::NO_DEPENDENCY_TRACE = 'no.dependency.trace'

Indicates no dependency trace

◆ OPT_PARAMETERS

const SMWQuery::OPT_PARAMETERS = 'proc.parameters'

The processing parameters

◆ PROC_CONTEXT

const SMWQuery::PROC_CONTEXT = 'proc.context'

The processing context in which the query is being executed

◆ PROC_PRINT_TIME

const SMWQuery::PROC_PRINT_TIME = 'proc.print.time'

The time a ResultPrinter required to build the final result including all PrintRequests

◆ PROC_QUERY_TIME

const SMWQuery::PROC_QUERY_TIME = 'proc.query.time'

The time the QueryEngine required to answer a query condition

◆ PROC_STATUS_CODE

const SMWQuery::PROC_STATUS_CODE = 'proc.status.code'

Status code information

◆ SCORE_SORT

const SMWQuery::SCORE_SORT = 'score.sort'

Sort by score if the query engine supports it.


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

About | General disclaimer | Privacy policy