www.gusucode.com > database 案例源码程序 matlab代码 > database/SearchIncomingRelationshipsExample.m
%% Search Incoming Relationships % Create a Neo4j(R) 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(R) connection object % |neo4jconn|. neo4jconn.Message %% % The blank |Message| property indicates a successful connection. %% % Retrieve the origin node |nodeinfo| using the Neo4j(R) database % connection |neo4jconn| and node identifier |nodeid|. nodeid = 3; nodeinfo = searchNodeByID(neo4jconn,nodeid); %% % Search for incoming relationships using the Neo4j(R) database connection % |neo4jconn| and origin node |nodeinfo|. direction = 'in'; relinfo = searchRelation(neo4jconn,nodeinfo,direction) %% % |relinfo| is a structure that contains the results of the search: %% % * |Origin| -- The node identifier for the specified origin node. % * |Nodes| -- A table containing all starting and ending nodes for each % matched relationship. % * |Relations| -- A table containing all matched relationships. %% % Access the table of nodes. relinfo.Nodes %% % Access the table of relationships. relinfo.Relations