neo4j: Make properties relationships

I spent some of the weekend working my way through Jim, Ian & Emil's book 'Graph Databases' and one of the things that they emphasise is that graphs allow us to make relationships first class citizens in our model.

Looking back on a couple of the graphs that I modelled last year I realise that I didn't quite get this and although the graphs I modelled had some relationships a lot of the time I was defining things as properties on nodes.

While it's fine to do this I think we lose some of the power of a graph and it's not necessarily obvious what we've lost until we model a property as a relationship and see what possibilities open up.

For example in my football graph I wanted to record the date of matches and initially stored this as a property on the match before realising that modelling it as a relationship which might open up some interesting queries.

I created this relationship between a match and the month that the match took place in:

MATCH-[:in_month]->MONTH

As a result of having this relationship I can now really easily find out which matches Gareth Bale played in September for example:

I don't think every property needs to be a relationship but it can certainly be useful to think about doing so because it does allow you to think of interesting queries that you may not have previously thought about.

As an aside I'm working on putting this data set somewhere so people can play around with cypher queries on it so if you'd be interested let me know.