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

Royalty in Europe

The Royal families generaly have long histories and are often closely related. This citation from wikipedia can give you better idea:

Maternally, Nicholas was the nephew of several monarchs, including King Frederick VIII of Denmark, Queen Alexandra of the United Kingdom (queen consort of King Edward VII), and King George I of Greece. Nicholas, his wife, Alexandra, and Kaiser Wilhelm II of Germany were all first cousins of King George V of the United Kingdom. Nicholas was also a first cousin of both King Haakon VII and Queen Maud of Norway, as well as King Constantine I of Greece. While not first cousins, Nicholas and Kaiser Wilhelm II were second cousins, once removed, as each descended from King Frederick William III of Prussia, as well as third cousins, as they were both great-great-grandsons of Emperor Paul I of Russia.

The rulers of Great Britain, Germany and Russia at the beginning of World War I were actually cousins

@jexp
jexp / Product Catalog
Last active December 29, 2015 12:09 — forked from yaravind/Product Catalog
= Product Catalog
Aravind R. Yarram <yaravind@gmail.com>
v1.0, 17-Sep-2013
:neo4j-version: 2.0.0-RC1
:author: Aravind R. Yarram
:twitter: funpluscharity
== Domain
A product catalog is a collection of products, their categories, manufacturers with their pricing information. Products can be sold separately, included in one or more catalogs or used as substitute products
@jexp
jexp / gist:7719858
Last active December 29, 2015 19:49 — forked from systay/gist:7718178
= Merge Examples =
:neo4j-version: 2.0.0-RC1
:author: Andrés Taylor
:twitter: @andres_taylor
:tags: domain:example
//setup
[source,cypher]
----
@jexp
jexp / gist:7810635
Last active December 30, 2015 09:39 — forked from cleishm/gist:7307795
= Why JIRA should use Neo4j, really
== 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
= People, books and cities
== Modeling the Graph
Let's take a look at the domain model:
image::http://i.imgur.com/TJCNW0b.jpg?1[]
//setup
//hide
[source, cypher]
@jexp
jexp / neo.sh
Last active May 18, 2016 17:44
#!/bin/bash
# usage neo.sh [-h host:port] [-u user:pass] [cmd]
# end cypher statements with semicolon
# terminate read loop with ^d or return
HOST="localhost:7474"
if [ "$1" == "-h" ]; then
shift; HOST="$1";shift;
fi
AUTH=""
@jexp
jexp / cypher_unique.adoc
Last active April 10, 2020 12:47
Unique Workaround in Neo4j's Cypher

Duplicate Check in Cypher

I answered a question on StackOverflow that required a duplicate check for a collection.

This would be easy with an isUnique(coll) in cypher or a to_set(coll) / uniq(coll) function to allow an expression like size(to_set(coll)) = size(coll).

@jexp
jexp / ab_results_old_endpoint.txt
Last active January 3, 2016 10:49
ab test of neo4j cypher endpoints
ab -n 1000 -c 1 -T application/json -H accept:application/json -H X-Stream:true -p /Users/mh/trash/perf_test_old.json http://127.0.0.1:7474/db/data/cypher
Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
@jexp
jexp / cypher.js
Created January 19, 2014 15:44
Javascript Snippet to simply access transactional Cypher Http endpoint of the Neo4j Server (see http://docs.neo4j.org/chunked/milestone/rest-api-transactional.html)
var r=require("request")
function cypher(query,params,cb) {
r.post({uri:"http://localhost:7474/db/data/transaction/commit",
json:{statements:[{statement:query,parameters:params}]}},
function(err,res) { cb(err,res.body)})
}
var query="MATCH (n:User) RETURN n, labels(n) as l LIMIT {limit}"
var params={limit: 10}
var cb=function(err,data) { console.log(JSON.stringify(data)) }
@jexp
jexp / neo4j-check.sh
Created January 22, 2014 13:16
Script for the Neo4j Store Consistency Checker (1.9) place in /path/to/neo4j/bin
#!/bin/bash
# Copyright (c) 2002-2013 "Neo Technology,"
# Network Engine for Objects in Lund AB [http://neotechnology.com]
#
# This file is part of Neo4j.
#
# Neo4j is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the