Filter out empty results

gremlin> g.V().hasLabel('metadata').valueMap() ==>{} ==>{} ==>{oncall_roster=[oncall_schedule]} How to skip or ignore the {} empty results in query
1 Reply
spmallette
spmallette11mo ago
using this sample data:
gremlin> g = TinkerGraph.open().traversal()
==>graphtraversalsource[tinkergraph[vertices:0 edges:0], standard]
gremlin> g.addV().addV().property('name','bob').iterate()
gremlin> g.V().valueMap()
==>[]
==>[name:[bob]]
gremlin> g = TinkerGraph.open().traversal()
==>graphtraversalsource[tinkergraph[vertices:0 edges:0], standard]
gremlin> g.addV().addV().property('name','bob').iterate()
gremlin> g.V().valueMap()
==>[]
==>[name:[bob]]
you could do this:
gremlin> g.V().filter(properties()).valueMap()
==>[name:[bob]]
gremlin> g.V().filter(properties()).valueMap()
==>[name:[bob]]
or you might do it as a post filter
gremlin> g.V().valueMap().filter(unfold())
==>[name:[bob]]
gremlin> g.V().valueMap().filter(unfold())
==>[name:[bob]]