Skip to content

Instantly share code, notes, and snippets.

View jexp's full-sized avatar
🐉
Watching the chamaeleon.

Michael Hunger jexp

🐉
Watching the chamaeleon.
View GitHub Profile
@jexp
jexp / nfl_draft.adoc
Last active April 13, 2017 09:43 — forked from davidoliverSP2/nfl_draft.adoc
The 2016 NFL Draft

The 2016 NFL Draft

Introduction

@jexp
jexp / neo4j-wait.sh
Created January 19, 2017 15:01 — forked from benbc/neo4j-wait.sh
Example of using curl to wait for a Neo4j server to be up
#!/bin/bash
end="$((SECONDS+10))"
while true; do
[[ "200" = "$(curl --silent --write-out %{http_code} --output /dev/null http://localhost:7474)" ]] && break
[[ "${SECONDS}" -ge "${end}" ]] && exit 1
sleep 1
done
@jexp
jexp / graph_gist_template.adoc
Last active February 22, 2024 17:29 — forked from cheerfulstoic/graph_gist_template.adoc
CHANGEME: GraphGist Template. Fork to make your own, view source to see instruction comments

REPLACEME: TITLE OF YOUR GRAPHGIST

Introduction

@jexp
jexp / summary-stats.adoc
Last active February 6, 2016 17:38 — forked from Btibert3/summary-stats.adoc
Cypher query help: Summary stats for email marketing

Email Marketing Analytics App

Problem Statement

I want to summarize the email engagement for a particular contact in my database. The summary stats that I am looking for are:

@jexp
jexp / gist:26288bfebb15b9ae0b44
Last active February 5, 2016 01:38 — forked from PieterJanVanAeken/gist:6698581
Issue Tracking in Neo4j
= Why JIRA should use Neo4j
:neo4j-version: 2.1.0
== Introduction
There are few developers in the world that have never used an issue tracker. But there are even fewer developers who have ever used an issue tracker which uses a graph database. This is a shame because issue tracking really maps much better onto a graph database, than it does onto a relational database. Proof of that is the https://developer.atlassian.com/download/attachments/4227160/JIRA61_db_schema.pdf?api=v2[JIRA database schema].
Now obviously, the example below does not have all of the features that a tool like JIRA provides. But it is only a proof of concept, you could map every feature of JIRA into a Neo4J database. What I've done below, is take out some of the core functionalities and implement those.
== The data set
@jexp
jexp / 1-loadcsv
Created October 8, 2015 10:39 — forked from rvanbruggen/1-loadcsv
Importing the Belgian Corporate Registry
//load the codes
create index on :CodeCategory(name);
using periodic commit 1000
load csv with headers from
"file:/<path>/sourcecsv/code.csv" as csv
with distinct csv.Category as Category
merge (:CodeCategory {name: Category});
create index on :Code(name);
profile merge (en:Entity { id: "SensitiveData" }) merge (et:Entity { id: "SensitiveData" }) merge (en)-[:SensitiveData]->(et) merge (ept0:Entity { id: "SensitiveData" }) merge (et)-[rtept0:`SensitiveData`]->(ept0) on create set rtept0.SensitiveData = "SensitiveData" on match set rtept0.SensitiveData = rtept0.SensitiveData merge (epv0x0:Entity { id: "SensitiveData" }) merge (epv0x0)-[:SensitiveData]->(ept0) merge (en)-[:`SensitiveData`]->(epv0x0) merge (ept1:Entity { id: "SensitiveData" }) merge (et)-[rtept1:`SensitiveData`]->(ept1) on create set rtept1.SensitiveData = "SensitiveData" on match set rtept1.SensitiveData = rtept1.SensitiveData merge (epv1x0:Entity { id: "SensitiveData" }) merge (epv1x0)-[:SensitiveData]->(ept1) merge (en)-[:`SensitiveData`]->(epv1x0) merge (ept2:Entity { id: "SensitiveData" }) merge (et)-[rtept2:`SensitiveData`]->(ept2) on create set rtept2.SensitiveData = "SensitiveData" on match set rtept2.SensitiveData = rtept2.SensitiveData merge (epv2x0:Entity { id: "SensitiveData" }) set e

Maze with locked doors

Imagine a maze with rooms (nodes) and doors (relationships) between the rooms. The doors to some rooms are locked and their keys are held in other rooms (as properties).

In this gist model of the maze, you can reach room D by following the path A→B→C→A, picking up the key for room D in room B. However it is not possible to reach room F, since the key to room F is in room E, and the key to room E is in room D, and there is no way back from room D to room A, so room E is inaccessible. (Finding the HIDDEN door from room D to room C would make this possible.)

Demo Maze

Is it possible to create queries which take into account the keys that can be picked up on the way? For example:

The GOTO Amsterdam Schedule

This gist is a graph version of the GOTO Amsterdam Schedule that I imported into Neo4j.

The GOTO Amsterdam Graph

First we have to load the data into the graph. This was a bit of work - but not difficult at all:

@jexp
jexp / post.md
Last active August 29, 2015 14:10 — forked from ikwattro/post.md

Discover Graph Databases with Neo4j and PHP

Graph databases are now one of the core technologies of companies dealing with highly connected data.

Business graphs, social graphs, knowledge graphs, interest graphs and media graphs are frequently in the (technology) news. And for a reason. The graph model represents a very flexible way of handling relationships in your data. And graph databases provide fast and efficient storage, retrieval and querying for it.

Neo4j, the most popular graph database, has proven that ability to deal with massive amount of high connected data in many use-cases.