Skip to content

Instantly share code, notes, and snippets.

= Business Rule / Recommendation gist =
In this simple example, we want to highlight the power of graphs to describe, discover, visualise and implement powerful business rule-based recommendations.
In the example, we will create a simple graph containing
- a +person+ ("Rik")
- a +city+ ("London")
- an +age+ ("39")
- a +child+ ("Toon")
and all the required relationships from the person to the city, to his age, and his child.
= Why JIRA should use Neo4j
== 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
= Enterprise Content Management with Neo4j
== Introduction
There are several challenges in Enterprise Content Management (ECM) that current technologies cannot tackle efficiently. With Neo4j, a whole new world of possibilities opens up. There are few things more "graphy" than ECM, and so the logical next step is the use of graph databases.
What follows is a subset of the possibilities with Neo4J in ECM. We tackle recommendations, time-based versioning, ACL, metadata management and user action registration.
== The dataset
= Models Sports Leagues
Aravind R. Yarram <yaravind@gmail.com>
v1.0, 08-Sep-2013
== Domain Model
Each *League* has multiple *Level*s like playoffs, quarter-finals etc. The levels are ordered: first is playoffs, +NEXT+ is quarter-finals, +NEXT+ is semi-finals and then the next and last one is the finals. The ordering is represented using a http://docs.neo4j.org/chunked/milestone/cookbook-linked-list.html[linked-list].
A *Player* can play for more than one team over multiple leagues but can only play for a single team in a given league. This is captured by the +PLAYED_IN_FOR_LEAGUE+ http://docs.neo4j.org/chunked/milestone/cypher-cookbook-hyperedges.html[hyperedge] between player, team and league using http://docs.neo4j.org/chunked/milestone/cypher-cookbook-hyperedges.html[hypernode] *PlayerTeamLeague* . A team can register in a new league with a different name in which case, we want to know what it was +PREVIOUSLY_KNOWN_AS+.The fact that a player had for a given team (irrespective of which league) is capture

Mystery Science Theater 3000 Actors and Characters - GraphGist for the Neo4j GraphGist challenge

This Graph is based on the MST3K TV-series that ran during the 1990s. Awesome TV-serie, my favourite actually. I created this Graph based on the characters of the show and where they live/reside/hunt, and which actors played them. As the Actors usually played several characters, and many characters were played by several actors, the graph get’s a bit interesting :) Enjoy!

1380475993

Holiday Resorts

Kerala is a state in India and popularly known as "God’s own Country". It is very famous for the BackWaters, HouseBoats, Food, Culture. There are numerous resorts, hotels and homestays in Kerala. This application provides a fun and interactive way to find a Resort of your choice.

Domain_Model
= Product Catalog
Aravind R. Yarram <yaravind@gmail.com>
v1.0, 17-Sep-2013
== 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
You can perform the following operations on a product:
Create, Update, Delete (Not recommended, deactivate instead), Deactivate (We should deactivate products that are no longer available instead of deleting them, because they are included in past orders, quotes, or opportunities.), Search etc.
@cleishm
cleishm / gist:2973636
Created June 22, 2012 15:51
Generate timestamped signature
#!/usr/bin/env ruby
require 'digest/md5'
require 'base64'
if ARGV.length != 1
$stderr.puts "usage: #{$0} secret"
exit 1
end
timestamp = Time.now.to_i
@cleishm
cleishm / gist:2123604
Created March 19, 2012 18:44
Format a time to H:MM:SS.mmm
function formatTime(time) {
var hours = Math.floor(time / 3600000);
var min = Math.floor(((time % 3600000) / 60000));
var sec = Math.floor(((time % 60000) / 1000));
var msec = time % 1000;
if (hours < 10)
hours = '0' + hours;
if (min < 10)
min = '0' + min;
if (sec < 10)
@cleishm
cleishm / RandomDB.java
Created March 2, 2012 01:54
Create a huge neo4j dataset
import org.neo4j.kernel.impl.batchinsert.*;
import org.neo4j.graphdb.*;
import java.util.*;
class RandomDB {
public static void main(final String args[]) {
final Map<String, String> params = new HashMap<String,String>();
params.put("neostore.nodestore.db.mapped_memory", "1024M");
params.put("neostore.relationshipstore.db.mapped_memory", "2048M");