To add to what Michael said, your call to py2Neo would look like the
following.

merge_query = "MATCH (fist:Person), (second:Person) WHERE first.name IN
{names1} and second.names IN {names2} MERGE (first)-[r:KNOWS]-(second) RETURN
r;"

*graph.cypher.execute(merge_query, {name1: "name1_value", name2:
"name2_value"})*

Where graph is an instance of the Graph class in py2neo.


-- Thanks and Regards
   Mahesh Lal


On 18 June 2015 at 12:16, Michael Hunger <[email protected]>
wrote:

> MATCH (fist:Person), (second:Person)
> WHERE first.name IN {names1} and second.names IN {names2}
> MERGE (first)-[r:KNOWS]-(second)
> RETURN r;
>
> names1 and names2 are parameters which are passed as dict with the query
>
> Am 18.06.2015 um 02:00 schrieb Shekar Tippur <[email protected]>:
>
> I am trying to do the merge.
>
> I have neo4j object A and B
>
> I am trying to construct the cypher
>
> newstmt='MATCH (lft ' + A + '),(' + B + ') WHERE Name IN [' + Name + '] 
> CREATE UNIQUE (lft)-[r:KNOWS]->(B) RETURN r'
>
>
> I get a TypeError as A and B are py2neo objects. How do I construct a cypher? 
> I need to type cast this to string somehow.
>
>
> - Shekar
>
>
> On Tuesday, 16 June 2015 23:31:01 UTC-7, Sukaant Chaudhary wrote:
>>
>> Sekhar,
>> Try the following query:
>> MERGE (person:Person {Name:"Shekar", Address:"abc123"}) ON CREATE SET
>> person.kids = 3 RETURN person;
>>
>> Hope this will help !
>>
>> -Sukaant Chaudhary
>> <http://in.linkedin.com/pub/sukaant-chaudhary/33/ba8/479>
>>
>> On Wed, Jun 17, 2015 at 11:51 AM, Shekar Tippur <[email protected]> wrote:
>>
>>> Hello,
>>> I want to create an object only when 2 attributes of the object are
>>> unique
>>>
>>> For example
>>>
>>> the object is
>>>
>>> Person{"Name":"Shekar", "Address":"abc123", "kids":"3"}
>>>
>>> I want to create this node only if name and address do not match with
>>> ore existing records.
>>>
>>> I was trying graph.schema.create_uniqueness_constraint("Person", "Name").
>>> How do I extend this to include address as well.
>>>
>>> - Shekar
>>>
>>> --
>>> 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.
>
>
>  --
> 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