Hi Jon, yes, this looks like a bug, could you please file one? have done a gist on it, see http://gist.neo4j.org/?8667135
/peter G: neubauer.peter S: peter.neubauer P: +46 704 106975 L: http://www.linkedin.com/in/neubauer T: @peterneubauer Neo4j 2.0.0 - (graphs)-[:FOR]->(everyone)<http://blog.neo4j.org/2013/12/neo4j-20-ga-graphs-for-everyone.html> Kids LAN creative party in Malmö - Kidscraft ICE <http://kidscraft.se> On Mon, Jan 27, 2014 at 4:40 PM, Jon Packer <[email protected]> wrote: > Hi! > > I'm trying to do some property updates with an OPTIONAL MATCH, and having > a bit of trouble. It's OK when the OPTIONAL MATCH's pattern matches > something, but when it doesn't, I get a "ThisShouldNotHappenError" with > the message "Developer: Stefan claims that: This should be a node or a > relationship". > > For example, given a graph that looks something like this: > > (node:TestThing1)-[:rel1]->(node2)-[:rel2]->(node3) > > The following works: > > MATCH (n:TestThing1) OPTIONAL MATCH n-[:rel1]->x SET x.updated = > timestamp() > > but the following will throw the aforementioned exception: > > MATCH (n:TestThing1) OPTIONAL MATCH n-[:rel2]->x SET x.updated = > timestamp() > > I would have expected that it would silently do nothing at all when the > OPTIONAL MATCH condition does not match anything, or to have to > explicitly specify that the SET should not proceed when "x" is null. As far > as I can tell there's no way for me to do the latter without affecting > "n"'s value. > > I am using OPTIONAL MATCH because this is in the context of a larger > query, which I've omitted here for clarity's sake, but for that reason I > can't solve this problem by just using a normal MATCH instead. > > -- > 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.
