Neo4Art – Van Gogh’s Journey in a Neo4j Graph Database

I. PREFACE

(feel free to jump to chapter II)

When I was young I really loved to listen to my uncle Luciano talking about art. He was an art history teacher. Sitting at his desk, he described me Vincent Van Gogh’s artworks. Vincent Van Gogh is widely considered one of the most important neo-impressionist painters. In 1990, I received the book Sulle tracce di Van Gogh (in the footsteps of Van Gogh) as a gift from my uncle:

sulle-tracce-di-van-gogh

By reading that book, I understood that one fundamental aspect of his artwork was his continuous research for colours: “during his early adulthood, while living between The Netherlands and Belgium, his palette consisted mainly of somber earth tones and showed no sign of the vivid coloration that distinguished his later work. In March 1886, he moved to Paris and discovered the French Impressionists. Later, he moved to the south of France and was influenced by the strong sunlight he found there. His work grew brighter in color, and he developed the unique and highly recognizable style that became fully realized during his stay in Arles in 1888” [Ref. 4]

So how would I go about putting Van Gogh’s journey into Neo4j?

II. INTRODUCTION

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! :-)

III. JOURNEY’S STAGES

On December 1883, Van Gogh began his journey by moving to Neuen, North Brabant, Netherlands. He lived there until November 1885:

MATCH (a:ARTIST {last_name: 'Van Gogh'}) CREATE (a)-[:MOVED_TO]->(s:STAGE {from: 188312, to: 188511})

MATCH (a:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(stage:STAGE)
WITH last(collect(stage)) as last_stage
CREATE (last_stage)-[:IN]->(c:CITY {name: 'Neuen', province: 'North Brabant', country: 'Netherland', latitude: 51.473333, longitude: 5.546667})

As you can see, I’ve used the aggregation function collect and the collection function last, to retrieve current last stage.

I’m still a little bit undecided about creating a specific node labeled STAGE (I could have used CITY and relations with properties between cities directly), but stages were really significant for Van Gogh, that’s why, to describe his journey I’ve decided to create a linked list of stages (please, tell me if you think that’s wrong).

In december 1885, Van Gogh moved to Antwerp, Belgium, where he lived until February 1886:

MATCH (a:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(stage:STAGE)
WITH last(collect(stage)) as last_stage
CREATE (last_stage)-[:MOVED_TO]->(:STAGE {from: 188512, to: 188602})

MATCH (a:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(stage:STAGE)
WITH last(collect(stage)) as last_stage
CREATE (last_stage)-[:IN]->(c:CITY {name: 'Antwerp', region: 'Flemish Region', country: 'Belgium', latitude: 51.216667, longitude: 4.4})

Van Gogh lived in Paris, France from March 1886 to February 1888:

MATCH (a:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(stage:STAGE)
WITH last(collect(stage)) as last_stage
CREATE (last_stage)-[:MOVED_TO]->(:STAGE {from: 188603, to: 188802 })

MATCH (a:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(stage:STAGE)
WITH last(collect(stage)) as last_stage
CREATE (last_stage)-[:IN]->(c:CITY {name: 'Paris', region: 'Île-de-France', country: 'France', latitude: 48.8567, longitude: 2.3508})

Van Gogh moved to Arles, France in February 1888 and stayed there until May 1889:

MATCH (a:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(stage:STAGE)
WITH last(collect(stage)) as last_stage
CREATE (last_stage)-[:MOVED_TO]->(:STAGE {from: 188802, to: 188905 })

MATCH (a:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(stage:STAGE)
WITH last(collect(stage)) as last_stage
CREATE (last_stage)-[:IN]->(c:CITY {name: 'Arles', region: 'Provence-Alpes-Côte d\'Azur', country: 'France', latitude: 43.6767, longitude: 4.6278})

(Please, pay attention to the back slash in d\’Azur).

Then he moved to Saint-Rémy de Provence, France in May 1889 and stayed there until May 1890:

MATCH (a:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(stage:STAGE)
WITH last(collect(stage)) as last_stage
CREATE (last_stage)-[:MOVED_TO]->(:STAGE {from: 188905, to: 189005 })

MATCH (a:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(stage:STAGE)
WITH last(collect(stage)) as last_stage
CREATE (last_stage)-[:IN]->(c:CITY {name: 'Saint-Rémy de Provence', region: 'Provence-Alpes-Côte d\'Azur', country: 'France', latitude: 43.79, longitude: 4.8325})

Van Gogh ended his trip, and also his life by committing suicide, in Auvers-sur-Oise, France where he had lived from May to July 1890:

MATCH (a:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(stage:STAGE)
WITH last(collect(stage)) as last_stage
CREATE (last_stage)-[:MOVED_TO]->(:STAGE {from: 189005, to: 189007 })

Auvers-sur-Oise was already created, so I’m going to change a little the usual statement:

MATCH (a:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(stage:STAGE)
WITH last(collect(stage)) as last_stage
MATCH (c:CITY {name: 'Auvers-sur-Oise'})
CREATE (last_stage)-[:IN]->(c)

Now I’m able to inquiry the system to visualize Van Gogh’s journey:

MATCH (artist:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(stage:STAGE)-[:IN]->(city:CITY)
WITH artist, stage, city
MATCH (artist)-[:BELONGS_TO]->(art_movement:ART_MOVEMENT)
RETURN artist, art_movement, stage, city
neo4art - Van Gogh's Journey

neo4art – Van Gogh’s Journey

IV. INFLUENCERS

In describing his journey, there’s another fundamental aspect about Van Gogh’s artwork: his influencers.

During his 2nd stage in Antwerp he applied himself to the study of colour theory and spent time in museums, particularly studying the work of Peter Paul Rubens,
gaining encouragement to broaden his palette to carmine, cobalt and emerald green” [ref.4]:

CREATE (a:ARTIST {first_name: 'Peter', second_name: 'Paul', last_name: 'Rubens', born: 15770628, died: 16400530})

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

MATCH (a:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(s:STAGE)-[:IN]->(c:CITY {name: 'Antwerp'}), (influencer:ARTIST {last_name: 'Rubens'})
CREATE (s)-[:WHERE_WAS_INFLUENCED_BY]->(influencer)

The two years Van Gogh spent in Paris were arguably the most pivotal of his career as an artist. Van Gogh went to Paris as a mean of saving money (by living with his brother, Theo) and also to explore the radically new approach to art which had been ushered in by the Impressionists” [Ref. 5]

“Vincent encountered many of the giants of Impressionism during his time in Paris: Henri de Toulouse-Lautrec, Emile Bernard, Camille Pissarro, Georges Seurat and, of course, Paul GauguinWhile Vincent didn’t fully accept many of the theories put forth by the Impressionists (on many occasions he would passionately argue with his contemporaries late into the night in the cafes of Montmartre), he nevertheless adapted some of their techniques in a manner that would further define his own unique style. In Paris, Van Gogh’s palette came alive” [Ref 4.]

Henri de Toulouse-Lautrec:

CREATE (a:ARTIST {first_name: 'Henri', second_name: 'Marie', third_name: 'Raymond', last_name: 'Toulouse-Lautrec', born: 18641124, died: 19010909})

MATCH (a:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(s:STAGE)-[:IN]->(c:CITY {name: 'Paris'}), (influencer:ARTIST {last_name: 'Toulouse-Lautrec'})
CREATE (s)-[:WHERE_WAS_INFLUENCED_BY]->(influencer)

MATCH (a:ARTIST {last_name: 'Toulouse-Lautrec'}), (m:ART_MOVEMENT {name: 'Post-Impressionism'})
CREATE (a)-[:BELONGS_TO]->(m)

MATCH (a:ARTIST {last_name: 'Toulouse-Lautrec'})
CREATE (a)-[:BELONGS_TO]->(m:ART_MOVEMENT {name: 'Art Nouveau', wikipedia: 'http://en.wikipedia.org/wiki/Art_Nouveau'})

Paul Gauguin:

CREATE (a:ARTIST {first_name: 'Eugène', second_name: 'Henri', third_name: 'Paul', last_name: 'Gauguin', born: 18480711, died: 19030508})

MATCH (a:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(s:STAGE)-[:IN]->(c:CITY {name: 'Paris'}), (influencer:ARTIST {last_name: 'Gauguin'})
CREATE (s)-[:WHERE_WAS_INFLUENCED_BY]->(influencer)

MATCH (a:ARTIST {last_name: 'Gauguin'}), (m:ART_MOVEMENT {name: 'Post-Impressionism'})
CREATE (a)-[:BELONGS_TO]->(m)

Émile Bernard:

CREATE (a:ARTIST {first_name: 'Émile', second_name: 'Henri', last_name: 'Bernard', born: 18680428, died: 19410416})

MATCH (a:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(s:STAGE)-[:IN]->(c:CITY {name: 'Paris'}), (influencer:ARTIST {last_name: 'Bernard'})
CREATE (s)-[:WHERE_WAS_INFLUENCED_BY]->(influencer)

MATCH (a:ARTIST {last_name: 'Bernard'}), (m:ART_MOVEMENT {name: 'Post-Impressionism'})
CREATE (a)-[:BELONGS_TO]->(m)

Camille Pissarro:

CREATE (a:ARTIST {first_name: 'Camille', last_name: 'Pissarro', born: 18300710, died: 19031113})

MATCH (a:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(s:STAGE)-[:IN]->(c:CITY {name: 'Paris'}), (influencer:ARTIST {last_name: 'Pissarro'})
CREATE (s)-[:WHERE_WAS_INFLUENCED_BY]->(influencer)

MATCH (a:ARTIST {last_name: 'Pissarro'}), (m:ART_MOVEMENT {name: 'Post-Impressionism'})
CREATE (a)-[:BELONGS_TO]->(m)

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

Georges Seurat:

CREATE (a:ARTIST {first_name: 'Georges-Pierre', last_name: 'Seurat', born: 18591202, died: 18910329})

MATCH (a:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(s:STAGE)-[:IN]->(c:CITY {name: 'Paris'}), (influencer:ARTIST {last_name: 'Seurat'})
CREATE (s)-[:WHERE_WAS_INFLUENCED_BY]->(influencer)

MATCH (a:ARTIST {last_name: 'Seurat'})
CREATE (a)-[:BELONGS_TO]->(m:ART_MOVEMENT {name: 'Neo-impressionism', wikipedia: 'http://en.wikipedia.org/wiki/Neo-impressionism'})

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

MATCH (a:ARTIST {last_name: 'Seurat'}), (m:ART_MOVEMENT {name: 'Post-Impressionism'})
CREATE (a)-[:BELONGS_TO]->(m)

Claude Monet:

CREATE (a:ARTIST {first_name: 'Oscar-Claude', last_name: 'Monet', born: 18401114, died: 19260526})

MATCH (a:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(s:STAGE)-[:IN]->(c:CITY {name: 'Paris'}), (influencer:ARTIST {last_name: 'Monet'})
CREATE (s)-[:WHERE_WAS_INFLUENCED_BY]->(influencer)

MATCH (a:ARTIST {last_name: 'Monet'}), (m:ART_MOVEMENT {name: 'Impressionism'})
CREATE (a)-[:BELONGS_TO]->(m)

In Arles, Van Gogh was introduced to Eugène Boch, a Belgian painter who stayed at times in Fontvieille, and the two exchanged visits for some times:

CREATE (a:ARTIST {first_name: 'Eugène', last_name: 'Boch', born: 18550901, died: 19410103})

MATCH (a:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(s:STAGE)-[:IN]->(c:CITY {name: 'Arles'}), (influencer:ARTIST {last_name: 'Boch'})
CREATE (s)-[:WHERE_WAS_INFLUENCED_BY]->(influencer)

Now I’m able to inquiry the system to know who influenced Van Gogh’s artwork:

MATCH (artist:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(stage:STAGE)-[:IN]->(city:CITY)
OPTIONAL MATCH (stage)-[:WHERE_WAS_INFLUENCED_BY*]->(influencer:ARTIST)-[:BELONGS_TO*]->(art_movement:ART_MOVEMENT)
RETURN artist, stage, city, influencer, art_movement
neo4art - Van Gogh's influencers

neo4art – Van Gogh’s influencers

V. ARTWORK

Van Gogh’s artwork is about painting:

CREATE (v:VISUAL_ART {name: 'painting', wikipedia: 'http://en.wikipedia.org/wiki/Visual_arts#Painting'})

In Neuen, Van Gogh “completed what is generally considered his first major work, The Potato Eaters, the culmination of several years work painting peasant character studies“:

CREATE (a:ARTWORK {title: 'The Potato Eaters I', type: 'oil on canvas', year: 1885, month: 'April', thumbnail: 'http://www.vggallery.com/painting/f_0082.jpg', f_order: '82', jh_order: '764'})

MATCH (a:ARTIST {last_name: 'Van Gogh'}), (w:ARTWORK {title: 'The Potato Eaters I'})
CREATE (w)-[:AUTHOR]->(a)

MATCH (a:ARTWORK {title: 'The Potato Eaters I'}), (v:VISUAL_ART {name: 'painting'})
CREATE (a)-[:IS_A]->(v)

MATCH (:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(s:STAGE)-[:IN]->(c:CITY {name: 'Neuen'}), (a:ARTWORK {title: 'The Potato Eaters I'})
CREATE (s)-[:WHERE_REALIZED]->(a)

During his stage in Antwerp, among others, he depicted Backyards of Old Houses in Antwerp in the Snow:

CREATE (a:ARTWORK {title: 'Backyards of Old Houses in Antwerp in the Snow', type: 'oil on canvas', year: 1885, month: 'December', thumbnail: 'http://www.vggallery.com/painting/f_0260.jpg', f_order: '260', jh_order: '970'})

MATCH (a:ARTIST {last_name: 'Van Gogh'}), (w:ARTWORK {title: 'Backyards of Old Houses in Antwerp in the Snow'})
CREATE (w)-[:AUTHOR]->(a)

MATCH (a:ARTWORK {title: 'Backyards of Old Houses in Antwerp in the Snow'}), (v:VISUAL_ART {name: 'painting'})
CREATE (a)-[:IS_A]->(v)

MATCH (:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(s:STAGE)-[:IN]->(c:CITY {name: 'Antwerp'}), (a:ARTWORK {title: 'Backyards of Old Houses in Antwerp in the Snow'})
CREATE (s)-[:WHERE_REALIZED]->(a)

During his stay in Paris, he collected more Japanese ukiyo-e woodblock prints; he became interested in such works, when in 1885 in Antwerp he used them to decorate the walls of his studio. He collected hundreds of prints, which are visible in the backgrounds of several of his paintings. In his 1887 Portrait of Père Tanguy several can be seen hanging on the wall behind the main figure“:

CREATE (a:ARTWORK {title: 'Portrait of Père Tanguy III', type: 'oil on canvas', year: 1887, period: 'Autumn', thumbnail: 'http://www.vggallery.com/painting/f_0363.jpg', f_order: '363', jh_order: '1351'})

MATCH (a:ARTIST {last_name: 'Van Gogh'}), (w:ARTWORK {title: 'Portrait of Père Tanguy III'})
CREATE (w)-[:AUTHOR]->(a)

MATCH (a:ARTWORK {title: 'Portrait of Père Tanguy III'}), (v:VISUAL_ART {name: 'painting'})
CREATE (a)-[:IS_A]->(v)

MATCH (:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(s:STAGE)-[:IN]->(c:CITY {name: 'Paris'}), (a:ARTWORK {title: 'Portrait of Père Tanguy III'})
CREATE (s)-[:WHERE_REALIZED]->(a)

In Arles, “his project at this time was a series of paintings including Van Gogh’s Chair (1888), Bedroom in Arles (1888), The Night Café (1888), Cafe Terrace at Night (September 1888), Starry Night Over the Rhone (1888), Still Life: Vase with Twelve Sunflowers (1888), all intended to form the décoration for the Yellow House”:

CREATE (a:ARTWORK {title: 'The Cafe Terrace on the Place du Forum, Arles, at Night', type: 'oil on canvas', year: 1888, month: 'September', thumbnail: 'http://www.vggallery.com/painting/f_0467.jpg', f_order: '467', jh_order: '1580'})

MATCH (a:ARTIST {last_name: 'Van Gogh'}), (w:ARTWORK {title: 'The Cafe Terrace on the Place du Forum, Arles, at Night'})
CREATE (w)-[:AUTHOR]->(a)

MATCH (a:ARTWORK {title: 'The Cafe Terrace on the Place du Forum, Arles, at Night'}), (v:VISUAL_ART {name: 'painting'})
CREATE (a)-[:IS_A]->(v)

MATCH (:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(s:STAGE)-[:IN]->(c:CITY {name: 'Arles'}), (a:ARTWORK {title: 'The Cafe Terrace on the Place du Forum, Arles, at Night'})
CREATE (s)-[:WHERE_REALIZED]->(a)

In Saint-Rémy de Provence, Van Gogh painted Starry Night:

CREATE (a:ARTWORK {title: 'Starry Night', type: 'oil on canvas', year: 1889, month: 'June', thumbnail: 'http://www.vggallery.com/painting/f_0612.jpg', f_order: '612', jh_order: '1731'})

MATCH (a:ARTIST {last_name: 'Van Gogh'}), (w:ARTWORK {title: 'Starry Night'})
CREATE (w)-[:AUTHOR]->(a)

MATCH (a:ARTWORK {title: 'Starry Night'}), (v:VISUAL_ART {name: 'painting'})
CREATE (a)-[:IS_A]->(v)

MATCH (:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(s:STAGE)-[:IN]->(c:CITY {name: 'Saint-Rémy de Provence'}), (a:ARTWORK {title: 'Starry Night'})
CREATE (s)-[:WHERE_REALIZED]->(a)

In Auvers-sur-Oise, Van Gogh painted Wheat Field with Crows:

CREATE (a:ARTWORK {title: 'Wheat Field with Crows', type: 'oil on canvas', year: 1890, month: 'July', thumbnail: 'http://www.vggallery.com/painting/f_0779.jpg', f_order: '779', jh_order: '2117'})

MATCH (a:ARTIST {last_name: 'Van Gogh'}), (w:ARTWORK {title: 'Wheat Field with Crows'})
CREATE (w)-[:AUTHOR]->(w)

MATCH (a:ARTWORK {title: 'Wheat Field with Crows'}), (v:VISUAL_ART {name: 'painting'})
CREATE (a)-[:IS_A]->(v)

MATCH (:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(s:STAGE)-[:IN]->(c:CITY {name: 'Auvers-sur-Oise'}), (a:ARTWORK {title: 'Wheat Field with Crows'})
CREATE (s)-[:WHERE_REALIZED]->(a)
 
Now I’m able to inquiry the system to know when and where Van Gogh painted his artworks:
MATCH (artist:ARTIST {last_name: 'Van Gogh'})-[:MOVED_TO*]->(stage:STAGE)-[:WHERE_REALIZED*]->(artwork:ARTWORK)-[:IS_A]-(visual_art:VISUAL_ART)
WITH artist, stage, artwork, visual_art
MATCH (stage)-[:IN]->(city:CITY)
RETURN artist, stage, city, artwork, visual_art
neo4art - Van Gogh's artwork

neo4art – Van Gogh’s artwork

VI. WHERE ARE HIS ARTWORKS?

Ok, I believe it’s time to get up from my chair to start admiring his paintings around the world.

Van Gogh Museum, Amsterdam:

CREATE (m:MUSEUM {name: 'Van Gogh Museum', director: 'Axel Rüger', address: 'Museumplein Amsterdam, Netherlands', website: 'http://www.vangoghmuseum.nl/', wikipedia: 'http://en.wikipedia.org/wiki/Van_Gogh_Museum'})

CREATE (c:CITY {name: 'Amsterdam', province: 'North Holland', country: 'Netherlands', longitude: 52.373056, latitude: 4.892222})

MATCH (m:MUSEUM {name: 'Van Gogh Museum'}), (c:CITY {name: 'Amsterdam'})
CREATE (m)-[:LOCATED_IN]->(c)

MATCH (m:MUSEUM {name: 'Van Gogh Museum'}), (a:ARTWORK {title: 'The Potato Eaters I'})
CREATE (a)-[:OFFICIAL_LOCATION]->(m)

MATCH (m:MUSEUM {name: 'Van Gogh Museum'}), (a:ARTWORK {title: 'Backyards of Old Houses in Antwerp in the Snow'})
CREATE (a)-[:OFFICIAL_LOCATION]->(m)

MATCH (m:MUSEUM {name: 'Van Gogh Museum'}), (a:ARTWORK {title: 'Wheat Field with Crows'})
CREATE (a)-[:OFFICIAL_LOCATION]->(m)

Musée Rodin, Paris:

CREATE (m:MUSEUM {name: 'Musée Rodin', address: 'Hôtel Biron, 79, rue de Varenne, 75007 Paris, France', website: 'http://www.musee-rodin.fr/', wikipedia: 'http://en.wikipedia.org/wiki/Mus%C3%A9e_Rodin', latitude: 48.855278, longitude: 2.315833})

MATCH (m:MUSEUM {name: 'Musée Rodin'}), (c:CITY {name: 'Paris'})
CREATE (m)-[:LOCATED_IN]->(c)

MATCH (m:MUSEUM {name: 'Musée Rodin'}), (a:ARTWORK {title: 'Portrait of Père Tanguy III'})
CREATE (a)-[:OFFICIAL_LOCATION]->(m)

Kröller-Müller Museum, Otterlo:

CREATE (m:MUSEUM {name: 'Kröller-Müller Museum', director: 'Lisette Pelsers', website: 'http://kmm.nl', wikipedia: 'http://en.wikipedia.org/wiki/Kr%C3%B6ller-M%C3%BCller_Museum', latitude: 52.095556, longitude: 5.816944})

CREATE (c:CITY {name: 'Otterlo', province: 'Gelderland', country: 'Netherlands', longitude: 52.1, latitude: 5.783333})
MATCH (m:MUSEUM {name: 'Kröller-Müller Museum'}), (c:CITY {name: 'Otterlo'})
CREATE (m)-[:LOCATED_IN]->(c)

MATCH (m:MUSEUM {name: 'Kröller-Müller Museum'}), (a:ARTWORK {title: 'The Cafe Terrace on the Place du Forum, Arles, at Night'})CREATE (a)-[:OFFICIAL_LOCATION]->(m)

The Museum of Modern Art, New York:

CREATE (m:MUSEUM {name: 'The Museum of Modern Art', director: 'Glenn D. Lowry', address: '11 West 53rd Street New York, NY 10019', website: 'http://www.moma.org/', wikipedia: 'http://en.wikipedia.org/wiki/The_Museum_of_Modern_Art', latitude: 40.761484, longitude: -73.977664})

CREATE (c:CITY {name: 'New York', county: ['Bronx', 'Kings', 'New York', 'Queens', 'Richmond'], state: 'New York', country: 'United States of America', longitude: 40.67, latitude: -73.94})

MATCH (m:MUSEUM {name: 'The Museum of Modern Art'}), (c:CITY {name: 'New York'})
CREATE (m)-[:LOCATED_IN]->(c)

MATCH (m:MUSEUM {name: 'The Museum of Modern Art'}), (a:ARTWORK {title: 'Starry Night'})
CREATE (a)-[:OFFICIAL_LOCATION]->(m)

It would be interesting if the system could be able to track artworks’ movement from official location: I really suffer when my family and me plan to visit a museum to admire an artwork and then we discover it’s on loan :-(

Now I’m able to ask the system which Van Gogh’s artworks are in dutch museums:

MATCH (artwork:ARTWORK)-[:OFFICIAL_LOCATION]->(museum:MUSEUM)-[:LOCATED_IN]->(city:CITY {country: 'Netherlands'})
RETURN artwork, museum, city
neo4art - museums hosting Van Gogh's artworks

neo4art – museums hosting Van Gogh’s artworks

VII. ADD SOME SOCIAL

Of course in an age of social networking, we couldn’t finish this spike without some forms of I LIKE:

CREATE (p:PERSON {first_name: 'Lorenzo', last_name: 'Speranzoni', born: 19741120})

CREATE (c:CITY {name: 'Mestre', province: 'Venice', region: 'Veneto', country: 'Italy'})

MATCH (lorenzo:PERSON {last_name: 'Speranzoni'}), (mestre:CITY {name: 'Mestre'})
CREATE (lorenzo)-[:LIVES_IN]->(mestre)

MATCH (lorenzo:PERSON {last_name: 'Speranzoni'}), (van_gogh:ARTIST {last_name: 'Van Gogh'})
CREATE (lorenzo)-[:LIKES]->(van_gogh)

MATCH (lorenzo:PERSON {last_name: 'Speranzoni'}), (the_potato_eaters:ARTWORK {title: 'The Potato Eaters I'})
CREATE (lorenzo)-[:LIKES]->(the_potato_eaters)

Finally, I can POST some photos:

CREATE (m:MUSEUM {name: 'Musée d\'Orsay', director: 'Serge Lemoine', address: 'Rue de Lille 75343 Paris, France', website: 'http://www.musee-orsay.fr/en/', wikipedia: 'http://en.wikipedia.org/wiki/Mus%C3%A9e_d%27Orsay', latitude: 48.86, longitude: 2.327});

MATCH (m:MUSEUM {name: 'Musée d\'Orsay'}), (c:CITY {name: 'Paris'})
CREATE (m)-[:LOCATED_IN]->(c);

MATCH (lorenzo:PERSON {last_name: 'Speranzoni'}), (musee_orsay:MUSEUM {name: 'Musée d\'Orsay'})
CREATE (lorenzo)-[:LIKES]->(musee_orsay)

MATCH (lorenzo:PERSON {last_name: 'Speranzoni'}), (musee_orsay:MUSEUM {name: 'Musée d\'Orsay'})
CREATE (lorenzo)-[:VISITED {date: 20130828}]->(musee_orsay)

CREATE (lorenzo)-[:POSTED {media_type: 'image', url: 'http://www.flickr.com/photos/inserpio/12340140213/' }]->(musee_orsay);

MATCH (lorenzo:PERSON {last_name: 'Speranzoni'}), (musee_orsay:MUSEUM {name: 'Musée d\'Orsay'})
CREATE (lorenzo)-[:POSTED {media_type: 'image', url: 'http://www.flickr.com/photos/inserpio/12340129353/' }]->(musee_orsay);

MATCH (lorenzo:PERSON {last_name: 'Speranzoni'}), (auvers_sur_oise:CITY {name: 'Auvers-sur-Oise'})
CREATE (lorenzo)-[:POSTED {media_type: 'image', url: 'http://www.flickr.com/photos/inserpio/12340356925/' }]->(auvers_sur_oise);

MATCH (lorenzo:PERSON {last_name: 'Speranzoni'}), (auvers_sur_oise:CITY {name: 'Auvers-sur-Oise'})
CREATE (lorenzo)-[:POSTED {media_type: 'image', url: 'http://www.flickr.com/photos/inserpio/12340339575/' }]->(auvers_sur_oise);

MATCH (lorenzo:PERSON {last_name: 'Speranzoni'}), (auvers_sur_oise:CITY {name: 'Auvers-sur-Oise'})
CREATE (lorenzo)-[:POSTED {media_type: 'image', url: 'http://www.flickr.com/photos/inserpio/12340350135/' }]->(auvers_sur_oise);

MATCH (lorenzo:PERSON {last_name: 'Speranzoni'}), (auvers_sur_oise:CITY {name: 'Auvers-sur-Oise'})
CREATE (lorenzo)-[:POSTED {media_type: 'image', url: 'http://www.flickr.com/photos/inserpio/12340481073/' }]->(auvers_sur_oise);

… and inquiry for LIKES and POSTS from Italian people:

MATCH (person:PERSON)-[:LIVES_IN]->(city:CITY {country: 'Italy'})
WITH person, city
MATCH (person)-[likes_or_posted:LIKES|POSTED]->(something_he_or_she_likes)
RETURN person, city, likes_or_posted, something_he_or_she_likes
neo4art - likes and photos

neo4art – likes and photos

Attachment: 

THIS BLOG SAMPLE:

  1. neo4art-blog-sample-data.cql

FULL VAN GOGH ARTWORK:

  1. neo4art-van-gogh-full.zip

References:

  1. http://www.neo4j.org/
  2. http://jimwebber.org/2014/01/starting-graph-databases-with-neo4j-2-0/
  3. http://docs.neo4j.org/chunked/milestone/cypher-query-lang.html
  4. http://en.wikipedia.org/wiki/Vincent_van_Gogh
  5. http://www.vggallery.com/
  6. http://www.wikipaintings.org/en/vincent-van-gogh

5 thoughts on “Neo4Art – Van Gogh’s Journey in a Neo4j Graph Database

  1. Pingback: Neo4Art – Van Gogh’s Journey (in a Neo4j GraphDB) - Neo Technology

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s