Spring Data Neo4J

Spring Data Neo4j

Spring Data Neo4j enables POJO based development for the Graph Database Neo4j. It maps annotated entity classes to the Neo4j Graph Database with advanced mapping functionality. The template programming model is equivalent to well known Spring templates and builds the basis for interaction with the graph and is also used for the advanced repository support.
Spring Data Neo4j is part of the Spring Data project which aims to provide convenient support for NoSQL databases.

#maven
Spring Data Neo4j logo

"I’m excited about Spring Data Neo4j ... Spring Data Neo4j makes working with Neo4j amazingly easy, and therefore has the potential to make you more successful as a developer. ... I encourage you to explore Spring Data, and — better still — become involved in the community and contribute."

Rod Johnson, Founder, Spring and SVP, Application Platform, VMware

Spring Data Neo4j is released under the Apache Software License. Its source code is hosted on github. Several examples can also be found there. A set of developer notes as quick-lookup reference card provides essential information.
Issue tracker and discussion forums are provided at springsource.org. You can follow @SpringData and @Neo4j on twitter and also subscribe to the Neo4j discussion group for more information.

Neo4j Logo

Latest News

Webinars

Here is an overview of Spring Data Neo4j features

  • Support for property graphs (nodes connected via relationships, each with arbitrary properties)
  • Object-Graph-Mapping of annotated POJO entities
  • additional advanced mapping mode via AspectJ
  • Neo4jTemplate with convenient API, exception translation and optional transaction management
  • extensive Spring Data Commons Repositories Support, including annotated, derived and geospatial finder methods
  • Dynamic type projections (duck typing)
  • Supports the Cypher and Gremlin query languages
  • Different type representation strategies for keeping type information in the graph
  • Cross-store support for partial JPA - Graph Entities
  • Neo4j Traversal support on dynamic fields and via repository methods
  • Neo4j Indexing support (including unique entities, full-text, spatial and numeric range queries)
  • Support for transparently accessing the Neo4j Server via its REST API
  • Support for running as extensions in the Neo4j Server

Getting Started

For a quick introduction please have a look at the five minute introduction and check out the examples. For a more comprehensive tutorial enjoy our Spring Data Neo4j Guide Book "Good Relationships" and glance at our Developer Notes.
Here is just a quick teaser.

Example

 @NodeEntity
 public class Movie {

    @GraphId Long id;

    @Indexed(type = FULLTEXT, indexName = "search")
    String title;

    Person director;

    @RelatedTo(type="ACTS_IN", direction = INCOMING)
    Set<Person> actors;

    @RelatedToVia(type = "RATED")
    Iterable<Rating> ratings;

    @Query("start movie=node({self}) match
            movie-->genre<--similar return similar")
    Iterable<Movie> similarMovies;
 }

Repositories

 interface MovieRepository extends GraphRepository<Movie> {
  @Query("start movie={0} match m<-[rating:RATED]-user
        return rating")
  Iterable<Rating> getRatings(Movie movie);
  // Co-Actors
  Iterable<Person> findByActorsMoviesActorName(name)
 }

 <neo4j:repositories base-package="com.example.dao"/>
 
    
 @Autowired MovieRepository repo;
    
 Iterable<Movie> movies = repo.findAll();
 Movie movie = repo.findByPropertyValue("title","Matrix");
 repo.save(movie);
 
 Iterable<Rating> ratings = repo.getRatings(movie);

Social movie database tutorial - cineasts.net

The Social Movie Database Webapp uses the Spring Framework, Spring Data Neo4j and Neo4j based on data from themoviedb.org.
The application is documented in the Spring Data Neo4j Guide Book, and its source code available on GitHub as part of the Spring Data Neo4j examples.

Spring Data Neo4j Guide Book - "Good Relationships"

Despite being just a library Spring Data Neo4j comes with a real Guide Book, featuring:

Blogs

Maven Artifacts

Stable Release

    <dependency>
 <groupId>org.springframework.data</groupId>
 <artifactId>spring-data-neo4j</artifactId>
 <version>2.2.0.RELEASE</version>
</dependency>

 

Milestone Release

<repository>
 <id>spring-snapshot</id>
 <name>Spring Maven SNAPSHOT Repository</name>
 <url>http://repo.springsource.org/libs-milestone</url>
</repository>

<dependency>
 <groupId>org.springframework.data</groupId>
 <artifactId>spring-data-neo4j</artifactId>
 <version>2.2.0.RELEASE</version>
</dependency>

 

Snapshot Release

<repository>
 <id>spring-snapshot</id>
 <name>Spring Maven SNAPSHOT Repository</name>
 <url>http://repo.springsource.org/libs-snapshot</url>
</repository>

<dependency>
 <groupId>org.springframework.data</groupId>
 <artifactId>spring-data-neo4j</artifactId>
 <version>2.3.0.BUILD-SNAPSHOT</version>
</dependency>

 

Current Stable Release (2.2.0.RELEASE)

Nightly Builds (2.3.0.BUILD-SNAPSHOT)

Spring Data

Spring Data makes it easier to build Spring-powered applications that use new data access technologies such as non-relational databases, map-reduce frameworks, and cloud based data services as well as provide improved support for relational database technologies.

Spring Data is an umbrella open source project which contains many subprojects that are specific to a given database. The projects are developed by working together with many of the companies and developers that are behind these exciting technologies.

Now available from O'Reilly Media is the book:

Spring Data: Modern Data Access for Enterprise Java.

 Spring Data

Spring Data Projects:

Category Sub-project  
Relational Databases JPA Spring Data JPA - Simplifies the development of creating a JPA-based data access layer
  JDBC Extensions Support for Oracle RAC, Advanced Queuing, and Advanced datatypes. Support for using QueryDSL with JdbcTemplate.
     
Big Data Apache Hadoop The Apache Hadoop project is an open-source implementation of frameworks for reliable, scalable, distributed computing and data storage.
     
Data-Grid GemFire VMware vFabric GemFire is a distributed data management platform providing dynamic scalability, high performance, and database-like persistence. It blends advanced techniques like replication, partitioning, data-aware routing, and continuous querying.
     
HTTP REST Spring Data REST - Perform CRUD operations of your persistence model using HTTP and Spring Data Repositories.
     
Key Value Stores Redis Redis is an open source, advanced key-value store.
     
Document Stores MongoDB MongoDB is a scalable, high-performance, open source, document-oriented database.
     
Graph Databases Neo4j Neo4j is a graph database, a fully transactional database that stores data structured as graphs.
     
Column Stores HBase Apache HBase is an open-source, distributed, versioned, column-oriented store modeled after Google' Bigtable. HBase functionality is part of the Spring for Apache Hadoop project.
     
Common Infrastructure Commons Provides shared infrastructure for use across various data access projects. General support for cross-database persistence is located here
     

Community-driven projects:

Sub-project  
Spring Data Solr Spring Data repositories abstraction for Apache Solr
Spring Data Elasticsearch Spring Data repositories abstraction for Elasticsearch
Spring Data Couchbase Spring Data repositories abstraction for Couchbase
Spring Data FuzzyDB Spring Data repositories abstraction for FuzzyDB

Attic

The Attic contains links to Spring Data projects that are no longer maintained.

Participation

Please reach out on the forums or JIRA with specific questions,requests, and expressing interest to participate in development on github at http://github.com/SpringSource.

Twitter

Follow SpringData on Twitter: SpringData

Follow the team members on Twitter

 

 

Syndicate content