graphgremlintitantinkerpop

How should hasNot() work in Gremlin?


If a given vertex doesn't have a particular property, what should be the result of g.V.hasNot('non-existent-property', 'value') query? Should the vertex be emitted by such query?

I get contradictory results when using TinkerPop and Titan's in-memory graph:

gremlin> g = TinkerGraphFactory.createTinkerGraph()
==>tinkergraph[vertices:6 edges:6]
gremlin> g.V.hasNot("abcd", true)
==>v[1]
==>v[2]
==>v[3]
==>v[4]
==>v[5]
==>v[6]

The above is fine to me - the vertices do not have the specified property (set to true) so all are returned. But if I do sth similar in Titan's in-memory graph:

gremlin> g2 = TitanFactory.open(com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.buildConfiguration().set(com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.STORAGE_BACKEND, "inmemory"))
==>titangraph[inmemory:[127.0.0.1]]
gremlin> g2.addVertex(null)
==>v[256]
gremlin> g2.V.hasNot("abcd", true)

it returns no result. Which one is right?


Solution

  • Just to close the loop on this here in SO - a GitHub issue has been created for this problem (TinkerGraph does show the correct behavior):

    https://github.com/thinkaurelius/titan/issues/868

    Please follow the resolution there.