%% Set Multiple Node Properties and Return Output
% Set node properties for 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 select the first two nodes.

nlabel = "Person";
nodeinfo = searchNode(neo4jconn,nlabel);
nodes = nodeinfo.NodeObject;
firstnodes = nodes(1:2);

%
% Set the Title node property for multiple nodes to different values using the Neo4j database connection. Create a structure array to store the properties. Display the updated node information for the first two nodes. The nodeinfo output argument is a Neo4jNode object.

properties(1).Title = "Analyst";
properties(2).Title = "Engineer";
nodeinfo = setNodeProperty(neo4jconn,firstnodes,properties);
nodeinfo.NodeData{1:2}

%
% Close the database connection.

close(neo4jconn)

% Copyright 2018 The MathWorks, Inc.