Skip to content

Instantly share code, notes, and snippets.

Rik Van Bruggen rvanbruggen

Block or report user

Report or block rvanbruggen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View 20160803 graphgems.cql
//GRAPHGEMS
//10 (?) cypher queries that will blow your mind
//1. The meta-graph
MATCH (a)-[r]->(b)
WITH labels(a) AS a_labels,type(r) AS rel_type,labels(b) AS b_labels
UNWIND a_labels as l
UNWIND b_labels as l2
MERGE (a:Meta_Node {name:l})
MERGE (b:Meta_Node {name:l2})
@rvanbruggen
rvanbruggen / graphtechnologygraph_import.cypher
Last active Aug 20, 2019
Graph Technology Landscape Graph
View graphtechnologygraph_import.cypher
create index on :Node(name);
//load the data in raw form
Load csv with headers from "https://docs.google.com/spreadsheets/u/0/d/17WuC_B8RWzsSS8pw-NtY8qWeFFQGCGnCR5uXmENOFUI/export?format=csv&id=17WuC_B8RWzsSS8pw-NtY8qWeFFQGCGnCR5uXmENOFUI&gid=112267709" as csv
Merge (n:Node {name: csv.Name, type: csv.Type, tags: csv.Tags, link: csv.Link});
// move the 'type' property to a label and remove it as a property, USING APOC (not supported in Graphgist)
MATCH (n:Node)
with n, split(n.type, ",") AS futurelabels
unwind futurelabels as futurelabel
@rvanbruggen
rvanbruggen / import and clean data.cql
Last active Nov 28, 2018
ICIJ Medical Devices Dataset
View import and clean data.cql
//import the 3 csv files
USING PERIODIC COMMIT
LOAD CSV with headers from "https://docs.google.com/uc?export=download&id=1hNtMWHjrqOiMXU_xN7digO74ruzgCDeC" as line
CREATE (d:Device)
set d = line;
USING PERIODIC COMMIT
LOAD CSV with headers from "https://docs.google.com/uc?export=download&id=1lrMQNAF9k2ZeJJgfite85cvlHYpC7Ax8" as line
CREATE (e:Event)
set e = line;
@rvanbruggen
rvanbruggen / 1 - loadlineagedata.cql
Last active Oct 31, 2018
Demonstration of how to use the Neo4j Graph Database for Data Lineage
View 1 - loadlineagedata.cql
//load nodes
LOAD CSV WITH HEADERS FROM "https://docs.google.com/spreadsheets/u/0/d/1eL3IrbzgvZzkNnQUwDCZ1mwVfA6sypZYvDHBoeq48IM/export?format=csv&id=1eL3IrbzgvZzkNnQUwDCZ1mwVfA6sypZYvDHBoeq48IM&gid=0" AS csv
CALL apoc.create.nodes([csv.Label], [{id: csv.ID, name: csv.Name}]) YIELD node
RETURN count(node);
MATCH (n)
SET n:Node;
CREATE INDEX ON :Node(id);
@rvanbruggen
rvanbruggen / create_gped_db.cql
Last active Oct 19, 2018 — forked from jexp/graph_gist_template.adoc
Global Emission Power Database
View create_gped_db.cql
//create indexes
create index on :Classification(name);
create index on :SubClassification(name);
create index on :FuelType(name);
create index on :Country(name);
create index on :Plant(name);
create index on :Plant(id);
//FROM FUELTYPE TAB
@rvanbruggen
rvanbruggen / create_graphconnectgraph.cql
Last active Sep 18, 2018
GraphConnectGraph New York City 2018
View create_graphconnectgraph.cql
//import graphconnect 2018
create constraint on (s:Session)
assert s.event_key is unique;
create index on :Event_Type(name);
create index on :Session(name);
create index on :Speaker(name);
create index on :Tag(name);
create index on :Venue(name);
//import the sessions
@rvanbruggen
rvanbruggen / import_ROME.cql
Created Aug 29, 2018
Import ROME dataset into Neo4j
View import_ROME.cql
//import rome tree into Neo4j
load csv with headers from "https://docs.google.com/spreadsheets/d/1ks_hjKbO-n2We2glViM5D9RixU1ZtPi-0f7rJbfAY00/export?format=csv&id=1ks_hjKbO-n2We2glViM5D9RixU1ZtPi-0f7rJbfAY00&gid=744365839" as row
create (l:Leaf)
set l = row;
//set up the indexes
create index on :Leaf(Main);
create index on :Leaf(Category);
create index on :Leaf(Subcategory);
create index on :Leaf(Description);
View import_ESCO_csv_en.cql
//Import ESCO using CSV files
create index ON :Occupation(ISCOGroup);
create index ON :Occupation(altLabels);
create index ON :Skill(altLabels);
create index ON :ISCOGroup(code);
create index ON :Skill(conceptUri);
create index ON :ISCOGroup(conceptUri);
create index ON :Occupation(conceptUri);
create index ON :Occupation(preferredLabel);
create index ON :Skill(preferredLabel);
@rvanbruggen
rvanbruggen / load_openbeerdb.cql
Last active Jun 13, 2018
Working with OpenBeerDB in Neo4j
View load_openbeerdb.cql
//open beer database can be found at
//import script from https://github.com/aicfr/neo4j-openbeerdb
LOAD CSV WITH HEADERS FROM 'https://raw.githubusercontent.com/aicfr/neo4j-openbeerdb/master/beerers.csv' AS row
CREATE (:Beerer { beererID: toInteger(row.id), beererName: row.name, location: row.location, description: row.descript, website: row.website, picture: row.picture });
LOAD CSV WITH HEADERS FROM 'https://github.com/aicfr/neo4j-openbeerdb/raw/master/beers.csv' AS row
CREATE (:Beer { beerID: toInteger(row.id), beerName: row.name, description: row.descript, abv: toFloat(row.abv) });
LOAD CSV WITH HEADERS FROM 'https://github.com/aicfr/neo4j-openbeerdb/raw/master/breweries.csv' AS row
@rvanbruggen
rvanbruggen / nextbuildschedule.adoc
Last active May 19, 2017
NextBuild Schedule Graph
View nextbuildschedule.adoc

The NextBuild 2017 Schedule Graph

Tomorrow I am presenting at the NextBuild conference in Eindhoven - you can see more info over here. Of course I am going to be talking a lot about Neo4j and just for fun, I decided to put the conference schedule in this graph.

A Google Sheet as the main repository

I had to of course start from the schedule on the NextBuild website, and convert that into a google sheet with all the data. Once I had that, I could add the data pretty easily.

You can’t perform that action at this time.