Preview

Domain

This gist models the manufacture rates of various companies across a range of devices and over a range of years. The model can then be used for a number of analysis of the manufacturing trends

Setup

CREATE (y2011:year{name:'2011'})
CREATE (y2012:year{name:'2012'})
CREATE (y2013:year{name:'2013'})

CREATE ( APPLE:manufacturer{name:'APPLE'})
CREATE APPLE-[:desktop{quantity:20000}]->y2011
CREATE APPLE-[:laptop{quantity:30000}]->y2011
CREATE APPLE-[:tablet{quantity:10000}]->y2011

CREATE APPLE-[:desktop{quantity:23000}]->y2012
CREATE APPLE-[:laptop{quantity:32000}]->y2012
CREATE APPLE-[:tablet{quantity:40000}]->y2012

CREATE APPLE-[:desktop{quantity:25000}]->y2013
CREATE APPLE-[:laptop{quantity:32000}]->y2013
CREATE APPLE-[:tablet{quantity:100000}]->y2013


CREATE ( HP:manufacturer{name:'HP'})
CREATE HP-[:desktop{quantity:40000}]->y2011
CREATE HP-[:laptop{quantity:55000}]->y2011
CREATE HP-[:tablet{quantity:2000}]->y2011

CREATE HP-[:desktop{quantity:45000}]->y2012
CREATE HP-[:laptop{quantity:60000}]->y2012
CREATE HP-[:tablet{quantity:7000}]->y2012

CREATE HP-[:desktop{quantity:49000}]->y2013
CREATE HP-[:laptop{quantity:64000}]->y2013
CREATE HP-[:tablet{quantity:15000}]->y2013

CREATE ( DELL:manufacturer{name:'DELL'})
CREATE DELL-[:desktop{quantity:30000}]->y2011
CREATE DELL-[:laptop{quantity:60000}]->y2011
CREATE DELL-[:tablet{quantity:0}]->y2011

CREATE DELL-[:desktop{quantity:35000}]->y2012
CREATE DELL-[:laptop{quantity:70000}]->y2012
CREATE DELL-[:tablet{quantity:2000}]->y2012

CREATE DELL-[:desktop{quantity:400000}]->y2013
CREATE DELL-[:laptop{quantity:80000}]->y2013
CREATE DELL-[:tablet{quantity:10000}]->y2013

CREATE ( Samsung:manufacturer{name:'Samsung'})
CREATE Samsung-[:desktop{quantity:26000}]->y2011
CREATE Samsung-[:laptop{quantity:45000}]->y2011
CREATE Samsung-[:tablet{quantity:2000}]->y2011

CREATE Samsung-[:desktop{quantity:32000}]->y2012
CREATE Samsung-[:laptop{quantity:54000}]->y2012
CREATE Samsung-[:tablet{quantity:25000}]->y2012

CREATE Samsung-[:desktop{quantity:38000}]->y2013
CREATE Samsung-[:laptop{quantity:62000}]->y2013
CREATE Samsung-[:tablet{quantity:90000}]->y2013
Loading graph...

Use Cases

Who are top two laptop manufacturers for 2013

MATCH (n:manufacturer)-[r:laptop]-(y:year{name:'2013'}) return n.name,r.quantity order by r.quantity DESC
Loading table...

List the current manufacturing quantities of tablets and also the percent increase in the last year!

MATCH (n:manufacturer)-[r:tablet]-(y:year{name:'2012'})
WITH n as manufacturer,r.quantity as twotewlve
MATCH (manufacturer)-[r:tablet]-(y:year{name:'2013'})
return manufacturer.name as manufacturer,r.quantity as Current_production,(r.quantity-twotewlve)*100/twotewlve as gain_percent_last_yr ORDER BY Current_production DESC
Loading table...