Documentation

This is machine translation

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

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

executeCypher

Execute Cypher query on Neo4j database

Syntax

results = executeCypher(neo4jconn,query)

Description

example

results = executeCypher(neo4jconn,query) returns data from the Neo4j® database using the Neo4j database connection neo4jconn and a Cypher® query. You can execute a Cypher query on the Neo4j database using the Cypher Query Language.

Examples

collapse 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);

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

neo4jconn.Message
ans =

     []

The blank Message property indicates a successful connection.

Create the Cypher® query that searches for the names of all nodes with the node label Person.

query = 'MATCH (node:Person) RETURN node.name';

Execute the query and display the results using the Neo4j® database connection neo4jconn.

results = executeCypher(neo4jconn,query)
results = 

    node_name
    _________

    'User1'  
    'User3'  
    'User2'  
    'User4'  
    'User5'  
    'User6'  
    'User7'  

results is a table that contains the column node_name. This column has the names of each node in the Neo4j® database.

Input Arguments

collapse all

Neo4j database connection, specified as a Neo4jConnect object created using the function neo4j.

Cypher query, specified as a character vector or string scalar.

Example: 'MATCH (movie: Movie {title: ''The Matrix''}) RETURN movie.title, movie.studio'

Data Types: char | string

Output Arguments

collapse all

Cypher query results, returned as a table. The columns in the table match the RETURN statement in the Cypher query.

Introduced in R2016b

Was this topic helpful?