The column specifier of a query is the part of the statement that specifies which properties are to be returned as columns in the result table. Support is only required for single-value, non-residual properties that are declared in or inherited by the node types specified in the type constraint. It is optional to allow specification of residual properties as columns.
If no column specifier is given, then at least the default set of columns will be returned. The default set is defined as all single-value, non-residual properties declared in or inherited by the node types specified in the type constraint. It is optional to return columns for residual properties.
In both cases (an explicitly specified set of columns, or the default set) the pseudo-property jcr:path will always be returned as a column. jcr:path is a special column that does not correspond to any actual property, it holds the normalized absolute path for the node represented by each row (see 8.5.2.2 Pseudo-property jcr:path).
As well, a score column will also be included, though it is not required that its contents always be meaningful. Note also that this column may be labeled simply jcr:score or it may be labeled with the signature and parameters of the jcr:score(...) function used in XPath. Additional score-related columns may be also returned by implementations that support multiple jcr:score(...) functions with varying parameters (see 8.5.2.4 Pseudo-property, 6.6.5.2 jcr:contains Function, and 8.5.4.5 CONTAINS).
If columns are explicitly specified then the order in which they are specified in the query is the order in which they will appear in the table. If no columns are explicitly specified then the order in which they appear is implementation-specific.
The column specifier has no effect on the content or form of the NodeIterator view of the query result.
XPath: In XPath the mechanism of the column specifier is not specified, though one possible approach is to interpret as the column specifier the last location step when it uses the attribute axis; in other words, when content repository properties (XML attributes in document view) are selected in the last location step. If this approach is taken then, for example, multiple properties are selected with a union.
Another possible approach is to define an XPath function that specifies the desired columns. This specification, however, does not attempt to define or limit the possible options.
SQL: In SQL the column specifier is the SELECT clause. To select the default column set the * is used.
Examples:
SQL |
XPath (one suggested approach) |
SELECT * |
//* |
SELECT * |
//element(*, my:type) |
SELECT my:title |
//element(*, my:type)/@my:title |
SELECT my:title, my:text |
//element(*, my:type)/ |