3.3.2-SNAPSHOT - .as following branch(.flaMap(),.local()) failing

22 views
Skip to first unread message

Bailey Glen

unread,
Oct 13, 2017, 11:30:10 AM10/13/17
to Gremlin-users
Working with 3.3.2-SNAPSHOT built from fa246a1899b0d2165b43642f7ee0c21fe64ee6d9

g.V().as('bob')
vs
g.V().flatMap( as('bob') )

The second of these is failing for me in gremlin-console with tinkergraph, console remote to server with tinkergraph and neo4j.
However, they both work from python-gremlin
g.V().flatMap( as_('bob')).toList()


If this should be working, I can submit the bug request.
If not, why not, and why is it working in python-gremlin?


Error Details
gremlin> g.V().flatMap(as('bob'))
groovysh_parse
: 2: unexpected token: as @ line 2, column 15.
   g
.V().flatMap(as('bob'))
                 
^


1 error
Type ':help' or ':h' for help.
Display stack trace? [yN]y
org
.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
groovysh_parse
: 2: unexpected token: as @ line 2, column 15.
   g
.V().flatMap(as('bob'))
                 
^


1 error


        at org
.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
        at org
.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:107)
        at org
.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:149)
        at org
.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:120)
        at org
.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:132)
        at org
.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:350)
        at org
.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:144)
        at org
.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:110)
        at org
.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:234)
        at org
.codehaus.groovy.tools.shell.RigidParser.parse(Parser.groovy:159)
        at org
.codehaus.groovy.tools.shell.Parser.parse(Parser.groovy:75)
        at org
.codehaus.groovy.tools.shell.Groovysh.execute(Groovysh.groovy:178)
        at org
.apache.tinkerpop.gremlin.console.GremlinGroovysh.super$3$execute(GremlinGroovysh.groovy)
        at sun
.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
        at sun
.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java
.lang.reflect.Method.invoke(Method.java:498)
        at org
.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
        at groovy
.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
        at groovy
.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
        at org
.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:132)
        at org
.apache.tinkerpop.gremlin.console.GremlinGroovysh.execute(GremlinGroovysh.groovy:72)
        at org
.codehaus.groovy.tools.shell.Shell.leftShift(Shell.groovy:122)
        at org
.codehaus.groovy.tools.shell.ShellRunner.work(ShellRunner.groovy:95)
        at org
.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$work(InteractiveShellRunner.groovy)
        at sun
.reflect.GeneratedMethodAccessor32.invoke(Unknown Source)
        at sun
.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java
.lang.reflect.Method.invoke(Method.java:498)
        at org
.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
        at groovy
.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
        at groovy
.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
        at org
.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:132)
        at org
.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:152)
        at org
.codehaus.groovy.tools.shell.InteractiveShellRunner.work(InteractiveShellRunner.groovy:124)
        at org
.codehaus.groovy.tools.shell.ShellRunner.run(ShellRunner.groovy:59)
        at org
.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$run(InteractiveShellRunner.groovy)
        at sun
.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun
.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java
.lang.reflect.Method.invoke(Method.java:498)
        at org
.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
        at groovy
.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
        at groovy
.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
        at org
.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:132)
        at org
.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:152)
        at org
.codehaus.groovy.tools.shell.InteractiveShellRunner.run(InteractiveShellRunner.groovy:83)
        at org
.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:232)
        at org
.apache.tinkerpop.gremlin.console.Console.<init>(Console.groovy:146)
        at org
.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:232)
        at org
.apache.tinkerpop.gremlin.console.Console.main(Console.groovy:453)
 

Marko Rodriguez

unread,
Oct 13, 2017, 11:38:32 AM10/13/17
to gremli...@googlegroups.com
__.as(‘bob’)

Marko.


--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/310ee4ba-3b2b-4f8e-a331-1620fd0c1047%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Robert Dale

unread,
Oct 13, 2017, 11:40:20 AM10/13/17
to gremli...@googlegroups.com
Some words are reserved in groovy thus you must use the anonymous traversal explicitly. 

g.V().flatMap(__.as('bob'))




Robert Dale

--
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.

Bailey Glen

unread,
Oct 13, 2017, 11:53:13 AM10/13/17
to Gremlin-users
I had just realized this was working, but didn't understand why. I'm going to summarize it here...
in both cases, reserved words required a change to syntax to call the anonymous traversal. 

python
as_(

gremlin
__.as(

python ALWAYS requires the as_(
gremlin you can do drop the underscores when chaining functions, but because the as is being passed as an argument in another step (and therefore is an anonymous function), you have to add the __


Robert Dale

To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.

Marko Rodriguez

unread,
Oct 13, 2017, 12:26:25 PM10/13/17
to gremli...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages