Jasonsfk
Jasonsfk

Reputation: 87

How to filter out a list of particular nodes using Gremlin

I am using Titan and Gremlin 3.0.1

The graph only has one type of node which is "nodeA" and has five edge labels, namely "relation1", "relation2", etc.

Now I want to find the nodes which do not have "relation1" or "relation2" edges. Below is the query I am using:

g.V().except(g.V().in('relation1', 'relation2'))

This gives the error: "the wrong type of argument for except"

Any help will be appreciated.

Upvotes: 2

Views: 708

Answers (1)

Daniel Kuppitz
Daniel Kuppitz

Reputation: 10904

except is not a step in TinkerPop 3. All you need is the not step:

gremlin> g = TinkerFactory.createModern().traversal()
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
gremlin> g.V().not(bothE("created"))
==>v[2]
gremlin> g.V().not(outE("created"))
==>v[2]
==>v[3]
==>v[5]
gremlin> g.V().not(inE("created"))
==>v[1]
==>v[2]
==>v[4]
==>v[6]

Upvotes: 3

Related Questions