g.createVertex(20, { k1: 'val1', k2: 'val2', k3: 'val3' });
I've been looking into doing something similar in php. The final goal being slightly different as i would like to allow users to "inject" queries inside queries, but I digress. I was hoping I could steal a bit of your insight.
The first thing Ive been wondering was, doesnt having closures passed as strings corrupt method signatures? If we were to have a method that could express itself in the following ways wouldnt that be a problem? :
(gremlin)
g.V.thing('something'){closurecode}
&
g.V.thing('something','else')
Technically from what I see, in grex you'd be passing two strings to thing() in both cases. Is this not an issue when it comes to expressing them differently in gremlin? How have you handled that case? Simple checking for curly braces?
Im curious about this because i would like my dev to allow developpers to add to method arguments and/or closures to php-gremlin scripts that have already been set but not translated), so it is very important not to have overlapping method signatures.
Thanks in advance.
Also if anyone has a link to a list of methods available as well as all their signatures that would be great. Id like to find a list that covers roughly what gremlindocs covers. I'll have another look in the wiki, Im sure I must've missed something obvious.
Hi Dmill,Yes, the scenario you describe has its challenges. So, in order to distinguish between a string and a "closure" I use regex which identifies a closure by testing for a beginning and ending curly brace (i.e. "{it.name=='josh'}{it.age}{it.name}"). Also, if a closure is passed as an argument, it will be the last one.here's the regex:var closureRegex = /^\{.*\}$/;And here's my function that I use whenever I want to test for a closurefunction _isClosure(val) {return _isString(val) && closureRegex.test(val);}The gRex library is simply a string manipulation tool that formats a string that is understandable by Rexster. So there's not much to it really.Anyway, I hope this helps clarify what's happening in gRex.Also you can find a link to the latest gremlin API at the bottom of the gremlin wiki.Frank
All gRex does is transform/manipulate the methods and arguments into a string that Rexster understands, so taking in a
On Saturday, 6 July 2013 21:26:37 UTC+10, Dmill wrote:
--
You received this message because you are subscribed to a topic in the Google Groups "Gremlin-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gremlin-users/i8BYgNOZCkk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gremlin-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.