Easiest Way to Get List Cardinality Properties As a List?
What is the easiest way to retrieve the vertex properties that have list cardinality back as a list in the traversal stream? The values() step seems to unfold the list.
For example, using the "the crew" example graph.
I want something like the following:
Is there a more direct way than
For example, using the "the crew" example graph.
gremlin> g.V().valueMap()
==>[name:[marko],location:[san diego,santa cruz,brussels,santa fe]]
==>[name:[stephen],location:[centreville,dulles,purcellville]]
==>[name:[matthias],location:[bremen,baltimore,oakland,seattle]]
==>[name:[daniel],location:[spremberg,kaiserslautern,aachen]]
==>[name:[gremlin]]
==>[name:[tinkergraph]]I want something like the following:
gremlin> g.V().valueMap("location").select(values).unfold()
==>[san diego,santa cruz,brussels,santa fe]
==>[centreville,dulles,purcellville]
==>[bremen,baltimore,oakland,seattle]
==>[spremberg,kaiserslautern,aachen]Is there a more direct way than
valueMap().select(values).unfold()?Solution
after some reflection i sense that the question you are asking is actually the answer in the first place. i assume this is in relation to string/list functions, in which case use of
but instead, as there is no
seems there might be some decent case for
valueMap() as you did and group() would be the the primary ways you'd end with a List where the former is the most likely one for the average case where you might want to do like:but instead, as there is no
local have to do:seems there might be some decent case for
local in addition to just consistency. cc/ @bechbd , @Yang Xia