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.


Search for Neo4j database node by node identifier


nodeinfo = searchNodeByID(neo4jconn,nodeid)



nodeinfo = searchNodeByID(neo4jconn,nodeid) creates the Neo4jNode object using the Neo4j® database connection neo4jconn and the node identifier nodeid.


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.

ans =


The blank Message property indicates a successful connection.

Search the database for the node with node identifier 2 using the Neo4j® database connection neo4jconn.

nodeid = 2;

nodeinfo = searchNodeByID(neo4jconn,nodeid)
nodeinfo = 

  Neo4jNode with properties:

        NodeID: 2
      NodeData: [1×1 struct]
    NodeLabels: 'Person'

nodeinfo is a Neo4jNode object that contains these properties:

  • Node identifier

  • Node data

  • Node labels

Access the property keys and values of the node using the property NodeData.

ans = 

  struct with fields:

    name: 'User2'

Input Arguments

collapse all

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

Neo4j database node identifier, specified as a numeric scalar that denotes one specific node in the Neo4j database. If a node identifier is unknown, search for nodes using searchNode and relationships using searchRelation.

Data Types: double

Output Arguments

collapse all

Node information for one node in the Neo4j database, returned as a Neo4jNode object. You can use this node as the origin node for searching the Neo4j database.

Introduced in R2016b

Was this topic helpful?