Hazaaa
Hazaaa

Reputation: 172

How to return meta properties of vertex property in Gremlin 3.4.0

One of my vertex property got his properties (meta properties). But when i return all vertex properties i only get value of that property but not his properties also. Is that possible to do?

This is what i've tried:

g.V(rootID).Out()
.Has("name", splitedPath[0]).Repeat(Out().SimplePath()).Until(Has("name", splitedPath[splitedPath.Length - 1])).Out()
                   .Repeat(Out().SimplePath()).Until(Label().Is("Recording")).Has("name", Between(partialPropertyName, partialPropertyName + "a"))
                   .Project<object>("id", "label", "properties")
                         .By(Id())
                         .By(Label())
                         .By(ValueMap<string, object>())
                   .Dedup().ToList();

Upvotes: 0

Views: 563

Answers (1)

stephen mallette
stephen mallette

Reputation: 46216

You would need to Project() again in they "properties" By() (in some way) because ValueMap() does not return metaproperties. Here's an example in Java which does that via properties():

gremlin> g.V(1).project('id','label','properties').
......1>          by(id).
......2>          by(label).
......3>          by(properties().group().by(key).by(union(value(),valueMap()).fold()).fold())
==>[id:1,label:person,properties:[[name:[marko,[]],location:[san diego,[startTime:1997,endTime:2001],santa cruz,[startTime:2001,endTime:2004],brussels,[startTime:2004,endTime:2005],santa fe,[startTime:2005]]]]]

Upvotes: 2

Related Questions