Frage

Using OrientDB's query language, how can find all vertices in cluster a that have no outgoing edge ending in a vertex of class b (i.e. no direct neighbour vertex of class b)? It does not matter if they have other outgoing edges.

War es hilfreich?

Lösung

If you've a class A mapped to cluster a you can do:

select from A where not( out.in.@class in ['b'] )

That means cross the "out" property of A records (as edges), then the "in" property (the vertex) and then get the class name (@class). I've used the IN operator instead of = (equals) because "out.in.@class" returns a collection of class names.

If you want have no A class and you have to go through the cluster A use cluster: syntax:

 select from cluster:A where not( out.in.@class in ['b'] )

I've tested against latest 1.0rc8-SNAPSHOT and works.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top