Skip to content

Instantly share code, notes, and snippets.

@divideby0
Last active August 29, 2015 14:27
Show Gist options
  • Save divideby0/bc86a67c1c2caef532d6 to your computer and use it in GitHub Desktop.
Save divideby0/bc86a67c1c2caef532d6 to your computer and use it in GitHub Desktop.

Two degrees of Cortextual

Create the things

// Create people
CREATE (freethejazz: Person { name: "Jonathan Freeman" }),
       (amrita: Person { name: "Amrita Chavan" }),
       (cortextual: Person { name: "Andrew Ball" }),
       (laura: Person { name: "Laura (Griffel) Ashbaugh" }),
       (mike: Person { name: "Mike Goldstein" }),
       (jason: Person { name: "Jason Kolb" })


// Create organizations
CREATE (osi: Organization { name: "Open Source Integrators" }),
       (emmi: Organization { name: "Emmi Solutions" }),
       (spantree: Organization { name: "Spantree Technology Group" }),
       (kcura: Organization { name: "kCura" }),
       (uptake: Organization { name: "Uptake Technologies" })

// Create relationships
CREATE (freethejazz)-[:EMPLOYEE_OF { startYear: 2012, endYear: 2014 } ]->(osi),
       (cortextual)-[:EMPLOYEE_OF { startYear: 2010, endYear: 2014 } ]->(osi),
       (cortextual)-[:EMPLOYEE_OF { startYear: 2014 } ]->(emmi),
       (freethejazz)-[:EMPLOYEE_OF { startYear: 2014 } ]->(spantree),
       (amrita)-[:EMPLOYEE_OF { startYear: 2014 } ]->(emmi),
       (laura)-[:EMPLOYEE_OF { startYear: 2006, endYear: 2013 } ]->(emmi),
       (laura)-[:EMPLOYEE_OF { startYear: 2014, endYear: 2015 } ]->(kcura),
       (jason)-[:EMPLOYEE_OF { startYear: 2013, endYear: 2014 } ]->(kcura),
       (jason)-[:EMPLOYEE_OF { startYear: 2014 } ]->(uptake),
       (mike)-[:EMPLOYEE_OF { startYear: 2013, endYear: 2014 } ]->(kcura),
       (mike)-[:EMPLOYEE_OF { startYear: 2014 } ]->(uptake)

Visualize the things

The various node types are color-coded.


Query the things

Places cortextual has worked

MATCH
  (cortextual:Person { name: "Andrew Ball" })-[e:EMPLOYEE_OF]->(organization:Organization)
RETURN
  organization.name, e.startYear, e.endYear

Two degrees of cortextual

MATCH
  (cortextual:Person { name: "Andrew Ball" })-[e:EMPLOYEE_OF]->(organization:Organization)<-[:EMPLOYEE_OF]-(person:Person)
RETURN
  organization.name, person.name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment