HOWTO: Create a "GraphTraversal<Vertex, Vertex>" without calling addX

58 views
Skip to first unread message

vig...@gmail.com

unread,
Apr 23, 2021, 11:27:41 AM4/23/21
to Gremlin-users
Hello,

I am trying to create a GraphTraversal<Vertex, Vertex> t; without doing g.addV().

I cannot do as shown in https://github.com/krlawrence/graph/blob/master/sample-code/RemoteAddBatch.java#L43 because I am writing code in Apache BEAM and I need to create a traversal that can be called multiple times (say, func processElement that is called multiple times with the same traversal) to add vertices. I tried GraphTraversal<Vertex, Vertex> t = g.V(); but it is not helping. 

The hack I am doing today is as follows
            if (t == null) {
                t = g.addV(record.getValue().svcName).property(T.id, record.getKey());
            } else {
                t.addV(record.getKey().svcName).property(T.id, record.getKey());
            }

Could you please help me how to do this the right way?

Thanks in advance,

Stephen Mallette

unread,
Apr 23, 2021, 2:02:16 PM4/23/21
to gremli...@googlegroups.com
I find this notion of using Gremlin a bit foreign to me, but I suppose you are asking for something like this:


Is that right?

--
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/738a2777-dba4-4fe3-a6d6-fbffe98f2bf9n%40googlegroups.com.

vigith maurice

unread,
Apr 23, 2021, 7:46:24 PM4/23/21
to gremli...@googlegroups.com
Yes, that is right Stephen. Thank you.

You received this message because you are subscribed to a topic in the Google Groups "Gremlin-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gremlin-users/4hBL7UPsrRk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/CAA-H43915aNYQcFms8CfvgDpeOkeav8E-wOhMFiBr1Ae1HZQ%2Bw%40mail.gmail.com.


--
regards,
vigith maurice
Reply all
Reply to author
Forward
0 new messages