phpcr/src/PHPCR/Query/QOM/QueryObjectModelInterface.php
Copyright 2008-2011 Karsten Dambekalns karsten@typo3.org
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
\PHPCR\Query\QOM\QueryObjectModelInterface
The JCR query object model describes the queries that can be evaluated by a JCR repository independent of any particular query language, such as SQL.
A query consists of:
- a source. When the query is evaluated, the source evaluates its selectors and the joins between them to produce a (possibly empty) set of node-tuples. This is a set of 1-tuples if the query has one selector (and therefore no joins), a set of 2-tuples if the query has two selectors (and therefore one join), a set of 3-tuples if the query has three selectors (two joins), and so forth.
- an optional constraint. When the query is evaluated, the constraint filters the set of node-tuples.
- a list of zero or more orderings. The orderings specify the order in which the node-tuples appear in the query results. The relative order of two node-tuples is determined by evaluating the specified orderings, in list order, untilencountering an ordering for which one node-tuple precedes the other. If no orderings are specified, or if for none of the specified orderings does one node-tuple precede the other, then the relative order of the node-tuples is implementation determined (and may be arbitrary).
- a list of zero or more columns to include in the tabular view of the query results. If no columns are specified, the columns available in the tabular view are implementation determined, but minimally include, for each selector, a column for each single-valued non-residual property of the selector's node type.
The query object model representation of a query is created by factory methods in the QueryObjectModelFactory.
- Parent(s)
- \PHPCR\Query\QueryInterface
- Api
Constants
JCR_JQOM
= 'JCR-JQOM'
- Api
- Inherited_from
- \PHPCR\Query\QueryInterface::JCR_JQOM
JCR_SQL2
= 'JCR-SQL2'
- Api
- Inherited_from
- \PHPCR\Query\QueryInterface::JCR_SQL2
XPATH
= 'xpath'
- Api
- Inherited_from
- \PHPCR\Query\QueryInterface::XPATH
SQL
= 'sql'
- Api
- Inherited_from
- \PHPCR\Query\QueryInterface::SQL
Methods
bindValue(string $varName, mixed $value) : void
Binds the given value to the variable named $varName.
Inherited from: \PHPCR\Query\QueryInterface::bindValue()Name | Type | Description |
---|---|---|
$varName | string | name of variable in query |
$value | mixed | value to bind |
Exception | Description |
---|---|
\InvalidArgumentException | if $varName is not a valid variable in this query. |
\PHPCR\RepositoryException | if an error occurs. |
- Api
execute() : \PHPCR\Query\QueryResultInterface
Executes this query and returns a QueryResult object.
Inherited from: \PHPCR\Query\QueryInterface::execute()Type | Description |
---|---|
\PHPCR\Query\QueryResultInterface | a QueryResult object |
Exception | Description |
---|---|
\PHPCR\Query\InvalidQueryException | if the query contains an unbound variable. |
\PHPCR\RepositoryException | if an error occurs |
- Api
getBindVariableNames() : array
Returns the names of the bind variables in this query.
Inherited from: \PHPCR\Query\QueryInterface::getBindVariableNames()If this query does not contains any bind variables then an empty array is returned.
Type | Description |
---|---|
array | the names of the bind variables in this query. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Api
getColumns() : array
Gets the columns for this query.
Type | Description |
---|---|
array | a list of zero or more ColumnInterface; non-null |
- Api
getConstraint() : \PHPCR\Query\QOM\ConstraintInterface
Gets the constraint for this query.
Type | Description |
---|---|
\PHPCR\Query\QOM\ConstraintInterface | the constraint, or null if none |
- Api
getLanguage() : string
Returns the language set for this query.
Inherited from: \PHPCR\Query\QueryInterface::getLanguage()This will be one of the query language constants returned by QueryManagerInterface::getSupportedQueryLanguages().
Type | Description |
---|---|
string | The query language. |
- Api
getOrderings() : array
Gets the orderings for this query.
Type | Description |
---|---|
array | a list of zero or more OrderingInterface; non-null |
- Api
getSource() : \PHPCR\Query\QOM\SourceInterface
Gets the node-tuple source for this query.
Type | Description |
---|---|
\PHPCR\Query\QOM\SourceInterface | the node-tuple source; non-null |
- Api
getStatement() : string
Returns the statement defined for this query.
Inherited from: \PHPCR\Query\QueryInterface::getStatement()If the language of this query is string-based (like JCR-SQL2), this method will return the statement that was used to create this query.
If the language of this query is JCR-JQOM, this method will return the JCR-SQL2 equivalent of the JCR-JQOM object tree.
This is the standard serialization of JCR-JQOM and is also the string stored in the jcr:statement property if the query is persisted. See storeAsNode($absPath).
Type | Description |
---|---|
string | The query statement. |
- Api
getStoredQueryPath() : string
Fetches the path of the node representing this query.
Inherited from: \PHPCR\Query\QueryInterface::getStoredQueryPath()If this is a Query object that has been stored using QueryInterface::storeAsNode() (regardless of whether it has been saved yet) or retrieved using QueryManagerInterface::getQuery()), then this method returns the path of the nt:query node that stores the query.
Type | Description |
---|---|
string | Path of the node representing this query. |
Exception | Description |
---|---|
\PHPCR\ItemNotFoundException | if this query is not a stored query. |
\PHPCR\RepositoryException | if another error occurs. |
- Api
setLimit(integer $limit) : void
Sets the maximum size of the result set to limit.
Inherited from: \PHPCR\Query\QueryInterface::setLimit()Name | Type | Description |
---|---|---|
$limit | integer | The amount of result items to be fetched. |
- Api
setOffset(integer $offset) : void
Sets the start offset of the result set to offset.
Inherited from: \PHPCR\Query\QueryInterface::setOffset()Name | Type | Description |
---|---|---|
$offset | integer | The start point of the result set from when the item shall be fetched. |
- Api
storeAsNode(string $absPath) : \PHPCR\NodeInterface
Creates a node of type nt:query holding this query at $absPath and returns that node.
Inherited from: \PHPCR\Query\QueryInterface::storeAsNode()This is a session-write method and therefore requires a SessionInterface::save() to dispatch the change.
The $absPath provided must not have an index on its final element. If ordering is supported by the node type of the parent node then the new node is appended to the end of the child node list.
Name | Type | Description |
---|---|---|
$absPath | string | absolute path the query should be stored at |
Type | Description |
---|---|
\PHPCR\NodeInterface | the newly created node. |
Exception | Description |
---|---|
\PHPCR\ItemExistsException | if an item at the specified path already exists, same-name siblings are not allowed and this implementation performs this validation immediately. |
\PHPCR\PathNotFoundException | if the specified path implies intermediary Nodes that do not exist or the last element of relPath has an index, and this implementation performs this validation immediately. |
\PHPCR\NodeType\ConstraintViolationException | if a node type or implementation-specific constraint is violated or if an attempt is made to add a node as the child of a property and this implementation performs this validation immediately. |
\PHPCR\Version\VersionException | if the node to which the new child is being added is read-only due to a checked-in node and this implementation performs this validation immediately. |
\PHPCR\Lock\LockException | if a lock prevents the addition of the node and this implementation performs this validation immediately instead of waiting until save. |
\PHPCR\UnsupportedRepositoryOperationException | in a level 1 implementation. |
\PHPCR\RepositoryException | if another error occurs or if the absPath provided has an index on its final element. |
- Api