This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.


Neo4j database connection


Create a Neo4j® database connection using the MATLAB® interface to Neo4j. Explore the graph database or perform graph analytics using the MATLAB directed graph.

With a Neo4jConnect object, you can perform these tasks:

  • Explore the graph database for nodes and relationships.

  • Search the graph database for nodes, relationships, or a subgraph.

  • Execute a Cypher® query.


Create a Neo4jConnect object using neo4j.


expand all

Neo4j database connection URL that contains the server, port number, and web location of the Neo4j database, specified as a character vector.

Example: http://localhost:7474/db/data where localhost is the server, 7474 is the port number, /db/data is the web location of the database

Data Types: char

User name for accessing the Neo4j database, specified as a character vector.

Data Types: char

Error message, specified as a character vector. If this property is empty, the database connection is successful.

Data Types: char

Object Functions

nodeLabelsAll node labels in Neo4j database
relationTypesAll relationship types in Neo4j database
propertyKeysAll property keys in Neo4j database
searchNodeByIDSearch for Neo4j database node by node identifier
searchNodeSearch Neo4j database nodes by label or by property key and value
searchRelationSearch relationships for Neo4j database node
searchGraphSearch for subgraph or entire graph in Neo4j database
executeCypherExecute Cypher query on Neo4j database


expand all

Create a Neo4j® database connection using the URL http://localhost:7474/db/data, user name neo4j, and password matlab.

url = 'http://localhost:7474/db/data';
username = 'neo4j';
password = 'matlab';

neo4jconn = neo4j(url,username,password)
neo4jconn = 

  Neo4jConnect with properties:

         URL: 'http://localhost:7474/db/data/'
    UserName: 'neo4j'
     Message: []

Check the Message property of the Neo4j® connection object neo4jconn.

ans =


The blank Message property indicates a successful connection.

neo4j returns a Neo4jConnect object with these properties:

  • URL -- The Neo4j® database web location

  • UserName -- The user name used to connect to the database

  • Message -- Any database connection error messages

The blank Message property indicates a successful Neo4j® database connection.

Introduced in R2016b

Was this topic helpful?