Skip to content

Instantly share code, notes, and snippets.

View mbusch's full-sized avatar

Maximilian Busch mbusch

View GitHub Profile
@mbusch
mbusch / beginning-neo4j-importing-relationships.cql
Last active January 28, 2016 08:29
Fixed version of importing snippet (tested with Neo4j 2.3.2)
USING PERIODIC COMMIT 500
LOAD CSV WITH HEADERS FROM 'file:///home/mbusch/neo4j-playground/beginning_neo4j_example.csv' AS row
MATCH (p:Person {id: row.id})
MATCH (friend:Person {id: row.friend_id})
WHERE row.friend_id IS NOT NULL
MERGE (p)-[f:FRIENDS_WITH]->(friend);
@mbusch
mbusch / ecommerce-example-beginnning-neo4j.cql
Created January 14, 2016 10:09 — forked from chrisdkemper/ecommerce-example-beginnning-neo4j.cql
This is an example Ecommerce data structure from the book Beginning Neo4j (tested with Neo4j v2.2.8)
//Add some contstraints for good measture, constraints must be ran individually
CREATE CONSTRAINT ON (c:Customer) ASSERT c.email IS UNIQUE;
CREATE CONSTRAINT ON (p:Product) ASSERT p.uuid IS UNIQUE;
//:Start Product and customer query:
//Products, bundles and categories
CREATE (product1:Product {name: "Product 1", uuid: "d8d177cc-1542-11e5-b60b-1697f925ec7b", price: 10})
CREATE (product2:Product {name: "Product 2", uuid: "d8d17b28-1542-11e5-b60b-1697f925ec7b", price: 20})
CREATE (product3:Product {name: "Product 3", uuid: "d8d17c72-1542-11e5-b60b-1697f925ec7b", price: 30})