Skip to content

Instantly share code, notes, and snippets.

View nawroth's full-sized avatar

Anders Nawroth nawroth

View GitHub Profile
= The Neo4j GraphGist Console =
This is a sample GraphGist explaining some of the base concepts of sharing graphs using http://docs.neo4j.org/chunked/milestone/cypher-query-lang.html[the Cypher query language].
[source,cypher]
----
CREATE ({name:'you'})-[:SEE]->({name:'This GraphGist'})-[:FORK_ON_GITHUB]->(your_gistfile{name:'Your Gist'})
CREATE (your_gistfile)-[:INSERT_ID_HERE]->({name:'Your GraphGist'})
----
= Business Rule / Recommendation gist =
Let's see if I can create a graphgist for business rules/simple recommendations.
//console
First, lets create the graph:
//setup
[source,cypher]

Orienteering Gist

This is the Orienteering Dataset based on the blog.neo4j.org post.

BR6XWd4ZbbfPu9Bm2c IFYWdhzACwwxLJOS3ZpAR7gmUSZE6ldzwwlcp4GnR9YR2cwdNT6AuXiUESf B5YQOy4BEDYgpEKtBRCMCbkBOwc9Q9GpriAklzO9pqg

It’s a simple, three-leg training course in an Antwerp park. Setting this up as a graph in neo4j was easy enough:

= The news reads us data in Neo4J
Data by: http://newsreadsus.okfn.de/
== Intro
Interesting data created by http://newsreadsus.okfn.de/.
I converted the data from the links.json file and converted it into two simple csv files.
//setup
[source,cypher]
----
LOAD CSV FROM "https://dl.dropboxusercontent.com/s/riz5hp32mz0jzed/sites.csv?dl=1" AS csvline
= Donations to German parties
:neo4j-version: 2.1.0
Data from here: https://github.com/pudo/kompromatron
== Sample Data Set
//setup
[source,cypher]
= (Product) Hierarchy GraphGist =
This gist is a complement to http://blog.bruggen.com/2014/03/using-neo4j-to-manage-and-calculate.html[blogpost that I wrote] about managing hierarchical data structures in http://www.neo4j.org[neo4j]..
In this example, we are using a "product hierarchy", essentially holding information about the composition of a product (what is it made of, how many of the components are used, and at the lowest level, what is the price of these components). The model looks like this:
image::http://1.bp.blogspot.com/-XIjEXWHpNmc/Uzbhuoo-9xI/AAAAAAABNWE/7zYyn3Vl3i0/s3200/Screen+Shot+2014-03-29+at+16.04.35.png[]
Note that in the graphgist, I have cut the tree depth to 5 levels (product to costs) instead of 6 in the blogpost - and that I also reduced the width of the tree to make it manageable in a gist.