Thanks a lot. Updated to 0.8-SNAPSHOT. Strangely maven did not resolve groovy dependence automatically. Had to add it by hand.
ScriptEngine approach works fine, Gremlin.compile(expr) does not? I understand that it could be faster&cleaner to use groovy, but I need to be able to pass string queries and get results back. In my use-case this is the definite use of gremlin - arbitrary string queries. For "static" business logic I can use Pipes - I'm not bothered by the wordy expressions. Alfredas On Mon, Feb 21, 2011 at 4:23 PM, Marko Rodriguez <okramma...@gmail.com> wrote: > Hi, > > outE(String) is in Gremlin 0.8-SNASPHOT, not Gremlin 0.7. > > Note at the bottom of the main Wiki page: "Gremlin documentation is up to > date with the current Gremlin codebase, not with the latest Gremlin release." > > I do this so its easier for me to maintain documentation. The documentation > for Gremlin 0.7 is in the doc/wiki directory of the distribution. > > If you still want to use Gremlin 0.7, do this: > > engine.eval("v.outE[[label='KNOWS']].inV >> results"); > > Finally, I would recommend using Groovy in your codebase instead of JSR 223 > ScriptEngine. Groovy and Java work seamlessly together and its so much > handier/cleaner/faster than through JSR 223. See: > https://github.com/tinkerpop/gremlin/wiki/Using-Gremlin-through-Groovy > > Hope that helps, > Marko. > > http://markorodriguez.com > > > On Feb 21, 2011, at 9:15 AM, Alfredas Chmieliauskas wrote: > >> Dear all, >> >> I have the following code: >> >> ScriptEngine engine = new GremlinScriptEngineFactory().getScriptEngine(); >> List<Vertex> results = new ArrayList<Vertex>(); >> engine.getBindings(ScriptContext.ENGINE_SCOPE).put("g", getGraph()); >> engine.getBindings(ScriptContext.ENGINE_SCOPE).put("v", >> getVertex(startNode)); >> engine.getBindings(ScriptContext.ENGINE_SCOPE).put("results", results); >> try { >> engine.eval(v.outE('KNOWS').inV >> results"); >> } catch (ScriptException e) { >> logger.error(e.getMessage(), e); >> } >> >> ....produces the following error: >> >> >> ERROR javax.script.ScriptException: >> groovy.lang.MissingMethodException: No signature of method: >> com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jVertex.outE() is >> applicable for argument types: (java.lang.String) values: [KNOWS] >> Possible solutions: outE(groovy.lang.Closure), dump(), >> use([Ljava.lang.Object;), getAt(java.lang.String), >> getAt(java.lang.String), with(groovy.lang.Closure) >> javax.script.ScriptException: javax.script.ScriptException: >> groovy.lang.MissingMethodException: No signature of method: >> com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jVertex.outE() is >> applicable for argument types: (java.lang.String) values: [KNOWS] >> Possible solutions: outE(groovy.lang.Closure), dump(), >> use([Ljava.lang.Object;), getAt(java.lang.String), >> getAt(java.lang.String), with(groovy.lang.Closure) >> at >> org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:117) >> at >> com.tinkerpop.gremlin.jsr223.GremlinScriptEngine.eval(GremlinScriptEngine.java:36) >> at >> javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:247) >> at >> com.tinkerpop.gremlin.jsr223.GremlinScriptEngine.eval(GremlinScriptEngine.java:32) >> at >> alfredas.springdatagraph.template.domain.AbstractRepository.findAllByGremlin2(AbstractRepository.java:94) >> at alfredas.springdatagraph.template.App.<init>(App.java:84) >> at alfredas.springdatagraph.template.App.main(App.java:93) >> Caused by: javax.script.ScriptException: >> groovy.lang.MissingMethodException: No signature of method: >> com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jVertex.outE() is >> applicable for argument types: (java.lang.String) values: [KNOWS] >> Possible solutions: outE(groovy.lang.Closure), dump(), >> use([Ljava.lang.Object;), getAt(java.lang.String), >> getAt(java.lang.String), with(groovy.lang.Closure) >> at >> org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:318) >> at >> org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:111) >> ... 6 more >> Caused by: groovy.lang.MissingMethodException: No signature of method: >> com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jVertex.outE() is >> applicable for argument types: (java.lang.String) values: [KNOWS] >> Possible solutions: outE(groovy.lang.Closure), dump(), >> use([Ljava.lang.Object;), getAt(java.lang.String), >> getAt(java.lang.String), with(groovy.lang.Closure) >> at >> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:54) >> at >> org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46) >> at >> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40) >> at >> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) >> at >> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124) >> at Script1.run(Script1.groovy:43) >> at >> org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:315) >> ... 7 more >> >> >> And the alternative method: >> >> Gremlin.compile("outE('KNOWS').inV)"; >> >> gives: >> >> Exception in thread "main" groovy.lang.MissingMethodException: No >> signature of method: Script1.outE() is applicable for argument types: >> (java.lang.String) values: [KNOWS] >> Possible solutions: run(), run(), dump(), use([Ljava.lang.Object;), >> putAt(java.lang.String, java.lang.Object), with(groovy.lang.Closure) >> at >> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:54) >> at >> org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:78) >> at >> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:44) >> at >> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141) >> at >> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149) >> at Script1.run(Script1.groovy:22) >> at groovy.lang.GroovyShell.evaluate(GroovyShell.java:576) >> at groovy.lang.GroovyShell.evaluate(GroovyShell.java:614) >> at groovy.lang.GroovyShell.evaluate(GroovyShell.java:585) >> at groovy.lang.GroovyShell$evaluate.call(Unknown Source) >> at >> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40) >> at >> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) >> at >> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124) >> at com.tinkerpop.gremlin.Gremlin.compile(Gremlin.groovy:70) >> .... >> >> Any ideas? >> >> Alfredas >> _______________________________________________ >> Neo4j mailing list >> User@lists.neo4j.org >> https://lists.neo4j.org/mailman/listinfo/user > > _______________________________________________ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user > _______________________________________________ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user