Hi All,
I am trying to execute multiple gremlin script using Groovy Pointing to Neo4J server. when I execute a single script I am able to get the response.
Execution Of single Gremlin Script code snippet:
def http = new groovyx.net.http.HTTPBuilder()
body: 'script=' + "g.v(1)",
requestContentType: URLENC) { resp,reader ->
println "--------- Printing Status --------"
println "Success! ${resp.status}"
println "----------Printing Content type----------"
println "${resp.headers.'Content-Type'}"
println "---------------------------------"
println reader
}
Response obtained when Printing the Reader:
[outgoing_relationships:
http://localhost:7474/db/data/node/1/relationships/out, data:[Type:REFERENCE, ID:USER_REFERENCE, Label:USER_REFERENCE, CreateDate:2012-07-06T15:32:11.455-04:00], traverse:
http://localhost:7474/db/data/node/1/traverse/{returnType}, all_typed_relationships:
http://localhost:7474/db/data/node/1/relationships/all/{-list|&|types}, property:
http://localhost:7474/db/data/node/1/properties/{key}, self:
http://localhost:7474/db/data/node/1, properties:
http://localhost:7474/db/data/node/1/properties, outgoing_typed_relationships:
http://localhost:7474/db/data/node/1/relationships/out/{-list|&|types}, incoming_relationships:
http://localhost:7474/db/data/node/1/relationships/in, extensions:[:], create_relationship:
http://localhost:7474/db/data/node/1/relationships, paged_traverse:
http://localhost:7474/db/data/node/1/paged/traverse/{returnType}{?pageSize,leaseTime}, all_relationships:
http://localhost:7474/db/data/node/1/relationships/all, incoming_typed_relationships:
http://localhost:7474/db/data/node/1/relationships/in/{-list|&|types}]
But when I try to execute multiple Script using Groovy I am getting a Missing Property exception.
Execution of Multiple Gremlin Script Code Snippet:
def http = new groovyx.net.http.HTTPBuilder()
body: 'script=' + "userid=g.v(45);known_items=[];g.v(45).out('PERFORMS').out('PUCHASED').out('BELONGS_TO').dedup.aggregate(known_items);",
requestContentType: URLENC) { resp,reader ->
println "--------- Printing Status --------"
println "Success! ${resp.status}"
println "----------Printing Content type----------"
println "${resp.headers.'Content-Type'}"
println "---------------------------------"
println reader
}
Response Obtained when executing Multiple Gremlin Script: The gremlin script has a variable "userid" and "known_items"..
2012-07-19 10:22:22,047 DEBUG wire
- << " "message" : "javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: userid for class: Script2",[\r][\n]"2012-07-19 10:22:22,047 DEBUG wire
- << " "exception" : "org.neo4j.server.rest.repr.BadInputException: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such
property: userid for class: Script2",[\r][\n]"2012-07-19 10:22:22,047
DEBUG wire - << " "stacktrace" : [
"org.neo4j.server.plugin.gremlin.GremlinPlugin.executeScript(GremlinPlugin.java:88)",
"java.lang.reflect.Method.invoke(Unknown Source)",
How to resolve the above mentioned error.
Sample code snippet would help me to solve this issue.
Thanks
Vijay