Skip to content

Instantly share code, notes, and snippets.

Avatar

Rik Van Bruggen rvanbruggen

View GitHub Profile
@rvanbruggen
rvanbruggen / graphtechnologygraph_import.cypher
Last active Jul 29, 2021
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
View 1-browser_guide-contacttracing_with_relationship_indexes.mdx

Revisiting contact tracing with Neo4j 4.3's relationship indexes

New release of Neo4j 4.3 came out. One of the key features are relationship property indexes - a really interesting feature.

Two main points of attention:

  1. Performance improvements: all of a sudden the Neo4j Cypher query planner is going to be able to use a lot more information, provided by these relationship indexes. The planner is becoming smarter - and therefore queries will become faster. We will explore this below.
  2. Modelling implications: the introduction of these indexes will have far-reaching implications with regards to how we model certain things. More options are good, of course!
View guide_to_shakespeare.mdx

Network Analysis of Shakespeare's plays

What do you do when a new colleague starts to talk to you about how they would love to experiment with getting a dataset about Romeo & Juliet into a graph? Yes, that's right, you get your graph boots on, and you start looking out for a great dataset that you could play around with. And as usual, one things leads to another (it's all connected, remember!), and you end up with this incredible experiment that twists, turns and meanders into something fascinating. That's what happened here too. William Shakespeare

Finding a Data source

That was so easy. I very quickly located a Dataset on Kaggle that I thought would be really interesting. It's a comma-separated file, about 110k lines long and 10MB in size, that holds all the lines that Shakespeare wr

@rvanbruggen
rvanbruggen / 1-scm-background.txt
Last active Jun 17, 2021
Supply Chain Management Example in Neo4j
View 1-scm-background.txt
// Found article on https://or.stackexchange.com/questions/529/supply-chain-public-data-repository
// https://pubsonline.informs.org/doi/suppl/10.1287/msom.1070.0176
// https://pubsonline.informs.org/doi/suppl/10.1287/msom.1070.0176/suppl_file/msom.1070.0176-sm-datainexcel.zip
//Article by Sean P. Willems: https://pdfs.semanticscholar.org/232c/451fcf58dbcc1527de6d02cd6e76aea9e871.pdf?_ga=2.33151675.429569592.1581427039-1552162479.1581427039
Table 2 Classifications Used to Label Every Stage in the Chains
Classifications label Activity
Dist_ A stage that distributes an item
Manuf_ A stage that manufactures or assembles an item
Part_ A stage that procures an item
@rvanbruggen
rvanbruggen / foodimport.cql
Last active May 1, 2021
Food network import instructions
View foodimport.cql
// create nodes
// create BaseNodes
import-cypher -d ; -i ./IMPORT/INPUT/1-basenodes.csv -o ./IMPORT/OUTPUT/nodeoutput.csv create (n:#{type} {id:{id},name:{name}}) return n
// create indexes
create index on :INGREDIENT_CATEGORY(name);
create index on :INGREDIENT(name);
create index on :INGREDIENT(id);
create index on :COMPOUND(name);
create index on :COMPOUND(id);
@rvanbruggen
rvanbruggen / 1-newsanalysis.md
Last active Apr 26, 2021
News Analysis with Neo4j, APOC and Google Cloud NLP
View 1-newsanalysis.md
@rvanbruggen
rvanbruggen / GRAPHS FOR HR ANALYTICS
Last active Apr 9, 2021
Graphs for HR Analytics
View GRAPHS FOR HR ANALYTICS
This gist explains how a graph database can help for HR analytics. There are two files included:
- load the data.cql: this file contains the cypher statements that load the data into neo4j
- query the data.cql: this file has some sample queries that serve to demonstrate some of the concepts.
Hope this is useful.
Rik
@rvanbruggen
rvanbruggen / loadgtfs.cql
Last active Feb 17, 2021
Loading and Querying GTFS data
View loadgtfs.cql
//LOAD CSV script for GFTS data
create constraint on (a:Agency) assert a.id is unique;
create constraint on (r:Route) assert r.id is unique;
create constraint on (t:Trip) assert t.id is unique;
create index on :Trip(service_id);
create constraint on (s:Stop) assert s.id is unique;
create index on :Stoptime(stop_sequence);
create index on :Stop(name);
schema await
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);