Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
09-15-2018 04:41 AM
Dear all,
i have problems, creating my first graph database by generating a relation between two nodes.
Here you find the two relevant tables in the ERD in red:
After creating two Cyhper statements to import a CSV, I am not able to link those two nodes.
Here you can find my cypher query:
<
// ***IMPORT DATA***
// Create payment
LOAD CSV WITH HEADERS FROM "http://www.fimojules.at/data/payment.csv" AS row
CREATE (n:PAYMENT)
SET n = row
, n.AMOUNT = toFloat(row.AMOUNT)
, n.PAYMENT_DATE = row.PAYMENT_DATE
, n.LAST_UPDATE = row.LAST_UPDATE
// Foreign Keys: customer_id, staff_id, rental_id
// Create customer
LOAD CSV WITH HEADERS FROM "http://www.fimojules.at/data/customer.csv" AS row
CREATE (n:CUSTOMER)
SET n = row
, n.FIRST_NAME = row.FIRST_NAME
, n.LAST_NAME = row.LAST_NAME
, n.EMAIL = row.EMAIL
, n.ACTIVE = row.ACTIVE
, n.CREATE_DATE = row.CREATE_DATE
, n.LAST_UPDATE = row.LAST_UPDATE
// Foreign Keys: adress_id, store_id
// ***CREATE INDEX***
CREATE INDEX ON :PAYMENT(PAYMENT_ID);
CREATE INDEX ON :CUSTOMER(CUSTOMER_ID);
Those queries work and all nodes are generated. But if I am trying to create a property with:
// CREATE RELATIONSHIP
// Payment -> Customer
MATCH (p:PAYMENT), (c:CUSTOMER)
WHERE p.PAYMENT_ID = c.PAYMENT_ID
CREATE (p)-[:PAYED]->(c)
No operations are performed. Does someone has an idea, why no relation is created.
Following characteriscs are used:
Solved! Go to Solution.
09-15-2018 05:56 AM
Problem is solved. I used the wrong relation.
With this code it works:
MATCH (p:PAYMENT), (c:CUSTOMER)
WHERE p.CUSTOMER_ID = c.CUSTOMER_ID
CREATE (p)-[:PAYED]->(c)
09-15-2018 05:56 AM
Problem is solved. I used the wrong relation.
With this code it works:
MATCH (p:PAYMENT), (c:CUSTOMER)
WHERE p.CUSTOMER_ID = c.CUSTOMER_ID
CREATE (p)-[:PAYED]->(c)
All the sessions of the conference are now available online