%% Remove Multiple Node Labels and Return Output
% Add node labels to multiple nodes in a Neo4j® database, remove the new node labels, and access the updated node 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

%
% Find nodes with the label Person.

nlabel = "Person";
nodeinfo = searchNode(neo4jconn,nlabel);

%
% Add multiple node labels to the nodes in the database using the Neo4j database connection.

labels = ["Analyst" "Scientist"];
node = nodeinfo.NodeObject;
addNodeLabel(neo4jconn,node,labels)

%
% Display the node information for the updated nodes. Each node has three node labels (Person, Analyst, and Scientist).

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

%
% Remove the labels Analyst and Scientist from the updated nodes and display updated node information. Each node now has only the label Person. The nodeinfo output argument is a Neo4jNode object.

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

%
% Close the database connection.

close(neo4jconn)

% Copyright 2018 The MathWorks, Inc.