Main Content

Neo4jNode

Neo4j database node

Description

After creating a Neo4j® database connection using the MATLAB® interface to Neo4j, explore nodes in the database. With a Neo4jNode object, you can explore the node degree and relationship types of the nodes in the database.

Creation

Create a Neo4jNode object using the createNode, searchNodeByID, and searchNode functions.

Properties

expand all

This property is read-only.

Node identifier for the unique node in the Neo4j database, specified as a double.

Data Types: double

This property is read-only.

Node data consisting of property keys and values for the unique node in the Neo4j database, specified as a structure.

Data Types: struct

This property is read-only.

Node labels of the unique Neo4j database node, specified as a character vector for one label or as a cell array of character vectors for multiple labels.

Data Types: char | cell

Object Functions

nodeDegreeIn-degree and out-degree for each associated relationship type for Neo4j database node
nodeRelationTypesAssociated relationship types for Neo4j database node

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.

Search the database for the node with the node identifier 2 by 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 with these properties:

  • Node identifier

  • Node data

  • Node labels

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

nodeinfo.NodeData
ans = 

  struct with fields:

    name: 'User2'

Version History

Introduced in R2016b