3

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?

Adam Dyga
  • 8,666
  • 4
  • 27
  • 35

2 Answers2

5

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.

stephen mallette
  • 45,298
  • 5
  • 67
  • 135
0

A solution that worked for me in this scenario :

g2.V.not(has("abcd", true))
Steffi Keran Rani J
  • 3,667
  • 4
  • 34
  • 56