%% Remove One Node Label
% Add one node label to a single node in a Neo4j® database, access the node, and then remove the new node label.
%
% 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 first node in the table of node information. This node has the label Person.

nlabel = "Person";
nodeinfo = searchNode(neo4jconn,nlabel);
node = nodeinfo.NodeObject(1);

%
% Add one node label to a single node in the database using the Neo4j database connection.

labels = "Analyst";
addNodeLabel(neo4jconn,node,labels)

%
% Display the node information for the updated node.

nodeinfo = searchNode(neo4jconn,labels);
node.NodeLabels

%
% Remove the label Analyst from the updated node.

removeNodeLabel(neo4jconn,node,labels)

%
% Find the first node again and display its node labels. The node now has only the label Person.

nlabel = "Person";
nodeinfo = searchNode(neo4jconn,nlabel);
nodeinfo.NodeLabels(1)

%
% Close the database connection.

close(neo4jconn)

% Copyright 2018 The MathWorks, Inc.