Skip to content

Instantly share code, notes, and snippets.

Bestuurders Beursgenoteerde bedrijven in Neo4j - Intro

Origineel onderzoek - vorige edities

Uit 2018

Conversie naar Google Sheet

Om makkelijk online beschikbaar te zijn: import in Google sheets. Automatisch conversie terug naar .csv daardoor. Volledige google sheet staat hier.

Twee sheets:

How to convert a contact tracing graph into a recommendation graph

Creating the contact tracing graph with faker

Using the Neo4j plugin that allows for creating fake data with the "faker library": plugin over here

Persons using faker

foreach (i in range(1,5000) |
//find at https://github.com/neo4j-contrib/neo4j-faker
//release at https://github.com/neo4j-contrib/neo4j-faker/releases
//unzip: place the contents of the "dist" directory in the "plugins" directory of your neo4j server
// add property: dbms.security.procedures.unrestricted=apoc.*,gds.*,fkr.* to neo4j.conf in the conf directory
@rvanbruggen
rvanbruggen / 1-contacttracing-import.cql
Last active August 18, 2022 16:11
Contact tracing example #cypher #neo4j
//environment: Neo4j Desktop 1.2.7, Neo4j Enteprise 3.5.17, apoc 3.5.0.9, gds 1.1.0
//or: Neo4j Enterprise 4.0.3, apoc 4.0.0.6 (NOT later! a bug in apoc.coll.max/apoc.coll.min needs to be resolved)
//contact tracing data import
//full spreadsheet with synthetic data
//https://docs.google.com/spreadsheets/d/1R-XVuynPsOWcXSderLpq3DacZdk10PZ8v6FiYGTncIE/edit#gid=0
// person sheet˝
// https://docs.google.com/spreadsheets/u/0/d/1R-XVuynPsOWcXSderLpq3DacZdk10PZ8v6FiYGTncIE/export?format=csv&id=1R-XVuynPsOWcXSderLpq3DacZdk10PZ8v6FiYGTncIE&gid=0
@rvanbruggen
rvanbruggen / 1-scm-background.txt
Last active January 10, 2024 02:42
Supply Chain Management Example in Neo4j
// 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
**WORKING WITH CONFLICTING PRIVILEGES
// Fraud database available FROM
// https://drive.google.com/open?id=1jWJrIFdv8tNECLn-nV4HJqotF1db3m6D
//work with a separate user and a role to experiment with conflicting roles
CREATE USER conflicted_user SET PASSWORD "changeme" CHANGE NOT REQUIRED;
CREATE ROLE conflicted_role AS COPY OF reader;
GRANT ROLE conflicted_role TO conflicted_user;
//create conflicting privileges
// Fraud database available FROM
// https://drive.google.com/open?id=1jWJrIFdv8tNECLn-nV4HJqotF1db3m6D
//what is related and how
match (n1)-[r]->(n2)
return distinct labels(n1) as `1st Label`, type(r) as `RelType`, labels(n2) as `2nd Label`
order by `1st Label`;
╒═════════════════╤═══════════════════╤══════════════════════╕
│"1st Label" │"RelType" │"2nd Label" │
@rvanbruggen
rvanbruggen / securing the beergraph.cql
Created January 29, 2020 19:35
Securing the beergraph with Neo4j 4.0
//create database
create database beergraph;
create index on :BeerBrand(name);
create index on :BeerType(name);
create index on :Brewery(name);
create index on :AlcoholPercentage(value);
//Automated import in one query
load csv with headers from
@rvanbruggen
rvanbruggen / 1-HRC email corpus import.cql
Last active January 12, 2022 07:27
HRC email corpus as a graph - with NLP
//setting up the indexes
create constraint on (p:Person)
assert p.alias is unique;
create constraint on (e:Email)
assert e.id is unique;
create index on :Email(subject);
// Creating the graph
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "https://s3-us-west-2.amazonaws.com/neo4j-datasets-public/Emails-refined.csv" AS line
@rvanbruggen
rvanbruggen / 0-carrefour dataset.txt
Last active November 27, 2019 17:39
Carrefour data challenge in Neo4j
I have put the dataset on a google drive for download:
* the cleaned up JSON file: https://drive.google.com/file/d/1wDNAMFk_3-H1l44ID4P6fcE6K7cvG9iX/view?usp=sharing
* the ZIP of the cleaned up JSON file: https://drive.google.com/file/d/1xn2HC5APrZuoo6Tb51T5DSHbs4RArKKg/view?usp=sharing