
We’ve started running some sessions on graph modelling in London and during the first session it was pointed out that the process I’d described was very similar to that when modelling for a relational database. I thought I better do some reading on the way relational models are derived and I came across an excellent video by Joe Maguire titled ‘Data Modelers Still Have Jobs: Adjusting For the NoSQL Environment‘ Joe starts off by showing the following ‘big picture framework’ which describes the steps involved in coming up with a relational model:


- Entities -> Nodes / Labels
- Attributes -> Properties
- Relationships -> Relationships
- Identifiers -> Unique Constraints

CREATE (ian:Person {name: "Ian"}) CREATE (alan:Person {name: "Alan"}) CREATE (gg:Person:Author {name: "Graham Greene"}) CREATE (jlc:Person:Author {name: "John Le Carre"}) CREATE (omih:Book {name: "Our Man in Havana"}) CREATE (ttsp:Book {name: "Tinker Tailor, Soldier, Spy"}) CREATE (gg)-[:WROTE]->(omih) CREATE (jlc)-[:WROTE]->(ttsp) CREATE (ian)-[:PURCHASED {date: "05-02-2011"}]->(ttsp) CREATE (ian)-[:PURCHASED {date: "08-09-2011"}]->(omih) CREATE (alan)-[:PURCHASED {date: "05-07-2014"}]->(ttsp) |


You’ll notice we’ve lost the relationship types and they’ve been replaced by 4 foreign keys that allow us to join the different tables/sets together. In a graph model we’d have been able to stay much closer to the conceptual model and therefore closer to the language of the business. I’m still exploring the world of data modelling and next up for me is to read Joe’s ‘Mastering Data Modeling‘ book. I’m also curious how normal forms and data redundancy apply to graphs so I’ll be looking into that as well. Want to learn more about graph databases? Click below to get your free copy of O’Reilly’s Graph Databases ebook and discover how to use graph technologies for your application today. Download My Ebook