Neo4j Movies Demo App in java with server-extension
HTML Java
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitignore
Readme.adoc
index.html
pom.xml

Readme.adoc

Neo4j Movies Example Application

Stack

  • Neo4j-Server Extension

  • Jersey JAX-RS Resource

  • Neo4j-Execution-Engine with Cypher

  • Neo4j-Server

  • Frontend: jquery, bootstrap, d3.js

Endpoints:

Get Movie

// JSON object for single movie with cast
curl http://localhost:7474/movie/The%20Matrix

// list of JSON objects for movie search results
curl http://localhost:7474/movie/search?q=matrix

// JSON object for whole graph viz (nodes, links - arrays)
curl http://localhost:7474/movie/graph?limit=100

Setup

JAX-RS is a RESTful resource library in the JDK that allows you to specify classes as mapped resources and their methods as concrete endpoints for these resources.

Those methods can be passed parameters from the http request but also injected services from the underlying system - in our case GraphDatabaseService. The endpoint method will then use the services with the parameters to execute its task and return a representation of the result data to be consumed by the client.

In our case we just get an instance of the GraphDatabaseService to execute Cypher queries with parameters. The results of the queries are converted into JSON and returned.

Run locally:

Build the project with

mvn package

Then copy the generated jar-file in target/neo4j-movies-3.0-SNAPSHOT.jar into the plugins directory of your server /path/to/neo4j/plugins. To register the extension you have to edit the /path/to/neo4j/conf/neo4j-server.properties and add a line like this:

dbms.unmanaged_extension_classes=example.extension.movies=/movie

which registers the package example.extension.movies of our resource for the /movie root context.

The src/main/webapp/index.html page can be served with any web-server, e.g. by running python -m SimpleHTTPServer 8080 in that directory.

You can search for movies by title or and click on any entry.