Git Product home page Git Product logo

movies-java-bolt's Introduction

Neo4j Movies Application: Quick Start

CI
movie application

This example application demonstrates how easy it is to get started with Neo4j in Java.

It is a very simple web application that uses our Movie graph dataset to provide a search with listing, a detail view and a graph visualization.

The Stack

These are the components of our Web Application:

  • Application Type: Java-Web Application

  • Web framework: Spark-Java (Micro-Webframework)

  • Neo4j Database Connector: Neo4j-Java-Driver for Cypher Docs

  • Database: Neo4j-Server (5.x) with multi-database

  • Frontend: jquery, bootstrap, d3.js

Provision a database quickly with Neo4j Sandbox or Neo4j Aura.

Endpoints:

Get Movie

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

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

// JSON object for whole graph viz (nodes, links - arrays)
curl http://localhost:8080/graph

Setup

Make sure to install a JDK 17+ and Apache Maven.

Run locally

Just run:

mvn compile exec:java

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

Or better you can run Neo4j locally to experiment with your own data. Start your local Neo4j Server in Neo4j Desktop (Download & Install), open Neo4j Browser. After logging in, install the Movies graph data set by entering the :play movies command, click the CREATE-statement, and hit the triangular "Run" button.

Configuration options

Environment variable name Default value (or N/A)

PORT

8080

NEO4J_URI

neo4j+s://demo.neo4jlabs.com

NEO4J_USER

movies

NEO4J_PASSWORD

movies

NEO4J_DATABASE

movies

movies-java-bolt's People

Contributors

bigmontz avatar dependabot-preview[bot] avatar dependabot[bot] avatar fbiville avatar flefevre avatar gjmwoods avatar injectives avatar jexp avatar lydianeu avatar netrebel avatar robsdedude avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

movies-java-bolt's Issues

Blurb in Readme.adoc about editing Util.java is invisible on GitHub

On GitHub, the following blurb in Readme.adoc is invisible:

Please edit example.movies.util.Util.java to add your connection settings, for instance "bolt://neo4j:neo4j@localhost"

Because of the back apostrophes in front of it? In any case, it took me a while to look at the copy of Readme.adoc on my computer to find that important little piece of info.

Compilation failed: cannot find IteratorUtil from org.neo4j.helpers.collection

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project neo4j-movies: Compilation failure
.../projects/neo4j-movies-java-bolt/src/main/java/example/movies/backend/MovieService.java:[5,36] cannot find symbol
  symbol:   class IteratorUtil
  location: package org.neo4j.helpers.collection

        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
java -version
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)

Complement the example with data creation

Dear @jexp,
I loved this example it is simple and elegant do you have and example of using the example.movies.executor.CypherExecutor to add data to the database ?
As this example is just reading data the 3 methods of the example.movies.backend.MovieService to only retrieval of data, can I use the CypherExecutor.query method also to insert data in the database ?

Thank you, kindly
Luis Oscar

The requested route [/app/] has not been mapped in Spark

Hi,

I have configured the steps as mentioned in the github and mvn compile exec:java also compiles successfully. However, going to http://localhost:8080/app/ gives a 404 error in the browser and "INFO spark.http.matching.MatcherFilter - The requested route [/app/] has not been mapped in Spark" error in the backend. How can this issue be resolved ?

Here's the log:

Puneets-MBP:neo4j-movies-java-bolt puneetl$ mvn compile exec:java
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Neo4j Movies Demo 3.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ neo4j-movies ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ neo4j-movies ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 6 source files to /Users/puneetl/Documents/github/neo4j-movies-java-bolt/target/classes
[WARNING] /Users/puneetl/Documents/github/neo4j-movies-java-bolt/src/main/java/example/movies/backend/MovieServer.java: Some input files use or override a deprecated API.
[WARNING] /Users/puneetl/Documents/github/neo4j-movies-java-bolt/src/main/java/example/movies/backend/MovieServer.java: Recompile with -Xlint:deprecation for details.
[INFO]
[INFO] >>> exec-maven-plugin:1.2.1:java (default-cli) > validate @ neo4j-movies >>>
[INFO]
[INFO] <<< exec-maven-plugin:1.2.1:java (default-cli) < validate @ neo4j-movies <<<
[INFO]
[INFO] --- exec-maven-plugin:1.2.1:java (default-cli) @ neo4j-movies ---
11:24:28.391 [example.movies.backend.MovieServer.main()] INFO spark.staticfiles.StaticFilesConfiguration - External StaticResourceHandler configured with folder = src/main/webapp
11:24:28.581 [example.movies.backend.MovieServer.main()] DEBUG spark.route.Routes - Adds route: get, /movie/:title, spark.RouteImpl$1@6986c54
11:24:28.584 [example.movies.backend.MovieServer.main()] DEBUG spark.route.Routes - Adds route: get, /search, spark.RouteImpl$1@7f135c7f
11:24:28.586 [example.movies.backend.MovieServer.main()] DEBUG spark.route.Routes - Adds route: get, /graph, spark.RouteImpl$1@dcab0f3
11:24:28.714 [Thread-1] INFO spark.embeddedserver.jetty.EmbeddedJettyServer - == Spark has ignited ...
11:24:28.717 [Thread-1] INFO spark.embeddedserver.jetty.EmbeddedJettyServer - >> Listening on 0.0.0.0:8080
11:24:38.635 [qtp72681950-16] INFO spark.http.matching.MatcherFilter - The requested route [/app/] has not been mapped in Spark

Cannot compile application

Dear folks,
I have downloaded applicaiton and tried to compiled it, I am facing with classNotFound Exception.

As below:

java.lang.ClassNotFoundException: example.jdbc.movies.MovieServer
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:285)
at java.lang.Thread.run(Thread.java:745)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.404 s
[INFO] Finished at: 2016-09-08T17:33:29+08:00
[INFO] Final Memory: 10M/24M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project neo4j-movies: An exception occured while executing the Java class. example.jdbc.movies.MovieServer -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

I have checked this class, but seems no such as class like this, MovieServer class belong to
example.movies.backend.MovieServer.

Appreciate for your promt action.

example.jdbc.movies.MovieServer

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.