Reputation: 113
I have a vertex with following properties:
prop_1 - String - Single
prop_2 - String - Set
When I return the value-map of above vertex, the values are not returned in proper format.
I know that if I explicitly mention single cardinality properties to be unfolded,I can get the result I want but the gremlin query we are using is generic (dynamically generated) is used for different vertices with different properties and this the properties cannot be explicitly mentioned in return statements.
Is there a way to return the single and set carinality properties to be returned with correct data type representation?
Upvotes: 1
Views: 711
Reputation: 2856
You can do it base on the number of values in the property.
(this may cause inconsistency with a set value that contains only 1 value...)
g.V().valueMap().by(choose(
count(local).is(eq(1)),
unfold()
identity()
))
example https://gremlify.com/@noam621/b9
Upvotes: 2