SMWQuery Class Reference
[SMWQuery]

Representation of queries in SMW, each consisting of a query description and various parameters. More...

List of all members.

Public Member Functions

 __construct ($description=null, $inline=false, $concept=false)
 Constructor.
 setMainLabel ($mainlabel)
 Sets the mainlabel.
 getMainLabel ()
 Gets the mainlabel.
 setDescription (SMWDescription $description)
 getDescription ()
 setExtraPrintouts ($extraprintouts)
 getExtraPrintouts ()
 getErrors ()
 addErrors ($errors)
 setQueryString ($querystring)
 getQueryString ()
 getOffset ()
 setOffset ($offset)
 Set an offset for the returned query results.
 getLimit ()
 setLimit ($limit, $restrictinline=true)
 Set a limit for number of query results.
 applyRestrictions ()
 Apply structural restrictions to the current description.

Public Attributes

const MODE_INSTANCES = 1
const MODE_COUNT = 2
const MODE_DEBUG = 3
const MODE_NONE = 4
 $sort = false
 $sortkeys = array()
 $querymode = SMWQuery::MODE_INSTANCES

Protected Attributes

 $m_limit
 $m_offset = 0
 $m_description
 $m_errors = array()
 $m_querystring = false
 $m_inline
 $m_concept
 $m_extraprintouts = array()
 $m_mainlabel = ''


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).

Definition at line 28 of file SMW_Query.php.


Constructor & Destructor Documentation

SMWQuery::__construct ( description = null,
inline = false,
concept = false 
)

Constructor.

Parameters:
$description Optional SMWDescription object describing the query conditions
$inline bool stating whether this query runs in an inline context; used to determine proper default parameters (e.g. the default limit)
$concept bool stating whether this query belongs to a concept; used to determine proper default parameters (concepts usually have less restrictions)

Definition at line 57 of file SMW_Query.php.

References $smwgQMaxInlineLimit, $smwgQMaxLimit, and applyRestrictions().


Member Function Documentation

SMWQuery::setMainLabel ( mainlabel  ) 

Sets the mainlabel.

Since:
1.6.
Parameters:
string $mainlabel

Definition at line 73 of file SMW_Query.php.

SMWQuery::getMainLabel (  ) 

Gets the mainlabel.

Since:
1.6.
Returns:
string

Definition at line 84 of file SMW_Query.php.

SMWQuery::setDescription ( SMWDescription description  ) 

Definition at line 88 of file SMW_Query.php.

References SMWDescription::addPrintRequest(), and applyRestrictions().

SMWQuery::getDescription (  ) 

Definition at line 96 of file SMW_Query.php.

Referenced by SMWSQLStore2QueryEngine::getInstanceQueryResult().

SMWQuery::setExtraPrintouts ( extraprintouts  ) 

Definition at line 100 of file SMW_Query.php.

SMWQuery::getExtraPrintouts (  ) 

Definition at line 110 of file SMW_Query.php.

SMWQuery::getErrors (  ) 

Definition at line 114 of file SMW_Query.php.

SMWQuery::addErrors ( errors  ) 

Definition at line 118 of file SMW_Query.php.

Referenced by SMWSQLStore2QueryEngine::getQueryResult().

SMWQuery::setQueryString ( querystring  ) 

Definition at line 122 of file SMW_Query.php.

SMWQuery::getQueryString (  ) 

Definition at line 126 of file SMW_Query.php.

SMWQuery::getOffset (  ) 

Definition at line 136 of file SMW_Query.php.

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).

Definition at line 148 of file SMW_Query.php.

References $smwgQMaxLimit.

SMWQuery::getLimit (  ) 

Definition at line 155 of file SMW_Query.php.

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

Definition at line 166 of file SMW_Query.php.

References $smwgQMaxInlineLimit, and $smwgQMaxLimit.

SMWQuery::applyRestrictions (  ) 

Apply structural restrictions to the current description.

Definition at line 176 of file SMW_Query.php.

References $smwgQConceptMaxDepth, $smwgQConceptMaxSize, $smwgQMaxDepth, and $smwgQMaxSize.

Referenced by __construct(), and setDescription().


Member Data Documentation

SMWQuery::$sort = false

Definition at line 35 of file SMW_Query.php.

SMWQuery::$sortkeys = array()

Definition at line 36 of file SMW_Query.php.

SMWQuery::$querymode = SMWQuery::MODE_INSTANCES

Definition at line 37 of file SMW_Query.php.

SMWQuery::$m_limit [protected]

Definition at line 39 of file SMW_Query.php.

SMWQuery::$m_offset = 0 [protected]

Definition at line 40 of file SMW_Query.php.

SMWQuery::$m_description [protected]

Definition at line 41 of file SMW_Query.php.

SMWQuery::$m_errors = array() [protected]

Definition at line 42 of file SMW_Query.php.

SMWQuery::$m_querystring = false [protected]

Definition at line 43 of file SMW_Query.php.

SMWQuery::$m_inline [protected]

Definition at line 44 of file SMW_Query.php.

SMWQuery::$m_concept [protected]

Definition at line 45 of file SMW_Query.php.

SMWQuery::$m_extraprintouts = array() [protected]

Definition at line 46 of file SMW_Query.php.

SMWQuery::$m_mainlabel = '' [protected]

Definition at line 47 of file SMW_Query.php.


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

Generated on Sun Mar 18 07:15:43 2012 for Semantic MediaWiki by  doxygen 1.5.6