searchRelationByID
Search Neo4j relationship by relationship identifier
Description
returns the Neo4j® relationship specified by the relationship identifier using the
Neo4j database connection.relationinfo = searchRelationByID(neo4jconn,relationid)
Examples
Search for a single relationship or multiple relationships by using relationship identifiers in the Neo4j® database.
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
ans =
[]
Search for the relationship with the identifier 8 by using the Neo4j database connection.
relationid = 8; relationinfo = searchRelationByID(neo4jconn,relationid)
relationinfo =
Neo4jRelation with properties:
RelationID: 8
RelationData: [1×1 struct]
StartNodeID: 5
RelationType: 'knows'
EndNodeID: 9
relationinfo is a Neo4jRelation object with these properties:
Relationship identifier
Relationship data
Start node identifier
Relationship type
End node identifier
Display the relationship type.
relationinfo.RelationType
ans = 'knows'
Search for multiple relationships with the identifiers 4, 5, and 6 by using the Neo4j database connection.
relationid = [4,5,6]; relationinfo = searchRelationByID(neo4jconn,relationid)
relationinfo=3×5 table
StartNodeID RelationType EndNodeID RelationData RelationObject
___________ ____________ _________ ____________ _______________________________________
5 3 'knows' 4 [1×1 struct] [1x1 database.neo4j.http.Neo4jRelation]
4 3 'knows' 5 [1×1 struct] [1x1 database.neo4j.http.Neo4jRelation]
6 5 'knows' 4 [1×1 struct] [1x1 database.neo4j.http.Neo4jRelation]
relationinfo is a table with these variables:
Start node identifier
Relationship type
End node identifier
Relationship data
Neo4jRelationobject
Close the database connection.
close(neo4jconn)
Input Arguments
Neo4j database connection, specified as a Neo4jConnect object created with the function neo4j.
Relationship identifier, specified as a numeric scalar for a single relationship or numeric vector for multiple relationships.
Example: [15,16]
Data Types: double
Output Arguments
Relationship information, returned as a Neo4jRelation object for one relationship or as a table for multiple
relationships.
For multiple relationships, the table contains these variables:
StartNodeID— Node identifier of the start node for each matched relationshipRelationType— Character vector that denotes the relationship type for each matched relationshipEndNodeID— Node identifier of the end node for each matched relationshipRelationData— Structure array that contains property keys associated with each matched relationshipRelationObject—Neo4jRelationobject for each matched relationship
The row names in the table are Neo4j relationship identifiers.
Version History
Introduced in R2018a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)