How to get properties has id/key with vertexes info in one gremlin query or Gremlin.Net

43 views
Skip to first unread message

peng han

unread,
Jul 13, 2021, 10:08:57 AM7/13/21
to Gremlin-users
Hi 
I try to get properties which has key or id in following query by Gremlin.Net, but vertex info(id and label) in VertexProperty is null in result.

g.V().Properties<VertexProperty>().HasKey(somekey).Promise(p => p.ToList())

So i try another way, but it's return class is Path, and i had to write an ugly code for type conversion.

g.V().Properties<VertexProperty>().HasKey(somekey).Path().By(__.ValueMap<object, object>(true))

Is there a better way to achieve this requirement

Thanks a lot.

Best Regards

peng han

unread,
Jul 13, 2021, 10:06:18 PM7/13/21
to Gremlin-users
To add: I have two cases, one is I want to find all properties has some key, and get properties info(id, key, value) with their vertex id and label, i tried g.V().elementMap(propertyKey),but i can't get property id; The other is get property by id, i tried g.V().properties().hasId(propertyId), but i can't get its vertex id and label.

Florian Hockmann

unread,
Jul 15, 2021, 4:44:00 AM7/15/21
to Gremlin-users
Reply all
Reply to author
Forward
0 new messages