jbmusso / grex

JavaScript graph database client for TinkerPop2 Rexster
MIT License
46 stars 12 forks source link

javax.script.ScriptException with Object argument #63

Open gregory-h opened 8 years ago

gregory-h commented 8 years ago

Apologies if I'm misunderstanding the api but to query a Vertex on multiple properties I do

var query = gremlin() query(g.V({type:'Task',name:'Setup'})) client.execute( query .. )

or even with just one property

query(g.V({type:'Task'})) client.execute( query, function(err,response) {

This returns an exception,

execution returned err,result [Error: javax.script.ScriptException: groovy.lang MissingMethodException: No signature of method: groovy.lang.MissingMethodExcept on.V() is applicable for argument types: (java.util.LinkedHashMap) values: [[@t pe:ita:Task]] Possible solutions: _(groovy.lang.Closure), is(java.lang.Object), any(), use([L ava.lang.Object;), any(groovy.lang.Closure), wait()] undefined

I'm completely new to this technology stack, any suggestions how to diagnose?

jbmusso commented 8 years ago

Can you please try the following;

console.log(query.script);
console.log(query.params);`

And post the returned results? Debugging the raw query object populated is a useful trick to see if the sent Gremlin Groovy query is valid or not. If you're using ES6/2015 JavaScript, I recommend you check gremlin-template-string which will help you generate Gremlin queries.

Also, you may want to consider switching to TinkerPop3 (see https://github.com/jbmusso/gremlin-javascript). gRex, that works with TinkerPop 2.x, will be soon deprecated.

gregory-h commented 8 years ago

Thx for the reply.

here's my query

var query = gremlin() query(g.V({'@type':'ita:Task',name:'Setup'})) console.log('script is ', query.script) console.log('params are ', query.params) client.execute(query, function..)

running this produces

script is g.V(["@type":"ita:Task","name":"Setup"]) params are {} query by multiple attributes returned err,result [Error: javax.script.ScriptEx ption: groovy.lang.MissingMethodException: No signature of method: groovy.lang issingMethodException.V() is applicable for argument types: (java.util.LinkedH hMap) values: [[@type:ita:Task, name:Setup]] Possible solutions: _(groovy.lang.Closure), is(java.lang.Object), any(), use([ ava.lang.Object;), any(groovy.lang.Closure), wait()] undefined