Reading Time: 9 minutes

Neo4J is a leading, open source graph database designed to leverage relationships as first-class entities. It was initially developed in 2000, and became an open source project in 2007. Since then, it has been adopted by over thousands of organizations including Walmart, Marriott, UBS, Cisco, HP, and eBay.

As the most popular graph database rated by DB Engines, the common use cases for Neo4J vary from real-time recommendations and  to fraud detection and identity and access management. For existing customers and others interested in exploring Neo4J, we are thrilled to announce the release of the Anypoint Connector for Neo4J.

latest report
Learn why we are the Leaders in management and iPaaS

In this blog, I'd like to walk you through a simple demo app to show you how to use the Neo4J Connector. 

Part 1: Installing and Configuring the Neo4J Connector

1. Before you start with the demo app, please make sure you download Neo4J Connector v2.0.0 from Anypoint Exchange.

2. After you install the Neo4J Connector and import the demo app into Studio, you will see the following flows.

3. Let us configure this Neo4J Connector first. If you go to Global Elements, you will find “Neo4J.” After selecting “Neo4J,” please click on “Edit.”

4. In the Neo4J configuration, you can specify your configuration of the Neo4J server. You could directly add your Neo4J information in the configuration, but I recommend you use the properties file to add your configuration information. include the following keys-value pairs:

config.boltUrl=bolt:// (you can find the port information in neo4j.conf)

Part 2: Download Neo4J Sandbox and Run Demo App 

For this demo, I will use the Neo4J Sandbox locally installed on my machine. You can simply download the Neo4J Sandbox from the Neo4J website, and create the Movie Graph in . After you complete configuration for your Neo4J environment, let us run this app.

Neo4J Connector offers the following operations: CRUD operations on nodes and executing a Cypher Query Language (CQL). CRUD operations help you execute a simple CQL on nodes, so you don't have to know the CQL language. In addition, the connector enables you to execute any complex CQL statements

1. Let us try to create, update, delete a node. You can create a person with a name and a year he was born in the Movie Graph.

2. Once you send these parameters to localhost:8081/createNode, you can see “Nathan Nam” is created through your Neo4J browser ().

3. If you want to update the year the person was born, you can update the person with the “Update Nodes” operation.

4. Once you send these parameters to localhost:8081/updateNode, you can see that the year “Nathan Nam” was born changed from 2000 to 1990 in the Neo4J browser.

5. Now, you can simply delete the person by sending the following parameters to localhost:8081/deleteNode.

6. You can also use more complicated CQL statements with the connector, let me show you how. The Movie Graph has various data for movies, actors, and directors. You can get a list of movies released in 1990s with the following CQL statement. The connector will replace {startYear} and {endYear} with query parameters, and send the CQL statement to Neo4J. (You can find more information of query parameters here.)

Parameterized CQL statement

“MATCH (nineties:Movie) WHERE nineties.released > {startYear}{endYear} RETURN nineties.title”


     "startYear" : inboundProperties."http.query.params".startyear as :number,
      "endYear" : inboundProperties."http.query.params".endyear as :number

When you send the following parameters to localhost:8081/getNinetiesMovies, you will receive a list of movies from the nineties.

Let us suppose you are in the movie business and are looking for co-actors for Keanu Reeves. There are various ways to find suitable co-actors, but one hypothesis you could use is “Find actors that Keanu Reeves hasn't yet worked with, but his co-actors have.”

Parameterized CQL statement

MATCH (actor:Person {name:{actor}})-[:ACTED_IN]->(m)<-[:ACTED_IN]-(coActors),


WHERE NOT (actor)-[:ACTED_IN]->()<-[:ACTED_IN]-(cocoActors) AND actor <> cocoActors

RETURN AS Recommended, count(*) AS Strength ORDER BY Strength DESC

     "actor" : inboundProperties."http.query.params".name

If I can demystify this CQL statement, it says “find co-actors (cocoActors) who have not yet worked with Keanu Reeves, but his co-actors have worked with, count the number of events or movies as “Strength”, and return a list of co-actors (cocoActors) by the descending order of the “Strength.”

7. When you send the following parameter to localhost:8081/getRecommendations, you will receive a list of the recommended co-actors for Keanu Reeves.

Let us take a pause here. Although this demo only talked about actors and movies, you can apply this recommendation to your own customers and business. With a graph database, you can immediately provide relevant recommendations to your website visitors by combining their browsing behaviors and demographics with their buying history, and analyzing their current choices on the fly.

We hope this demo gave you a great insight into the Neo4J connector. For new users, try the above example to get started, and for others, please share with us how you are planning to use the Neo4J Connector!