Neo4jRelation
Neo4j database relationship
Description
The Neo4jRelation
object represents a single relationship in
a Neo4j® database. Use this object to find information about the relationship
between two nodes in a Neo4j database.
Creation
Create a Neo4jRelation
object using the createRelation
, searchRelation
, and searchRelationByID
functions.
Properties
RelationID
— Relationship identifier
numeric scalar
This property is read-only.
Relationship identifier, specified as a numeric scalar. The Neo4j database assigns this number automatically.
Example:
3
Data Types: double
RelationData
— Relationship data
structure
This property is read-only.
Relationship data consisting of property keys and values for the unique relationship in the Neo4j database, specified as a structure. If the relationship has no properties, then this structure contains no fields.
Data Types: struct
StartNodeID
— Start node identifier
numeric scalar
This property is read-only.
Start node identifier, specified as a numeric scalar. This number specifies the start node of the Neo4j database relationship.
Example:
3
Data Types: double
RelationType
— Relationship type
character vector
This property is read-only.
Relationship type, specified as a character vector. This character vector specifies the type of the Neo4j database relationship.
Example: 'knows'
Data Types: char
EndNodeID
— End node identifier
numeric scalar
This property is read-only.
End node identifier, specified as a numeric scalar. This number specifies the end node of the Neo4j database relationship.
Example:
7
Data Types: double
Examples
Search Neo4j Database by Relationship Identifier
Search for information about a Neo4jRelation
object in a Neo4j® database and display the information.
Assume that you have graph data stored in a Neo4j database that represents a social neighborhood. This database has seven nodes and eight relationships. Each node has only one unique property key name
with values User1
through User7
. Each relationship has the type knows
.
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
. The blank Message
property indicates a successful connection.
neo4jconn.Message
ans = []
Search the database for the relationship with the identifier 3
by using the Neo4j database connection.
relationid = 3; relinfo = searchRelationByID(neo4jconn,relationid)
relinfo = Neo4jRelation with properties: RelationID: 3 RelationData: [1×1 struct] StartNodeID: 1 RelationType: 'knows' EndNodeID: 3
relinfo
is a Neo4jRelation
object with these properties:
Relationship identifier
Relationship data
Start node identifier
Relationship type
End node identifier
Access the property keys and values of the relationship using the property RelationData
. Here, the relationship does not contain properties, so the structure has no fields.
relinfo.RelationData
ans = struct with no fields.
Version History
Introduced in R2018a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)