Skip to content

Instantly share code, notes, and snippets.

View lassewesth's full-sized avatar

Lasse Westh-Nielsen lassewesth

View GitHub Profile
@lassewesth
lassewesth / eroad-data-import-cypher-statement
Created July 11, 2018 08:53
A Cypher statement that imports E-road data from a CSV
USING PERIODIC COMMIT 1000
LOAD CSV WITH HEADERS FROM "https://gist.githubusercontent.com/lassewesth/634281cced11147432cf232a2c36e080/raw/1ed1f4fe4ca4c8092bbc8557addd1e5d87316833/eroads.csv" AS row
MERGE (origin:ReferencePlace {name: row.origin_reference_place, country_code: row.origin_country_code})
MERGE (destination:ReferencePlace {name: row.destination_reference_place, country_code: row.destination_country_code})
CREATE (origin)-[:EROAD {road_number: row.road_number, distance: row.distance, watercrossing: row.watercrossing}]->(destination)
WITH "Århus" AS homeTown
MATCH (aarhus:ReferencePlace {name: homeTown})
RETURN aarhus
@lassewesth
lassewesth / gist:e53ef81a86c134c21ec76ac873fdf170
Created July 10, 2018 10:59
E-road data import, Cypher statement
USING PERIODIC COMMIT 1000
LOAD CSV WITH HEADERS FROM "https://gist.githubusercontent.com/lassewesth/634281cced11147432cf232a2c36e080/raw/1ed1f4fe4ca4c8092bbc8557addd1e5d87316833/eroads.csv" AS row
MERGE (origin:ReferencePlace {name: row.origin_reference_place, country_code: row.origin_country_code})
MERGE (destination:ReferencePlace {name: row.destination_reference_place, country_code: row.destination_country_code})
CREATE (origin)-[:EROAD {road_number: row.road_number, distance: row.distance, watercrossing: row.watercrossing}]->(destination)
WITH "Århus" AS homeTown
MATCH (aarhus:ReferencePlace {name: homeTown})
@lassewesth
lassewesth / eroads.csv
Created September 2, 2016 08:35
International E-road Network sections as CSV
road_number origin_country_code origin_reference_place destination_country_code destination_reference_place distance watercrossing
E01 GB Larne GB Belfast 36 false
E01 GB Belfast IRL Dublin 165 false
E01 IRL Dublin IRL Wexford 140 false
E01 IRL Wexford IRL Rosslare 19 false
E01 IRL Rosslare E La Coruña 1002 true
E01 E La Coruña E Pontevedra 128 false
E01 E Pontevedra P Valença do Minho 57 false
E01 P Valença do Minho P Porto 115 false
E01 P Porto P Aveiro 67 false

Keybase proof

I hereby claim:

  • I am lassewesth on github.
  • I am lassewesth (https://keybase.io/lassewesth) on keybase.
  • I have a public key whose fingerprint is 61A9 7CDB 2910 87EF CE9B 98A9 AA2C B33B 0C40 5D9A

To claim this, I am signing this object:

@lassewesth
lassewesth / gist:dad9a7e2c7a85746e115
Created March 6, 2015 10:10
Manifest for Neo4j's Windows Service Wrapper
$ cat windows-service-wrapper-6-SNAPSHOT.jar/META-INF/MANIFEST.MF
Manifest-Version: 1.0
Implementation-Vendor: The Neo4j Graph Database Project
Implementation-Title: Neo4j Windows Wrapper
Implementation-Version: 6-SNAPSHOT
Implementation-Vendor-Id: org.neo4j.app
Built-By: lassewesth
Build-Jdk: 1.7.0_55
Package: org.neo4j.wrapper
Created-By: Apache Maven 3.1.1
@lassewesth
lassewesth / gist:3787137
Created September 26, 2012 10:04
Example of SDN mapping with relationship entities and inheritance
package example;
import com.google.common.base.Function;
import com.sun.istack.internal.Nullable;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.neo4j.graphdb.Direction;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.test.ImpermanentGraphDatabase;
@lassewesth
lassewesth / gist:3774902
Created September 24, 2012 08:23
Spatial example
package spatial;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.test.ImpermanentGraphDatabase;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.neo4j.annotation.GraphId;
@lassewesth
lassewesth / correct_and_fast.patch
Created July 25, 2012 14:19
few changes to get it running properly
Index: src/hu/bme/mit/neo4jmapping/Neo4jMapping.java
===================================================================
--- src/hu/bme/mit/neo4jmapping/Neo4jMapping.java (revision a3b52f74313353aeef22db7776055ed52cf77c2b)
+++ src/main/java/hu/bme/mit/neo4jmapping/Neo4jMapping.java (revision )
@@ -4,7 +4,7 @@
public static void main(String[] args) {
// set database path here
- final String databasePath = "h:/testdb";
+ final String databasePath = "target/testdb";