deleteRelation
Delete relationships from Neo4j database
Description
Examples
Delete Relationship from Neo4j Database
Create a single relationship between two nodes in a Neo4j® database. Then, delete the relationship and the corresponding nodes.
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 = []
Create two nodes in the Neo4j database using the Neo4j database connection. Use the 'Labels'
name-value pair argument to specify the Person
node label for each node.
label = 'Person'; startnode = createNode(neo4jconn,'Labels',label); endnode = createNode(neo4jconn,'Labels',label);
Create a relationship between the two nodes using the Neo4j database connection. These nodes represent two colleagues who work together. Specify the relationship type as works with
.
relationtype = 'works with';
relation = createRelation(neo4jconn,startnode,endnode,relationtype)
relation = Neo4jRelation with properties: RelationID: 17 RelationData: [1×1 struct] StartNodeID: 52 RelationType: 'works with' EndNodeID: 6
relation
is a Neo4jRelation
object with these properties:
Relationship identifier
Relationship data
Start node identifier
Relationship type
End node identifier
Delete the relationship.
deleteRelation(neo4jconn,relation)
Delete the two nodes by using a Neo4jNode
object array.
nodes = [startnode,endnode]; deleteNode(neo4jconn,nodes)
Close the database connection.
close(neo4jconn)
Input Arguments
neo4jconn
— Neo4j database connection
Neo4jConnect
object
Neo4j database connection, specified as a Neo4jConnect
object created with the function neo4j
.
relation
— Relationship
Neo4jRelation
object | Neo4jRelation
object array | numeric scalar | numeric vector
Relationship in a Neo4j database, specified as a Neo4jRelation
object, Neo4jRelation
object array, numeric
scalar, or numeric vector. For a single relationship, use a
Neo4jRelation
object or a numeric scalar that contains the
relationship identifier. For multiple relationships, use a
Neo4jRelation
object array or a numeric vector that contains an
array of relationship identifiers.
Example: 15
Example: [15,16,17]
Version History
Introduced in R2018a
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
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)