6.6.3.4 Path Constraint

The path constraint restricts the result node to a scope specified by a path expression. The following path constraints must be supported:

XPath: In XPath the location steps specify the path constraint.

SQL: In SQL the path constraint occurs as an ANDed test within the WHERE clause of the pseudo-property jcr:path using either the = operator or the LIKE operator.

Exact path constraint examples:

SQL

XPath

SELECT *
FROM my:type
WHERE jcr:path LIKE '/some[%]/nodes[%]'

/jcr:root/some/
element(nodes, my:type)

SELECT *
FROM my:type
WHERE jcr:path = '/some/nodes'

/jcr:root/some[1]/element(nodes, my:type)[1]



Child nodes path constraint examples:

SQL

XPath

SELECT *
FROM my:type
WHERE jcr:path LIKE '/some[%]/nodes[%]/%' AND NOT jcr:path LIKE '/some[%]/nodes[%]/%/%'

/jcr:root/some/nodes/
element(*, my:type)

SELECT *
FROM my:type
WHERE jcr:path LIKE '/some/nodes/%'
AND NOT jcr:path LIKE '/some/nodes/%/%'

/jcr:root/some[1]/nodes[1]/
element(*, my:type)



Descendants path constraint examples:

SQL

XPath

SELECT *
FROM my:type
WHERE jcr:path LIKE '/some[%]/nodes[%]/%'

/jcr:root/some/nodes//
element(*, my:type)

SELECT *
FROM my:type
WHERE jcr:path LIKE '/some/nodes/%'

/jcr:root/some[1]/nodes[1]//
element(*, my:type)



Descendants or self path constraint examples:

SQL

XPath

SELECT *
FROM my:type
WHERE jcr:path LIKE '/some[%]/nodes[%]' OR jcr:path LIKE '/some[%]/nodes[%]/%'

/jcr:root/some/nodes//
element(*, my:type)

SELECT *
FROM my:type
WHERE jcr:path = '/some/nodes' OR jcr:path LIKE '/some/nodes/%'

/jcr:root/some[1]/nodes[1]//
element(*, my:type)