Running OLAP queries on Janusgraph outside the Gremlin Console (from Java and G.V())
Hi, I'm able to run OLAP queries against my graph DB from the Gremlin Console, by following the directions provided here: https://docs.janusgraph.org/advanced-topics/hadoop/
However, I would like to also run OLAP queries without using the console, from an embedded Janusgraph Java application as well as from G.V().
In G.V(), I tried this while selecting
Groovy Mode
for query submission:
but I get the following error:
I'm assuming this is because the needed plugins are not loaded. I tried:
but this does not work outside of the console.
Any suggestions, @gdotv ?
Also, is there any example code I could use to run OLAP queries from a Java application?
Thanks!2 Replies
Hey, good question! G.V() isn't designed to run against embedded graphs as it will attempt to connect to a graph database via the Gremlin driver. In your case I believe you would need to expose a graph traversal source to your in memory graph on your server. G.V() is kind of a console replacement and not at the same time as it only allows running scripts or queries against the server, and does not include the more advanced console plug ins such as hadoop
Hopefully this provides more context - maybe folks on the JanusGraph team can provide some more information on how to expose a graph traversal source from a spark computed job
Thanks, @gdotv. It would be great if the JanusGraph folks can follow up on how to expse a GraphTraversalSource.
In the meantime, I've been able to make progress on the question about using Java, by following this old-ish post by @Bo :
https://li-boxuan.medium.com/spark-on-janusgraph-tinkerpop-a-pagerank-example-43950189b159
I've been able to include all missing dependencies and compile/run this example:
BTW: I'm using JanusGraph 1.1.0. Through lots of trial and error, I found these maven dependencies to work for me: