Re: [TinkerPop] Gremlin in javascript / node

322 views
Skip to first unread message

Stephen Mallette

unread,
Dec 7, 2012, 8:22:07 AM12/7/12
to gremli...@googlegroups.com
There have been multiple attempts at gremlin-js but none have really
panned out in terms of something really usable. The most recent work
was done by Frank Panetta who I believe is still on this list.

https://github.com/entrendipity/gremlinjs
https://github.com/entrendipity/helios.js

I was trying to work with him on gremlinjs, but haven't been able to
really find the time to help him out (sorry, Frank). Perhaps you both
could collaborate together on something. I think we would all like to
see the javascript community join in the TinkerPop fun.

Best regards,

Stephen


On Fri, Dec 7, 2012 at 8:07 AM, Quinn Shanahan <q.sha...@gmail.com> wrote:
> Has anyone explored using Gremlin in a javascript context? I think this
> would be interesting given that the gremlin syntax is mostly compatible with
> javascript. I'd love to help out if some is working on this / thinking about
> working on this.
>
> Quinn
>
> --
>
>

Frank Panetta

unread,
Jan 3, 2013, 9:08:41 AM1/3/13
to gremli...@googlegroups.com
Hi Stephen,

I can appreciate that you have a lot going on. Tinkerpop is moving at a very fast pace. I really haven't progressed much further from the last time we spoke, however I'm keen to get back into it.

Quinn if you're interested I could use the help.

I am, however, working on a javascript version of Gremlin that uses Rexster. This will allow it to be used in the browser and on Node. I think this might provide a quick win until I sort out a more native approach (i.e. rhino).

Frank

Frank Panetta

unread,
Jan 10, 2013, 9:36:44 PM1/10/13
to gremli...@googlegroups.com
Hi,

Just wanted to say that I'm currently working on gremlin-node, which will not require Rexster. I hope to release alpha in 2-3 weeks.

Frank

Amirouche B.

unread,
Jan 13, 2013, 5:45:43 PM1/13/13
to gremli...@googlegroups.com
Héllo,


On Friday, January 11, 2013 3:36:44 AM UTC+1, Frank Panetta wrote:
Hi,

Just wanted to say that I'm currently working on gremlin-node, which will not require Rexster. I hope to release alpha in 2-3 weeks.

I'm not sure what it is, but if it is writring gremlin script in an other language (here js) and serialize the it and submit it to rexster you might be interested in omak.

 

Frank

On Friday, January 4, 2013 1:08:41 AM UTC+11, Frank Panetta wrote:
Hi Stephen,

I can appreciate that you have a lot going on. Tinkerpop is moving at a very fast pace. I really haven't progressed much further from the last time we spoke, however I'm keen to get back into it.

Quinn if you're interested I could use the help.

I am, however, working on a javascript version of Gremlin that uses Rexster. This will allow it to be used in the browser and on Node. I think this might provide a quick win until I sort out a more native approach (i.e. rhino).

Then you might be interested by my rexster jython branch, it's not ready for general consumption but it is a demo of a way of interacting with rexster from another language supported by the JVM in this case it's python. I couldn't find a way to use gremlin extension directly that's why I did this, but now I will have a look at gremlinjs and learn more.

The idea is:
- submit a python function named query with graph *args (list of arguments), **kwargs (list of keyword arguments - a map).
- with the query must come two json parameters args and kwargs which are respectivly a list and a dictionary
- the jython extensions exectutes query with the provided arguments and return a string result

Client side the python code is «extracted» from the code itself, basically there is a function that takes a function as parameter and returns its code.

This is the plan but it's not quite ready, right now you can only submit a query(graph) function and interact with the graph and return a string there is no parameter. Also there is a ACE editor that replaces the doghouse with which I did my tests so far.

Regards,

Amirouche

Pavan Kumar

unread,
Mar 8, 2013, 4:33:59 PM3/8/13
to gremli...@googlegroups.com
HI Frank,

   Is there any plan to add support for Titan in  gremlin-node , that would be awesome.

regards,
Pavan

James Thornton

unread,
Mar 13, 2013, 6:44:57 AM3/13/13
to gremli...@googlegroups.com
Hi Quinn -

Gremlin-JavaScript has been discussed as a Gremlin variant many would like to see (along with Gremlin-Jython and Gremlin-Clojure).

Zach Maril is working on Gremlin-Clojure now -- in fact he posted his new project yesterday (https://groups.google.com/d/topic/gremlin-users/Del9DasqBcE/discussion).

All Gremlin variants use Gremlin-Java as their base, and each essentially would wrap Gremlin-Java like Gremlin-Groovy does.

Last year I worked on the Neo4j Sever JavaScript plugin -- there is no Gremlin-JavaScript yet so the goal was to make Gremlin-Java work with a JavaScript engine. 

There are several different JavaScript engines -- there is an old version that comes standard with the JDK, and there are newer Rhino versions, including a rhino-nonjdk version which we ended up using, but Rhino is still old and not without its issues.

You can see my comments regarding this issue here:


And you can look at the pom.xml to see which version we ended up using (the lib directory includes the jar files):


Later this year, Oracle is releasing a new JavaScript engine called Nashorn (http://en.wikipedia.org/wiki/Nashorn_(JavaScript_engine) ).


If someone is interested in working on Gremlin-JavaScript, you probably want to target Nashorn since it's the future, and according to the InfoQ article, it looks like there will be Nashorn + Node.jar integration.

You can get an idea of what Gremlin-Java-in-JavaScript looks like by viewing these test cases for the Neo4j Server JavaScript Plugin:


Note that some of the code is Neo4j Server specific (such as the manual imports in the scripts), but you can ignore those. 

In the Neo4j Plugin, "pipe" (com.tinkerpop.gremlin.java.GremlinPipeline) and "g" (com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jGraph) instances are automatically set, just like "g" is automatically set in the Rexster Gremlin-Groovy extension. 

In Gremlin Java, you always start with an instance of GremlinPipeline.

For example, see:


Again, this is not Gremlin-JavaScript -- this is Gremlin-Java in JavaScript -- but if you were to create Gremlin-JavaScript, you would wrap the Gremlin-Java methods in a JavaScript-idiomatic way.

- James

Stephen Mallette

unread,
Mar 13, 2013, 7:02:32 AM3/13/13
to gremli...@googlegroups.com
I wouldn't go so far as to say there is no gremlin-javascript. Frank
Panetta has been working on that project for some time now and has
several early contributions in that vein. Please see:

https://github.com/entrendipity/gremlin-node
https://github.com/entrendipity/gremlin-js

I would recommend that anyone interested in working on any sort of
Javascript implementation of Gremlin contact him to collaborate.

Stephen
> --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

James Thornton

unread,
Mar 13, 2013, 7:13:53 AM3/13/13
to gremli...@googlegroups.com
Oh, cool. My apologies Frank. 

I clicked on the https://github.com/entrendipity/gremlinjs link in a previous post and got a 404 -- I wasn't aware of your current work.

- James

Frank Panetta

unread,
Apr 1, 2013, 1:34:34 AM4/1/13
to gremli...@googlegroups.com
No problem, I actually changed the repo name, so that's why it failed.

Sorry for the delayed response, I've been out of circulation due to other commitments.

Frank
Reply all
Reply to author
Forward
0 new messages