%% 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

%
% 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}

%
% 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}

%
% Close the database connection.

close(neo4jconn)

% Copyright 2018 The MathWorks, Inc.