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

Static Public Member Functions

static setRecursiveTextProcessor (RecursiveTextProcessor $recursiveTextProcessor=null)
 
static getProcessedParams (array $params, array $printRequests=[], $unknownInvalid=true, $context=null, $showMode=false)
 
static createQuery ( $queryString, array $params, $context=self::INLINE_QUERY, $format='', array $extraPrintouts=[], $contextPage=null)
 
static addThisPrintout (array &$printRequests, array $rawParams)
 
static getQueryAndParamsFromFunctionParams (array $rawParams, $outputMode, $context, $showMode, $contextPage=null)
 
static getResultFromQuery (SMWQuery $query, array $params, $outputMode, $context)
 
static getParameters ( $context=null, $resultPrinter=null)
 
static getFormatParameters ( $format)
 

Additional Inherited Members

- 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

Static class for accessing functions to generate and execute semantic queries and to serialise their results.

Member Function Documentation

◆ addThisPrintout()

static SMWQueryProcessor::addThisPrintout ( array &  $printRequests,
array  $rawParams 
)
static

Add the subject print request, unless mainlabel is set to "-".

Since
1.7
Parameters
array$printRequests
array$rawParams

◆ createQuery()

static SMWQueryProcessor::createQuery (   $queryString,
array  $params,
  $context = self::INLINE_QUERY,
  $format = '',
array  $extraPrintouts = [],
  $contextPage = null 
)
static

Parse a query string given in SMW's query language to create an SMWQuery. Parameters are given as key-value-pairs in the given array. The parameter $context defines in what context the query is used, which affects ceretain general settings. An object of type SMWQuery is returned.

The format string is used to specify the output format if already known. Otherwise it will be determined from the parameters when needed. This parameter is just for optimisation in a common case.

Parameters
string$queryString
array$paramsThese need to be the result of a list fed to getProcessedParams
$context
string$format
array$extraPrintouts
Returns
SMWQuery

◆ getFormatParameters()

static SMWQueryProcessor::getFormatParameters (   $format)
static

Returns the definitions of all parameters supported by the specified format.

Since
1.8
Parameters
string$format
Returns
ParamDefinition[]

◆ getParameters()

static SMWQueryProcessor::getParameters (   $context = null,
  $resultPrinter = null 
)
static

Produces a list of default allowed parameters for a result printer. Most query printers should override this function.

Since
1.6.2, return element type changed in 1.8
Parameters
integer | null$context
ResultPrinter | null$resultPrinter
Returns
ParamDefinition[]

◆ getProcessedParams()

static SMWQueryProcessor::getProcessedParams ( array  $params,
array  $printRequests = [],
  $unknownInvalid = true,
  $context = null,
  $showMode = false 
)
static

Takes an array of unprocessed parameters, processes them using Validator, and returns them.

Both input and output arrays are param name (string) => param value (mixed)

Since
1.6.2 The return value changed in SMW 3.1 from Param[] to ProcessedParam[]
Parameters
array$params
PrintRequest[]$printRequests
boolean$unknownInvalid
Returns
ProcessedParam[]

◆ getQueryAndParamsFromFunctionParams()

static SMWQueryProcessor::getQueryAndParamsFromFunctionParams ( array  $rawParams,
  $outputMode,
  $context,
  $showMode,
  $contextPage = null 
)
static

Process and answer a query as given by an array of parameters as is typically produced by the #ask parser function. The parameter $context defines in what context the query is used, which affects certain general settings.

The main task of this function is to preprocess the raw parameters to obtain actual parameters, printout requests, and the query string for further processing.

Since
1.8
Parameters
array$rawParamsuser-provided list of unparsed parameters
integer$outputModeSMW_OUTPUT_WIKI, SMW_OUTPUT_HTML, ...
integer$contextINLINE_QUERY, SPECIAL_PAGE, CONCEPT_DESC
boolean$showModeprocess like #show parser function?
Returns
array( SMWQuery, ProcessedParam[] )

◆ getResultFromQuery()

static SMWQueryProcessor::getResultFromQuery ( SMWQuery  $query,
array  $params,
  $outputMode,
  $context 
)
static

Create a fully formatted result string from a query and its parameters. The method takes care of processing various types of query result. Most cases are handled by printers, but counting and debugging uses special code.

Parameters
SMWQuery$query
array$paramsThese need to be the result of a list fed to getProcessedParams
integer$outputMode
integer$context
Since
before 1.7, but public only since 1.8
Returns
string

◆ setRecursiveTextProcessor()

static SMWQueryProcessor::setRecursiveTextProcessor ( RecursiveTextProcessor  $recursiveTextProcessor = null)
static
Since
3.0
Parameters
RecursiveTextProcessor | null$recursiveTextProcessor

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

About | General disclaimer | Privacy policy