How to get the id, the label and all properties from a vertex in one query?

2,132 views
Skip to first unread message

christophe...@gmail.com

unread,
Apr 4, 2019, 4:09:47 AM4/4/19
to Gremlin-users

Hello,


I am using AWS Neptune with gremlin and I want to get the id of a vertex with all properties of the vertex in one query. How can I do this?

I have tried

g.V().hasLabel('file').valueMap(true) 

but the output is:

{ "fileSize": [ "9170" ], "Gremlin.Net.Process.Traversal.T": "f1fce58306f85ca7050503160640d735c9919c8fc85881d65de80bfe31b5ca24", "mimeType": [ "text/html" ] }

No label and no id is there. The problem with

project('id','label',' fileSize', 'mimeType', 'malwareSource').
    by(id).
    by(label).
    by('fileSize').
    by('mimeType').
    by('malwareSource') 

is that the propertie malwareSource is sometimes part of a file vertex an sometimes not. So if there is no malwareSource property an exception is thrown.

Stephen Mallette

unread,
Apr 4, 2019, 7:03:26 AM4/4/19
to gremli...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/54d926c1-d442-4363-84b5-a6a3135fa2f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

christophe...@gmail.com

unread,
Apr 4, 2019, 7:09:19 AM4/4/19
to Gremlin-users
The answer on SO did not fix the problem.


Am Donnerstag, 4. April 2019 13:03:26 UTC+2 schrieb Stephen Mallette:
On Thu, Apr 4, 2019 at 4:09 AM <christophe...@gmail.com> wrote:

Hello,


I am using AWS Neptune with gremlin and I want to get the id of a vertex with all properties of the vertex in one query. How can I do this?

I have tried

g.V().hasLabel('file').valueMap(true) 

but the output is:

{ "fileSize": [ "9170" ], "Gremlin.Net.Process.Traversal.T": "f1fce58306f85ca7050503160640d735c9919c8fc85881d65de80bfe31b5ca24", "mimeType": [ "text/html" ] }

No label and no id is there. The problem with

project('id','label',' fileSize', 'mimeType', 'malwareSource').
    by(id).
    by(label).
    by('fileSize').
    by('mimeType').
    by('malwareSource') 

is that the propertie malwareSource is sometimes part of a file vertex an sometimes not. So if there is no malwareSource property an exception is thrown.

--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremli...@googlegroups.com.

Stephen Mallette

unread,
Apr 4, 2019, 7:42:48 AM4/4/19
to gremli...@googlegroups.com
i updated the answer based on your comments. perhaps you had not seen that yet.

To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/1f96c00f-3bac-4351-991a-b93f999fc552%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages