Samples
Introduction
Spring Data Graph comes with a number of samples.
The source code of the samples is found on
GitHub.
The different sample projects are introduced below.
Hello Worlds sample
The Hello Worlds sample application is a simple console application with unit tests, that
creates some Worlds (entities / nodes) and Rocket Routes (relationships) in a Galaxy (graph)
and then reads them back and prints them out.
The unit tests demonstrate some other features of Spring Data Graph. The sample comes with a
minimal configuration for Maven and Spring to get up and running quickly.
Executing the application creates the following graph in the Graph Database:
IMDB sample
A web application that imports datasets from the Internet Movie Database (IMDB) into
the
graph database. It allows listings of movies with their actors and actors with their roles in
different movies. It also uses graph traversal operations to calculate the Kevin Bacon number
(distance to an actor that has acted with Kevin Bacon). This sample application shows the
basic usage of Spring Data Graph in a more complex setting with several annotated entities and
relationships as well as usage of indices and graph traversal.
See the readme file for instruction on how to compile and run the application.
An excerpt of the data stored in the Graph Database after executing the application:
MyRestaurant sample
Simple, JPA based web application for managing users and restaurants, with the ability to add
restaurants as favorites to a user.
MyRestaurant-Social sample
An extended version of the MyRestaurant sample application that adds social networking
functionality to it. It is possible to have friends and to add rated relationships to
restaurants. The relationships and some of the properties of the entities are transparently
stored in the graph database. There is also a graph traversal that provides a recommendation
based on your friends' (and their friends') rating of restaurants.
An excerpt of the data stored in the Graph Database after executing the application: