Gremlin Java API with remote Neo4J graph

1,660 views
Skip to first unread message

Xander Uiterlinden

unread,
Aug 9, 2016, 3:00:46 PM8/9/16
to Gremlin-users
Hi,

I'm currently looking into the options for migrating from blueprints 2 to tinkerpop 3. I do get graph manipulation and traversal working with Titan, and now I would like to do the same with Neo4J.
Looking through the documentation there's plenty of examples but I can't find how to use the Java API with a remote Neo4J server.

Ideally I would expect something like:

Graph graph = Neo4JGraphFactory.open("ip:port");

But there's no example mentioning such a way of interacting. Is this actually possible ?

Thanks,

Xander 

Stephen Mallette

unread,
Aug 9, 2016, 3:05:43 PM8/9/16
to Gremlin-users
You can only do it with HA:


otherwise it will only work in embedded mode.

--
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-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/c31dc838-d619-490a-9ad0-428b191e58ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Robert Dale

unread,
Aug 9, 2016, 5:33:52 PM8/9/16
to gremli...@googlegroups.com
Stephen, isn't the HA configuration still embedded?  It's not remote in the normal sense, multiplies the foot-print, etc.

Xander, the reason that there is no gremlin support for a standalone, remote Neo4j is because the neo4j remote (bolt/http) drivers don't expose the low-level API required by the gremlin graph. They only execute cypher. You could create a driver that adapted the gremlin graph calls to cypher. That might be interesting but could generate a lot of traffic.

Today your options are to run neo4j embedded in your application and use the native Java API [1] similar to what you are already doing or run a remote gremlin server [2] with neo4j embedded and use either or both the cluster client [3] and remote graph [4] (in either standalone or HA mode).

The gremlin server provides some stats and the ability to connect multiple remote clients, for instance the console to execute ad hoc queries.





For more options, visit https://groups.google.com/d/optout.



--
Robert Dale

Stephen Mallette

unread,
Aug 9, 2016, 7:07:43 PM8/9/16
to Gremlin-users

True - I shouldn't have used the term "embedded" that way. I just wanted to try to say that you could connect to a neo4j server instance that way. It is as you describe.


Xander Uiterlinden

unread,
Aug 10, 2016, 10:39:23 AM8/10/16
to Gremlin-users
So am I correct to say that basically when you want to use a clustered highly available graph when using Tinkerpop3 the best way of using it in an on-line (OLTP) scenario would be through the gremlin-server ? Since that seems to be the only way that actually allows me to swap the actual implementations and manage risk, e.g. switching from Titan to Neo4J or vice versa ?

Cheers,

Xander

Stephen Mallette

unread,
Aug 11, 2016, 7:53:35 AM8/11/16
to Gremlin-users
I don't see it that way. You can switch from Titan to Neo4j to whatever without Gremlin Server. Once you use a TinkerPop-enabled graph, regardless of your implementation approach (e.g. Gremlin Server, embedded in your application, etc), you can always still swap it out later.

--
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-users+unsubscribe@googlegroups.com.

Robert Dale

unread,
Aug 11, 2016, 8:48:54 AM8/11/16
to gremli...@googlegroups.com
Yes and no.  It's not that transparent.

Titan has the advantage that gremlin can be embedded while the storage is remote. This makes using the native Java API very easy and straightforward.  It also allows lazy loading which might not always be the best idea but it's so fast I didn't see any performance issues in my use cases.

However, I also decided to move to move away from titan and did not want to have an database embedded in my application. I also settled on neo4j for the time being. With that, the only option is to use a remote gremlin server. Then, there are two options for the client both of which use detached objects. This means lazy loading goes away. It changes the approach and often times the actual query. With the java driver (writing scripts), additional code is needed to handle parameterization and result sets.



For more options, visit https://groups.google.com/d/optout.



--
Robert Dale

Stephen Mallette

unread,
Aug 11, 2016, 9:08:51 AM8/11/16
to Gremlin-users
Robert, I think I read your clarification as: If you build your application on Gremlin Server and use gremlin-driver then you are bound to Gremlin Server if you choose to switch graph databases. In other words, it's not as though you can build your application on Gremlin Server/Driver then decided to swap databases and go to embedded. Is that the distinction you're making? 

Robert Dale

unread,
Aug 11, 2016, 9:42:21 AM8/11/16
to gremli...@googlegroups.com
We can remove database altogether.  It really is just embedded gremlin vs. remote gremlin (server).


For more options, visit https://groups.google.com/d/optout.



--
Robert Dale

Xander Uiterlinden

unread,
Aug 12, 2016, 10:11:54 AM8/12/16
to Gremlin-users
Yeah, that's exactly my point. There aren't many options (actually there seems to be only one) when you want to use the gremlin Java API against a remote server. So that doesn't give me much to choose from.

Stephen Mallette

unread,
Aug 12, 2016, 11:36:55 AM8/12/16
to Gremlin-users

Were there more "remote" options, as you put it, in tinkerpop 2.x? I didn't think so - basically the same, no?


--
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-users+unsubscribe@googlegroups.com.

Robert Dale

unread,
Oct 6, 2016, 2:38:30 PM10/6/16
to Gremlin-users

Hi Xander,  JasonPlurad just showed me a neo4j-gremlin-bolt driver.   I haven't tried it yet but maybe it will work for your remote neo4j use case.

Stephen Mallette

unread,
Oct 6, 2016, 2:40:30 PM10/6/16
to Gremlin-users
If anyone gives that a try, it would be nice to hear your experience with it.

--
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-users+unsubscribe@googlegroups.com.

Jason Plurad

unread,
Oct 6, 2016, 3:00:37 PM10/6/16
to Gremlin-users
I'm just working all the channels :) I saw it from Stephen who tweeted about it earlier today:

https://twitter.com/spmallette/status/784084776651153408

-- Jason


On Thursday, October 6, 2016 at 2:40:30 PM UTC-4, Stephen Mallette wrote:
If anyone gives that a try, it would be nice to hear your experience with it.
On Thu, Oct 6, 2016 at 2:38 PM, Robert Dale <rob...@gmail.com> wrote:

Hi Xander,  JasonPlurad just showed me a neo4j-gremlin-bolt driver.   I haven't tried it yet but maybe it will work for your remote neo4j use case.



On Friday, August 12, 2016 at 10:11:54 AM UTC-4, Xander Uiterlinden wrote:
Yeah, that's exactly my point. There aren't many options (actually there seems to be only one) when you want to use the gremlin Java API against a remote server. So that doesn't give me much to choose from.

On Thursday, August 11, 2016 at 3:42:21 PM UTC+2, Robert Dale wrote:
We can remove database altogether.  It really is just embedded gremlin vs. remote gremlin (server).

--
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.
Reply all
Reply to author
Forward
0 new messages