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

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

%
% Add multiple node labels to the nodes in the database using the Neo4j database connection. The nodeinfo output argument is a Neo4jNode object.

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

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

nodeinfo.NodeLabels

%
% Close the database connection.

close(neo4jconn)

% Copyright 2018 The MathWorks, Inc.