CALL com.maxdemarzi.similarity(0.90, 100)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE (person1:Person {name: "Max"}) | |
CREATE (person2:Person {name: "Alex"}) | |
CREATE (person3:Person {name: "Andrew"}) | |
CREATE (floor1:Floor {name: "Floor 1"}) | |
CREATE (floor2:Floor {name: "Floor 2"}) | |
CREATE (person1)-[:SITS_IN]->(floor1) | |
CREATE (person2)-[:SITS_IN]->(floor1) | |
CREATE (person3)-[:SITS_IN]->(floor2) | |
CREATE (room1:Room {name:"Room 1"}) | |
CREATE (room2:Room {name:"Room 2"}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE (f1:Family {id:'f1'}) | |
CREATE (f2:Family {id:'f2'}) | |
CREATE (f3:Family {id:'f3'}) | |
CREATE (a1:Asset {id:'a1'}) | |
CREATE (a2:Asset {id:'a2'}) | |
CREATE (a3:Asset {id:'a3'}) | |
CREATE (a4:Asset {id:'a4'}) | |
CREATE (a5:Asset {id:'a5'}) | |
CREATE (a6:Asset {id:'a6'}) | |
CREATE (a7:Asset {id:'a7'}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.maxdemarzi.imports; | |
import com.github.benmanes.caffeine.cache.Caffeine; | |
import com.github.benmanes.caffeine.cache.LoadingCache; | |
import com.maxdemarzi.schema.Labels; | |
import com.maxdemarzi.schema.RelationshipTypes; | |
import org.apache.commons.csv.CSVFormat; | |
import org.apache.commons.csv.CSVRecord; | |
import org.neo4j.graphdb.*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Setup Template Engine | |
use(new Rockerby()); | |
RockerRuntime.getInstance().setReloading(true); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: neo4j-deployment | |
director_uuid: 93c01d2d-a2a5-49d8-8d02-389fd223a9cf | |
releases: | |
- {name: neo4j, version: 2.3.3} | |
networks: | |
- name: my-network | |
type: vip | |
compilation: | |
workers: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab("org.neo4j.driver:neo4j-java-driver:1.0-SNAPSHOT") | |
import org.neo4j.driver.v1.* | |
Driver driver = GraphDatabase.driver( "bolt://localhost" ); | |
Session session = driver.session(); | |
//Result rs = session.run("cypher runtime=compiled MATCH (n:Foo)-[r:NEXT]->(m) RETURN n.id AS n,m.id AS m"); | |
ResultCursor rs = session.run(" MATCH (n) WHERE ID(n) = 0 RETURN id(n) AS n"); |
Use latest Neo4j for best results, e.g. 2.2.2 or 2.3.0-M02 (http://neo4j.com/download) On a machine with 12 cores use concurrency 24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
int i = 0; | |
Transaction tx = db.beginTx(); | |
try { | |
for ( Node node : GlobalGraphOperations.at(db).getAllNodes()) { | |
Date theDate = DATE_FORMAT.parse((String)node.getProperty("my_date_as_string_property", "2099-12-31 12:00:00")); | |
node.setProperty("new_date_as_millis", theDate.getTime()); | |
i++; | |
// Commit every x transactions | |
if (i % 10000 == 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int i = 0; | |
Transaction tx = db.beginTx(); | |
try { | |
for ( Relationship relationship : GlobalGraphOperations.at(db).getAllRelationships()) { | |
// Do some work on relationship property | |
i++; | |
// Commit every x transactions | |
if (i % 10000 == 0) { | |
tx.success(); | |
tx.close(); |