On Donnerstag, 13. Juni 2013 21:15:47, Peter Neubauer wrote:
> Michal,
> CREATE UNIQUE is going away and replace by MERGE, which supports
> non-connected nodes, giving you exactly what you want. then, you can
> even react on the creation or non-creation of the relationship with ON
> CREATE etc, see
>
http://docs.neo4j.org/chunked/snapshot/query-merge.html#merge-merge-single-node-specifying-both-label-and-property
>
> Does that help?
>
> /peter
>
>
> Cheers,
>
> /peter neubauer
>
> G: neubauer.peter
> S: peter.neubauer
> P: +46 704 106975
> L:
http://www.linkedin.com/in/neubauer
> T: @peterneubauer
>
> Kids in Malmö this summer? -
http://www.kidscraft.se
> Neo4j questions? Please use SO -
http://stackoverflow.com/search?q=neo4j
>
>
> On Tue, May 14, 2013 at 4:07 PM, Michael B. <
wtfstfu...@gmail.com
> <mailto:
wtfstfu...@gmail.com>> wrote:
>
> Hi Peter,
>
> merge is way more appropirate.
>
> The issue I'm working around here is that for the create unique
> statement, if the relationship doesn't exist, the second node is
> *always *created along. For example:
>
> |
> start n=node(0)
> create unique n-[:r]->(x {a:'b'})
> |
>
> This would create new x node anew. If you want to use an existing
> node, but only create the relationship */r/* if it doesn't exist
> yet, you have to query for it separately. This is what my query
That's nice. I was just looking at this sort of thing today... Needed
to make sure the relationships get a weight property on creation. With
merge and on create, this'll probably be way more convenient.
Although from my p.o.v. this isn't the most pressing issue. The locking
of non-existent nodes in a multi-threaded environment for these
merge-statements should have priority. So far, I've tried a whole bunch
of different approaches for batch loading unique nodes in a
multi-client environment and haven't been able to get good performance.
Regards,
Michael
> from the first post does.
>
> Just looking into the options here... what would perform best?
>
>
> On Tuesday, 14 May 2013 14:55:47 UTC+2, Peter Neubauer wrote:
>
> Michael,
> in Neo4j 2.0, there are a number of better ways to do this see
> MERGE
> and CREATE UNIQUE,
>
>
http://docs.neo4j.org/chunked/__preview/query-create-unique.__html
> <
http://docs.neo4j.org/chunked/preview/query-create-unique.html>
>
http://docs.neo4j.org/chunked/__preview/query-merge.html
> P: +46 704 106975 <tel:%2B46%20704%20106975>
> L:
http://www.linkedin.com/in/__neubauer
>
http://stackoverflow.com/__search?q=neo4j
> > START x=node:node_auto_index(key="x"__)
> > with count(x) as exists
> > start y=node:node_auto_index(key="y"__)
> > where exists = 0
> > create (n {key:"y"})<-[:rel]-y
> > return n, y
> >
> >
> > It's kind of hard to make sure that nodes exist before
> performing further
> > operations on them. With 2.0 this might be a bit nicer with
> if-then-else
> > statements...
> >
> > Regards,
> > Michael
> >
> > --
> > 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 neo4j+un...@__
googlegroups.com.
> > For more options, visit
>
https://groups.google.com/__groups/opt_out
> <
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
neo4j+un...@googlegroups.com
> <mailto:
neo4j%2Bunsu...@googlegroups.com>.
> You received this message because you are subscribed to a topic in the
> Google Groups "Neo4j" group.
> To unsubscribe from this topic, visit
>
https://groups.google.com/d/topic/neo4j/VN5bR07PkGw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to