%% Update Node Properties and Return Output
% Create a single node in a Neo4j® database, update its properties, and display them. Access the updated node information using an output argument.
% Assume that you have graph data stored in a Neo4j database that represents a social neighborhood. This database has seven nodes and eight relationships. Each node has only one unique property key name with a value ranging from User1 through User7. Each relationship has the type knows.
%
% 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

%
% Create a single node in the database using the Neo4j database connection.

node = createNode(neo4jconn)

%
% node is a Neo4jNode object with these properties:
% Node identifier
% Node data
% Node labels
% Update the properties of a node that represents a person. Create a table with one row that contains the name and job title for this person. The nodeinfo output argument is a Neo4jNode object.

properties = table("User8","Analyst",'VariableNames',{'Name','Title'});
nodeinfo = updateNode(neo4jconn,node,'Properties',properties);

%
% Display the node properties.

nodeinfo.NodeData

%
% Close the database connection.

close(neo4jconn)

%
% Copyright 2018 The MathWorks, Inc.