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

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 / depth and breadth first traversals.adoc
Last active August 9, 2018 15:56
Combining depth- and breadth-first traversals in a single cypher query

Combining depth- and breadth-first traversals in a single cypher query

My graph is a tree structure with root and end nodes, and a line of nodes between them with -[:NEXT]-> relationships from one to the next. Some nodes along that path also have -[:BRANCH]-> relationships to other root nodes, and through them to other lines of nodes.

What Cypher query will return an ordered list of the nodes on the path from beginning to end, with any BRANCH relationships being included with the records for the nodes that have them?

@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 / double_dir_shortest_path.adoc
Last active June 30, 2017 16:55
SO Question: Neo4j shortest path with rels in both directions

Neo4j shortest path with rels in both directions

I have a graph set up with the function…​

@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;