2017-11-08 2 views
1

"Cypher"에 "Neo4j"문을 작성하여 노드를 작성하려고합니다. 원하는 것은 변수를 선언하고 값을 할당 한 다음 명령문에 직접 값을 할당하는 대신 명령문에 변수를 전달하려는 것입니다. 아래에 성명서의 작동 명세서와 원하는 형식을 기재했습니다. 어떤 도움을 주시면 감사하겠습니다.변수를 선언하고 Neo4j의 cypher를 사용하여 명령문을 전달하는 방법

내 작업 문 :

CREATE (n:Customers {Name:"Bharath" , GoestoRetailer: "Prestige 
    Store"}) 
    WITH n 
    MATCH(c:Customers) 
    WITH c 
    MATCH (r:Retailer) WHERE r.StartTime = "9:00 AM" and r.Name 
    contains c.GoestoRetailer 
    CREATE (r)-[:NineDelivery]->(c) 

필수 문장 형식 :

// Declaration of variables 
    WITH cName = "Bharath" as cName 
    WITH rName = "Prestige Store" as rName 
    WITH openingTime = "9:00 AM" as openingTime 
    CREATE (n:Customers {Name: cName, GoestoRetailer: rName}) 
    WITH n.CustomerName = cName 
    WITH n 
    MATCH(c:Customers) 
    WITH c 
    //Condition 
    MATCH (r:Retailer) WHERE r.StartTime = openingTime and r.Name 
    contains c.GoestoRetailer 
    //Action 
    CREATE (r)-[:NineDelivery]->(c) 

답변

0

난 당신이 단순히 등으로 사용할 수있을 것 같아요 :

WITH "Bharath" as cName, "Prestige Store" as rName, "9:00 AM" as openingTime 
CREATE (n:Customers {Name: cName, GoestoRetailer: rName}) 
(...) 
+1

이 작동합니다. 대단히 감사합니다 !!! – bharry29

+0

@ bharry29 또한 [매개 변수 neo4j] (https://neo4j.com/docs/developer-manual/current/cypher/syntax/parameters/)에 대한 설명서를 살펴보십시오. 브라우저를 통한 일회성 쿼리 만이 아닙니다. – InverseFalcon

관련 문제