Tinkerpop3 stored procedure

112 views
Skip to first unread message

Ash

unread,
Mar 13, 2017, 11:53:36 AM3/13/17
to Gremlin-users
Is there a "Stored Procedure" concept in Tinkerpop3?  Searching this group, I see there was some discussion and capability around this concept in Rexster but can't locate it in TP3.

Instead of sending a Gremlin-Groovy script and parameters from the client, I'd like to send a script name and parameters.  Something similar to the GroovyScriptEngine, in that you can add or update Gremlin scripts in a directory and the server will recompile the scripts and make them available.

Given that the Gremlin server already compiles and stores the Gremlin-Groovy that is sent over the wire, this does not seem like a stretch.

If this already exists, please point me in the right direction.  If it does not, I'm thinking I could write a plugin to do the job.  Again, any pointers / potential gotchas would be greatly appreciated.

Thanks!

Stephen Mallette

unread,
Mar 14, 2017, 7:37:41 AM3/14/17
to Gremlin-users
You can treat functions as stored procedures. The easiest way to do that is to use a Gremlin Server init script. The default distribution demonstrates that. If you look at gremlin-server.yaml you'll find it executes scripts/empty-sample.groovy which contains (among other things):

def addItUp(x, y) { x + y }

you can then just send as a script in a request:

addItUp(1,2)



--
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/f5b2175d-8e85-4954-b559-ed98e80ccefd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages