Hi Michael

Thanks for this it's good to hear how it works. However, it sounds
like correct behaviour has been traded for implementation. I assume
streaming is used because a client might issue a high number of
statements?

Is this behaviour documented anywhere? If not I'll knock up a blog post.

Thanks
Paul


On 24 December 2013 22:17, Michael Hunger
<[email protected]> wrote:
> Hi Paul,
>
> in this endpoint data is streamed from and to the server.
>
> So that the headers for the response are sent immediately, before any query 
> is executed. Then the query results are pulled through lazily and sent to the 
> client.
>
> At any stage errors can happen, parsing, starting the execution or returning 
> results (imagine division by zero in the last row of your results).
> Also this endpoint can consume multiple statements, so the first x might be 
> successful and already stream back data to the client and only the last one 
> might fail. Which is the reported in the errors block.
>
> That's why the request doesn't fail as such but errors are returned. As we 
> never know if there will be any errors when processing the statements and 
> streaming back results or not, so we cannot hold off sending the headers to 
> the client
> before the queries are actually parsed, run and fetched through.
>
>
> HTH
>
> Michael
>
> Am 24.12.2013 um 12:27 schrieb Paul Grenyer <[email protected]>:
>
>> Hi
>>
>> This is my first post and a continuation of a discussion with the
>> @neo4j account on twitter.
>>
>> Having read this web page:
>>
>> http://docs.neo4j.org/chunked/milestone/rest-api-transactional.html
>>
>> I constructed the body of a REST POST to
>> http://<myserver>/db/data/transaction/<tx> like this:
>>
>> {
>>    "statements":[{
>>        "statement":"MATCH (u:User{username:{username}}), (r:Role
>> name:{rolename}})\nCREATE(u)-[:HAS_ROLE]-\u003e(r)",
>>          "parameters":{
>>            "props":{
>>                "username":"user1","rolename":"ROLE_REST_USER"
>>            }
>>        }
>>    }]
>> }
>>
>> I received no error code back from Neo4j by way of the POST. When my
>> update wasn't applied to the database I had to look at the response
>> message to see the problem:
>>
>> {
>>    "commit":"http://localhost:7474/db/data/transaction/32/commit";,
>>    "results":[],
>>    "transaction":{"expires":"Tue,24 Dec 2013 11:16:17+0000"},
>>    "errors":[{
>>        "code":"Neo.ClientError.Statement.ParameterMissing",
>>        "message":"Expected a parameter named username"
>>        }]
>> }
>>
>> With a little bit of guess work I figured that the 'props' element
>> under 'parameters' wasn't required, rejigged the JSON and it worked.
>>
>> However, I'm left thinking that:
>>
>> 1. The documentation at the above link may need correcting (or perhaps
>> I'm just being dumb and missing something).
>> 2. The POST should have returned an error code.
>>
>> What do you guys think?
>>
>>
>> --
>> Thanks
>> Paul
>>
>> Paul Grenyer
>> e: [email protected]
>> b: paulgrenyer.blogspot.com
>> t: pjgrenyer
>>
>> Have you thought what Naked Element could do for you? 
>> http://nakedelement.co.uk/
>>
>> It's time to get technical: http://norfolkdevelopers.com
>>
>> Norfolk Developers Conference is coming: http://nordevcon.com/
>>
>> Enjoyed working with me? Something I could work on? Give me honest,
>> anonymous feedback: https://www.get3sixty.com/:wehop
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Neo4j" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.



-- 
Thanks
Paul

Paul Grenyer
e: [email protected]
b: paulgrenyer.blogspot.com
t: pjgrenyer

Have you thought what Naked Element could do for you? http://nakedelement.co.uk/

It's time to get technical: http://norfolkdevelopers.com

Norfolk Developers Conference is coming: http://nordevcon.com/

Enjoyed working with me? Something I could work on? Give me honest,
anonymous feedback: https://www.get3sixty.com/:wehop

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to