You would also use MERGE for the initial creation

What doesn't work? Did you create the constraint?

Am 10.02.2014 um 12:49 schrieb Aran Mulholland <[email protected]>:

> Just to make it absolutely clear, are you saying when creating the initial 
> node I do:
> 
> MERGE (headNode:HEAD {list:"mylist"})
CREATE (headNode)-[:LINK]->(headNode)
> 
> 
> But when inserting I do:
> 
> MERGE (headNode:HEAD {list:"mylist"})
> WITH headNode                                     //had to add this line, 
> cause I got an error WITHout it :)
> MATCH (headNode)-[old:LINK]->after 
> DELETE old
> CREATE headNode-[:LINK]->(newNode:LINKNODE { number : {nodeNumber} 
> })-[:LINK]->after
> 
> Sorry for the re-clarification (I'm feeling a little dense here). The reason 
> I am asking is that it doesn't work, so I must have mis-understood you 
> somewhere.
> 
> 
> 
> 
> On Mon, Feb 10, 2014 at 10:30 PM, Michael Hunger 
> <[email protected]> wrote:
> Only with unique constraints, merge takes a global lock on the label + 
> property.
> 
> Michael
> 
> Am 10.02.2014 um 12:17 schrieb Aran Mulholland <[email protected]>:
> 
>> Why do you need the unique constraint?
>> 
>> 
>> On Mon, Feb 10, 2014 at 9:52 PM, Michael Hunger 
>> <[email protected]> wrote:
>> I think you have to change it to use merge which takes a schema index lock.
>> 
>> ie.
>> 
>> create constraint on (h:HEAD) assert h.list is unique;
>> 
>>> MERGE (headNode:HEAD {list:"mylist"})
>>    MATCH (headNode)-[old:LINK]->after
>>> DELETE old
>>> CREATE headNode-[:LINK]->(newNode:LINKNODE { number : {nodeNumber} 
>>> })-[:LINK]->after
>> 
>> 
>> 
>> HTH
>> 
>> Michael
>> 
>> Am 10.02.2014 um 11:30 schrieb Aran Mulholland <[email protected]>:
>> 
>>> I've got some real headaches inserting into linked lists.
>>> 
>>> If I create a node as such:
>>> 
>>> CREATE (headNode:HEAD)-[:LINK]->(headNode)
>>> 
>>> then insert like so 
>>> 
>>> MATCH (headNode:HEAD)-[old:LINK]->after
>>> DELETE old
>>> CREATE headNode-[:LINK]->(newNode:LINKNODE { number : {nodeNumber} 
>>> })-[:LINK]->after
>>> 
>>> then everything is fine and dandy. But when I try to run the insertion code 
>>> in parallel, then I get some real issues. I either get an error like 
>>> "Relationship 325457 not found" or I get two or more lists coming off the 
>>> headNode. The first error I can deal with as I can rerun the query, the 
>>> second is totally unacceptable as my other queries get very messed up 
>>> results.
>>> 
>>> I am writing for a twitter like service and am using the linked lists so I 
>>> can have a news feed. There is a high possibility that the list will need 
>>> to be added to by more than one user at once, and this chance will grow the 
>>> more users the system has.
>>> 
>>> What I want to be able to do is put a lock around the insertion so that 
>>> this does not happen.
>>> 
>>> How can I better craft my queries so that parallel insertion via cypher 
>>> over REST is sustainable?
>>> 
>>> -- 
>>> 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.
>> 
>> 
>> -- 
>> 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.
> 
> 
> -- 
> 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.

Reply via email to