Reputation: 47933
For example, in the following tree structure:
root
(name = a)
(name = b)
(name = c)
(name = a)
(name = x)
...
(name = c)
(name = a)
(name = c)
(name = a)
(name = e)
In which, there's only one type of edge in the graph called HAS_CHILD
. The path from root
to the first c
node, for example, would be:
root-HAS_CHILD->a-HAS_CHILD->b-HAS_CHILD->c
I want to return all nodes named a
that don't have a descendant named c
. In this case, that would be the fourth node named a
.
The XPath equivalent would be something similar to:
//*[not(.//*[contains(@name, 'c')])]
Upvotes: 0
Views: 35
Reputation: 1982
Maybe there's a more efficient method, but this should work:
select from node where (name='a') and (@rid not in (select from (traverse in('has_child') from ( select from node where name='c') ) where name='a'))
Upvotes: 1