removeRelationProperty
Remove properties from relationships in Neo4j database
Syntax
Description
removeRelationProperty(
removes properties from one or more relationships in a Neo4j® database using a Neo4j database connection.neo4jconn
,relation
,propertyNames
)
returns updated relationship information as a relationinfo
= removeRelationProperty(neo4jconn
,relation
,propertyNames
)Neo4jRelation
object for one relationship or as a table for multiple relationships.
Examples
Remove One Relationship Property
Remove one property from a single relationship in a Neo4j® database and access the relationship.
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 = []
Retrieve the second node in the table of node information. This node has the label Person
.
nlabel = "Person";
nodeinfo = searchNode(neo4jconn,nlabel);
node = nodeinfo.NodeObject(2);
Find the outgoing relationship from the origin node.
direction = "out";
relinfo = searchRelation(neo4jconn,node,direction);
relation = relinfo.Relations.RelationObject;
Set the StartDate
property for a single relationship in the database using the Neo4j database connection.
properties.StartDate = "01/01/2018";
setRelationProperty(neo4jconn,relation,properties)
Display the relationship information for the updated relationship.
relinfo = searchRelation(neo4jconn,node,direction); relinfo.Relations.RelationData{1}
ans = struct with fields:
StartDate: '01/01/2018'
Remove the relationship property.
propertyNames = "StartDate";
removeRelationProperty(neo4jconn,relation,propertyNames)
Display the relationship information for the updated relationship.
relinfo = searchRelation(neo4jconn,node,direction); relinfo.Relations.RelationData{1}
ans = struct with no fields.
Close the database connection.
close(neo4jconn)
Remove Multiple Relationship Properties and Return Output
Remove relationship properties from multiple relationships in a Neo4j® database. Access the updated relationship information using an output argument.
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 = []
Find the origin node with the node identifier 3
and retrieve its node information.
nodeid = 3; nodeinfo = searchNodeByID(neo4jconn,nodeid);
Find the outgoing relationships from the origin node.
direction = "out";
relinfo = searchRelation(neo4jconn,nodeinfo,direction);
relation = relinfo.Relations.RelationObject;
Set the StartDate
and EndDate
properties for the outgoing relationships using the Neo4j database connection.
properties.StartDate = "01/01/2018"; properties.EndDate = "12/31/2018"; relationinfo = setRelationProperty(neo4jconn,relation,properties);
Display the relationship information for the two updated relationships.
relationinfo.RelationData{1:2}
ans = struct with fields:
StartDate: '01/01/2018'
EndDate: '12/31/2018'
ans = struct with fields:
StartDate: '01/01/2018'
EndDate: '12/31/2018'
Remove the relationship properties using the property names. The relationinfo
output argument is a Neo4jRelation
object.
propertyNames = ["StartDate" "EndDate"]; relationinfo = removeRelationProperty(neo4jconn,relation,propertyNames);
Display the relationship information for the two updated relationships.
relationinfo.RelationData{1:2}
ans = struct with no fields.
ans = struct with no fields.
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]
propertyNames
— Property names
character vector | cell array of character vectors | string scalar | string array
Property names, specified as a character vector, cell array of character vectors, string scalar, or string array. For one property, use a character vector or string scalar. For multiple properties, use a cell array of character vectors or a string array.
Example: "Analyst"
Example: ["Analyst" "Clerk"]
Data Types: char
| string
Output Arguments
relationinfo
— Relationship information
Neo4jRelation
object | table
Relationship information, returned as a Neo4jRelation
object for one relationship or as a table for multiple
relationships.
For multiple relationships, the table contains these variables:
StartNodeID
— Node identifier of the start node for each matched relationshipRelationType
— Character vector that denotes the relationship type for each matched relationshipEndNodeID
— Node identifier of the end node for each matched relationshipRelationData
— Structure array that contains property keys associated with each matched relationshipRelationObject
—Neo4jRelation
object for each matched relationship
The row names in the table are Neo4j relationship identifiers.
Version History
Introduced in R2019a
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 (한국어)