Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST Batch mode error on creating a relationship to unique node multiple times #130

Closed
lassewesth opened this issue Nov 12, 2012 · 7 comments

Comments

@lassewesth
Copy link
Member

@maxdemarzi: 'See => maxdemarzi/neography#40

If you create a unique node and then try to add it to a relationship, it seems to work the first time.
But if you try to create a unique node a second time and try to add it to a relationship, it doesn't work.

      batch_result = @neo.batch [:create_node, {:street1=>"94437 Kemmer Crossing", :street2=>"Apt. 333", :city=>"Abshireton", :state=>"AA", :zip=>"65820", :_type=>"Address", :created_at=>1335269478}],
                                [:add_node_to_index, "person_ssn", "ssn", "000-00-0001", "{0}"],
                                [:create_unique_node, "person", "ssn", "000-00-0001", {:first_name=>"Jane", :last_name=>"Doe", :ssn=>"000-00-0001", :_type=>"Person", :created_at=>1335269478}],
                                [:create_relationship, "has", "{0}", "{2}", {}]   
      puts batch_result.inspect
<- "POST /db/data/batch HTTP/1.1\r\nContent-Type: application/json\r\nConnection: close\r\nHost: localhost:7474\r\nContent-Length: 611\r\n\r\n"
<- "[{\"id\":0,\"method\":\"POST\",\"to\":\"/node/\",\"body\":{\"street1\":\"94437 Kemmer Crossing\",\"street2\":\"Apt. 333\",\"city\":\"Abshireton\",\"state\":\"AA\",\"zip\":\"65820\",\"_type\":\"Address\",\"created_at\":1335269478}},{\"id\":1,\"method\":\"POST\",\"to\":\"/index/node/person_ssn\",\"body\":{\"uri\":\"{0}\",\"key\":\"ssn\",\"value\":\"000-00-0001\"}},{\"id\":2,\"method\":\"POST\",\"to\":\"/index/node/person?unique\",\"body\":{\"key\":\"ssn\",\"value\":\"000-00-0001\",\"properties\":{\"first_name\":\"Jane\",\"last_name\":\"Doe\",\"ssn\":\"000-00-0001\",\"_type\":\"Person\",\"created_at\":1335269478}}},{\"id\":3,\"method\":\"POST\",\"to\":\"{0}/relationships\",\"body\":{\"to\":\"{2}\",\"type\":\"has\",\"data\":{}}}]"
-> "HTTP/1.1 500 Internal Server Error\r\n"
-> "Content-Length: 16077\r\n"
-> "Content-Encoding: UTF-8\r\n"
-> "Content-Type: application/json\r\n"
-> "Access-Control-Allow-Origin: *\r\n"
-> "Connection: close\r\n"
-> "Server: Jetty(6.1.25)\r\n"
-> "\r\n"
reading 16077 bytes...
-> "{\n  \"message\" : \"{\\n  \\\"message\\\" : \\\"For input string: \\\\\\\"{2}\\\\\\\"\\\",\\n  \\\"exception\\\" : \\\"org.neo4j.server.rest.repr.BadInputException: For input string: \\\\\\\"{2}\\\\\\\"\\\",\\n  \\\"stacktrace\\\" : [ \\\"org.neo4j.server.rest.web.RestfulGraphDatabase.extractNodeId(RestfulGraphDatabase.java:162)\\\", \\\"org.neo4j.server.rest.web.RestfulGraphDatabase.createRelationship(RestfulGraphDatabase.java:388)\\\", \\\"sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)\\\", \\\"sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)\\\", \\\"java.lang.reflect.Method.invoke(Method.java:597)\\\", \\\"com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)\\\", \\\"com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)\\\", \\\"com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)\\\", \\\"com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)\\\", \\\"com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)\\\", \\\"com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)\\\", \\\"com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)\\\",
```'
@lassewesth
Copy link
Member Author


values:

@lassewesth
Copy link
Member Author

@jexp: You mean when you execute the whole request a second time? B/c I cannot see two unique nodes commands in that single request.

@lassewesth
Copy link
Member Author

@maxdemarzi: Right. After the node already exists and the create unique node command is returning a known node.

@smnplk
Copy link

smnplk commented Feb 21, 2013

Are there any workarounds for this issue at the moment ? I really need the batch facility to work.

@maxdemarzi
Copy link
Contributor

Try this in 1.9, the engineers tell me it has been fixed in that version.

@simpsonjulian
Copy link
Contributor

Hey, @smnplk, did you try this in 1.9?

@jakewins
Copy link
Contributor

jakewins commented Dec 5, 2015

Closing this as it's been idle for this should be resolved - please open back up if issue remains.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants