You can return count(*)

which would be 0 for the case that it didn't match
and 1 for the cases it matched.

you could even do

with count(*) as c
return c = 1 as successful

Afaik there are no plans for providing expected results (esp, as those can
grow gigantic).

On Wed, Nov 12, 2014 at 11:27 PM, Byron Ruth <[email protected]> wrote:

> I am submitting Cypher queries over the HTTP transactional endpoint in
> batches and began using a pattern of adding an expected value as part of my
> query. For example, a query like this:
>
> MATCH (s {foo: 1}),
>       (e {bar: 1})
> CREATE (s)-[:LINKS]->(e)
> RETURN 1
>
> would be submitted as:
>
> {
>     "statement": <query>,
>     "parameters": null,
>     "expected": 1
> }
>
> the Neo4j client I wrote inspects the result and determines in it matches
> the expected result. The reason this is necessary is because if either
> MATCH fails, the CREATE will not occur and nothing will be returned.
> Since an error is not raised, I use the RETURN 1 as a sentinel for
> determining whether the query completely executed.
>
> I was curious if the Neo4j team had any plans for providing a return value
> for Cypher query execution. Or consider an approach like this in which an
> agent can declare an expected value.
>
> --
> 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/d/optout.
>

-- 
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/d/optout.

Reply via email to