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

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 Game of Thrones in Neo4j

neoiscoming

The setup

 CREATE (westeros { name: "Westeros" })
= Untying the Graph Database Import Knot =
This Graphgist accompanies http://blog.bruggen.com/2013/12/untying-graph-database-import-knot.html[my blogpost of December 6th, 2013] which tries to explain the different types of questions that people should be asking themselves when thinking about importing data into http://www.neo4j.org[neo4j], and the tools that can contribute to finding the most optimal import strategy for your specific use case.
//setup
//hide
[source,cypher]
----
create (n1:Tool {id:'1',name:'Spreadsheets'}),
(n2:Tool {id:'2',name:'Cypher Statements'}),
@jexp
jexp / histogram.adoc
Last active August 29, 2015 13:56
Histogram with Graphs, Answer to StackOverflow Question

NoSQL - How to generate histograms for ranges of data

Question

Our company has a need to store and compute analytics related to content creation, review/approval and publishing workflow for documents. We are looking at something like Amazon SimpleDB.

We will store "events" which correspond to actions that users take in the system. For instance:

A complex query result projection in cypher

Table of Contents

Introduction

Sometimes it is better to request a complete object-tree from the (graph-)database at once instead sending more than one requests to the database and merging the results in program code.

@jexp
jexp / jqassistant.adoc
Last active August 29, 2015 13:57
jQAssistant Documentation GraphGist

jQAssistant Data model

logo 600px

jQAssistant is a tool supporting the process of developing complex Java applications. It can be plugged into the Maven build process to break the build on detection of constraint violations and generate reports about user defined concepts and metrics.

@jexp
jexp / ordering.adoc
Last active August 29, 2015 13:57
Shows how to order by a random value in Neo4j's Cypher

Random Thoughts

There was a question on the Neo4j Google Group about returning results in a random order in Cypher.

A sales funnel

CREATE (s:Stage{name:'Suspect'})
CREATE (mql:Stage{name:'Marketing Qualified Lead'})
CREATE (ssc:Stage{name:'Self-Serve Customer'})
CREATE (ec:Stage{name:'Existing Customer'})
CREATE (ecno:Stage{name:'Existing Customer-No Opportunity'})
CREATE (sql:Stage{name:'Sales Qualified Lead'})
@jexp
jexp / gist:9607779
Last active August 29, 2015 13:57 — forked from anonymous/gist:9601556
package tests;
/**
*
* @author kb
*
*/
import org.neo4j.cypher.ExecutionEngine;
import org.neo4j.cypher.ExecutionResult;
@jexp
jexp / premier_league.adoc
Created March 20, 2014 13:25
Football Premier League UK example by @markhneedham

Premier Football League

GraphGist for Mark Needhams Football Domain Examples

premier league