How to traverse graph created using ConfiguredPlanFactory ?

501 views
Skip to first unread message

AG

unread,
Nov 17, 2017, 9:30:28 AM11/17/17
to JanusGraph users

Hello All, 


I have set up a Janusgraph Cluster with Cassandra + ES. The cluster has been set up to support ConfiguredGraphFactory. Also, I am connecting the gremlin cluster remotely. I have set up a client and am able to create a graph using :


client.submit(String.format("ConfiguredGraphFactory.create(\"%s\")", graphName));


However, I am not able to get the traversalSource of the graph created using the gremlin driver. Do I have to create raw gremlin queries and traverse the graph using client.submit or is there a way to get it through the gremlin driver using Emptygraph.Instance()


Thanks,

-AG

David Pitera

unread,
Nov 17, 2017, 11:07:21 AM11/17/17
to AG, JanusGraph users
--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/1133616f-f0c5-4686-8f0f-4bf52a67e30f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

AG

unread,
Dec 5, 2017, 6:09:58 PM12/5/17
to JanusGraph users
Hey David,

It seems the stack overflow chatroom is no longer active.  I don't see much activity on the tinkerpop board link (https://issues.apache.org/jira/browse/TINKERPOP-1839) either.
So, thought of taking the conversation ahead through this thread.  I am kind of stuck on this so it would be great if you can suggest a workaround/solution to get around the problem. Let me know if you need further information.

-Anand


On Friday, 17 November 2017 08:07:21 UTC-8, David Pitera wrote:
On Fri, Nov 17, 2017 at 9:30 AM AG <anan...@gmail.com> wrote:

Hello All, 


I have set up a Janusgraph Cluster with Cassandra + ES. The cluster has been set up to support ConfiguredGraphFactory. Also, I am connecting the gremlin cluster remotely. I have set up a client and am able to create a graph using :


client.submit(String.format("ConfiguredGraphFactory.create(\"%s\")", graphName));


However, I am not able to get the traversalSource of the graph created using the gremlin driver. Do I have to create raw gremlin queries and traverse the graph using client.submit or is there a way to get it through the gremlin driver using Emptygraph.Instance()


Thanks,

-AG

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

David Pitera

unread,
Dec 5, 2017, 7:49:05 PM12/5/17
to AG, JanusGraph users
Sorry, I thought the step forward was obvious from the TinkerPop issue. There are two possible solutions to the problem:

1. The short term solution: You make use of the fact that "context" is bound to the ServerGremlinExecutor's context object, and use the setAttribute() function as Stephen explained in the Jira issue to update the global binding of your traversal source name to the traversal source. You would have to issue remote script submission to the server to do this. So if your graph is name "dynamic_g", you can do something like:

client.submit("context.setAttribute(\"dynamic_g_traversal\",ConfiguredGraphFactory.open(\"dynamic_g\").traversal(),javax.script.ScriptContext.GLOBAL_SCOPE);");

2. The long term solution that JanusGraph should adopt. I want to get around to writing this solution, but if you have the cycles, please do and open up a PR against the OSS: Write a custom Channelizer for JanusGraph, and then we can make it so that JanusGraph has access to lower level GremlinServer components. Then you can modify the ConfiguredGraphFactory code to automatically update the context's global bindings when a graph is open.

Good luck!

To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/d753c0b1-0acf-486e-85f3-d87e7f9167fd%40googlegroups.com.

nikhil...@gmail.com

unread,
May 29, 2018, 10:46:35 AM5/29/18
to JanusGraph users
I tried the same thing from gremlin console

gremlin> context.setAttribute("test_g", ConfiguredGraphFactory.open("abcd").traversal(),javax.script.ScriptContext.GLOBAL_SCOPE)
==>null
gremlin> test_g
No such property: test_g for class: Script23
Type ':help' or ':h' for help.
Display stack trace? [yN]N

This is the error i'm getting. Am i missing something?

David Pitera

unread,
May 29, 2018, 11:01:11 AM5/29/18
to nikhil...@gmail.com, JanusGraph users
I fixed this in JG 0.3 (which has not been released yet) so you can build a dist yourself off of master now or wait for JG 0.3 to be released:

https://github.com/JanusGraph/janusgraph/pull/953

To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/790d00ca-729b-4412-9ed1-0bc58b57c625%40googlegroups.com.

nikhil...@gmail.com

unread,
May 30, 2018, 2:13:38 AM5/30/18
to JanusGraph users
ok. is there no other alternative(in JG 0.2) to manually adding bindings and restarting the server every time we want to create a new graph?

David Pitera

unread,
May 30, 2018, 10:16:52 AM5/30/18
to nikhil...@gmail.com, JanusGraph users
You can use a different client or try to use the fix described in here https://issues.apache.org/jira/browse/TINKERPOP-1839

To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/0bf6d6e0-923d-4d1e-9b55-a9299ccd2b47%40googlegroups.com.

nikhil...@gmail.com

unread,
Jun 4, 2018, 9:17:23 AM6/4/18
to JanusGraph users
Is this the solution you are referring to? If yes, then i have already tried this(as mentioned in above comments). It doesn't work for me. 
Can you please tell me what are some of the other clients you were referring to?

nikhil...@gmail.com

unread,
Jun 4, 2018, 10:02:29 AM6/4/18
to JanusGraph users
Instead of what is mentioned in the link, if we use "context.setAttribute("test_dynamic_ts", ConfiguredGraphFactory.create("test_dynamic").traversal(), 100)", it works.But here the int value 100, represents ENGINE_SCOPE. And if i try 200(for GLOBAL_SCOPE), instead of 100, it fails to create that binding. Can you please help me with this?
Reply all
Reply to author
Forward
0 new messages