Lorenzo Speranzoni colors the graph of Van Gogh

First, I started with the data source: The Vincent Van Gogh Gallery has a complete list of his paintings. Next step was to clean the data and structure it. I used a OpenOffice spreadsheet for that, but – as a developer – I’m currently developing a Spring Data Neo4j spike (version 3.0.0.RC1 to be able to use 2.0.0.M6 version of Neo4j).

The root node is of course Vincent Van Gogh himself:

CREATE (a:ARTIST {first_name: 'Vincent', second_name: 'Willem', last_name: 'Van Gogh', born: 18530330, died: 18900729})

Since I’ll access ARTIST nodes through its last_name property, I decided to introduce an unique index constraint:

CREATE CONSTRAINT ON (a:ARTIST) ASSERT a.last_name IS UNIQUE

Now, I’ll focus on CITIES and STAGES. First of all, where he was born and where he died:

MATCH (a:ARTIST {last_name: 'Van Gogh'}) CREATE (a)-[:BORN_IN]->(c:CITY {name: 'Zundert', province: 'North Brabant', country: 'Netherland', latitude: 51.466667, longitude: 4.666667})
MATCH (a:ARTIST {last_name: 'Van Gogh'}) CREATE (a)-[:DIED_IN]->(c:CITY {name: 'Auvers-sur-Oise', region: 'Île-de-France', country: 'France', latitude: 49.0725, longitude: 2.175})

Please note, we have a CITY with a province property and the other with a region property: Neo4j is schema-less (or, more correctly, “less schema”, as Jim Webber pointed out on his blog).

Please also note that I’m saving latitude and longitude informations for future (maybe my next spike) geo-spatial queries: at present, I’m just supposing this is the correct way to store such kind of data.

Vincent Van Gogh adhered to the ‘Post-Impressionism’ art movement (more correctly, one of its founder):

MATCH (a:ARTIST {last_name: 'Van Gogh'}) CREATE (a)-[:BELONGS_TO]->(m:ART_MOVEMENT {name: 'Post-Impressionism', wikipedia: 'http://en.wikipedia.org/wiki/Post-Impressionism'})

Now I could write the first, very simple Cypher statement to look at nodes and relations I’ve just created.

MATCH (art_movement:ART_MOVEMENT)<-[:BELONGS_TO]-(artist:ARTIST {last_name: 'Van Gogh'})-[r]->(city:CITY)
RETURN artist, art_movement, city

neo4art - Van Gogh

neo4art – Van Gogh

We can see a graph already emerging! :-)

Read the full article.