Skip to content

Instantly share code, notes, and snippets.

@luanne
luanne / mapping.xml
Created June 22, 2012 18:33
RDBMS Schema to Neoj graph model
<node type="customer" index="customerIndex">
<table name="customer">
<field name="id" property="id" indexKey="true"/>
<field name="name" property="name"/>
<field name="locationId" relationship="locatedIn" nodeType="location" direction="outgoing"/>
</table>
</node>
<node type="location" index="locationIndex">
<table name="location">
start t=node:types(id={id})
match
(t)<-[:has_type]-(u)<-[:metric_unit]-(ma)<-[:metric_activity]-(m)<-[cm:cycle_metric]-(c)
where
c.measureDate>={measureStart} and c.measureDate <= {measureEnd}
with distinct m, ma, u, c
match
(ma)-[:metric_unit]->(u)<-[:alert_for_unit]-(a)-[:alert_for_inspection]->(i)-[:has_result]->(ir)
<-[:for_inspection_result]-(a)
where
start t=node:types(id={id})
match
(t)<-[:has_type]-(u)<-[:metric_unit]-(ma)<-[:metric_activity]-(m)<-[cm:cycle_metric]-(c)
where
c.measureDate>={measureStartDate} and c.measureDate <= {measureEndDate}
with distinct m, ma, u, c
match
(u)<-[:alert_for_unit]-(a)
where
a.alertDate=c.measureDate and a.fromEntityType={type}
start c=node:companies(id={companyId})
match
c<-[:parent_company*0..]-n
with n
match
n-[:defines_process"]->bp-[:has_cycle]->cm-[:cycle_metric]->m-[:metric_activity]->ma-[:metric_unit]->u
where
cm.measureDate>={measureStartDate} and cm.measureDate<={measureEndDate}
with ma,u,cm
match
start c=node:companies(id={id})
match
c<-[:parent_company*0..]-n
with n
match
n-[:defines_business_process]->bp-[:has_cycle]->cm
where
cm.measureDate>={measureStartDate} and cm.measureDate<={measureEndDate}
with cm
match
@luanne
luanne / harrypotter.adoc
Last active December 29, 2015 02:18
Harry Potter GraphGist

Harry Potter

harry

Welcome to the wonderful world of Harry Potter!

v0 of this graph models some of Harrys friends, enemies and their parents. Also have some pets and a few killings. The obvious relation missing is the one between Harry Potter and Voldemort- it took us 7 books to figure that one out, so you’ll have to wait till I add more data :-)

The model

@luanne
luanne / course-graph.adoc
Last active December 31, 2015 17:39
Course GraphGist

Courses

A graph model for courses and their dependencies

Domain

Institutes conduct courses which are taught by instructors. A course can be taught in multiple languages and/or have subtitles in various languages. A course recommends a min and max amount of study hours per week. Subjects are taught by courses. A subject can have other subjects as prerequisites.

Goal

The model will help us answer the following questions:

@luanne
luanne / lms-graph
Last active December 31, 2015 17:39
Organization Learning Graph Gist
= Organization Learning
Learning Management Systems (LMS) are typically deployed in large organizations to support learning processes that align with business goals. These systems tie together their employees, organizations, certifications, courses, jobs in order to supplement business strategy.
This graph gist models a slice of this ecosystem- certification paths and position dependencies on certifications.
== Domain
A certification has one or more learning paths. A learning path is an ordered sequence of items that must be completed in order to acquire the certification. A learning item can be completed by taking a course or proving work experience. A course has a delivery type- it can be web based or classroom. Work Experience specifies the number of hours one must put in to complete it.
To aquire a certification, an employee can take take any learning path and complete every item in it.
Employees hold certifications and complete courses and work experience. An employee may fill a position which require
@luanne
luanne / drinks.adoc
Last active January 1, 2016 05:49
Christmas Drink GraphGist

Christmas drinks

A reference to mixing christmas drinks

Domain

A drink is composed of ingredients and their quantities. Drinks in this example are divided into alcoholic, non-alcoholic, hot and cold. Ingredients can be added to drinks in various forms such as powdered, whole, crushed etc.

Model

drinks
@luanne
luanne / trains.adoc
Last active January 8, 2016 11:29
Bombay Trains graph gist

Bombay Railway Routes

Most people from Bombay have a love-hate relation with trains. While they are still the quickest way to get to almost any place, getting into a train is an entirely different matter. We have beautiful structures such as CST (formerly Victoria Terminus):

cst

and then horrors such as these:

western