SearchTree
#
Recursive Connection
Entities can have recursive relations, that is entity can have relation to some other entity record of same entity type.
Linking multiple entity record with same "parent
" will create a tree structure that can be extended by linking more
entities.
#
EYWA Permission TreeGraphQL specification doesn't cover tree structures. To enable tree searching EYWA will create searchTree queries for each entity with recursive relation. If more recursive relations are present for some entity, EYWA will create query for each recursive relation with following pattern search prefix, Entity Name, TreeBy insertion and Relation Label suffix.
Search arguments are same as described in Search section, as well as selection part. The result however is not. Result will be list of searched entity that client has to connect to recreate tree view.
Lets try to filter Eywa Permission Tree.
#
Query{ searchPermissionTreeByParent (_where:{_or:[{name:{_eq:"Add"}} {name:{_eq:"Delete"}}]}) { name parent { name } }}
#
Response{ "data": { "searchPermissionTreeByParent": [ { "euuid": "28d8b0bf-7647-4ff4-b799-fc72b22c06f0", "name": "Eywa", "parent": null }, { "euuid": "52e64d64-867c-4827-a2d8-c96a9ae173d8", "name": "Administration", "parent": { "euuid": "28d8b0bf-7647-4ff4-b799-fc72b22c06f0", "name": "Eywa" } }, { "euuid": "8500caf8-edde-411e-9079-cd06de4f870e", "name": "Users", "parent": { "euuid": "52e64d64-867c-4827-a2d8-c96a9ae173d8", "name": "Administration" } }, { "euuid": "e93b302b-4f37-43a1-9d4b-f41435907ce7", "name": "Add", "parent": { "euuid": "8500caf8-edde-411e-9079-cd06de4f870e", "name": "Users" } }, { "euuid": "6734e2ae-45fe-470b-a9ac-68551ca64b36", "name": "Delete", "parent": { "euuid": "8500caf8-edde-411e-9079-cd06de4f870e", "name": "Users" } }, { "euuid": "9a7927a4-2ae7-4f5d-8c09-a4ddcdc11645", "name": "Groups", "parent": { "euuid": "52e64d64-867c-4827-a2d8-c96a9ae173d8", "name": "Administration" } }, { "euuid": "c3c53259-5535-41b2-a7f7-a325107af0d7", "name": "Add", "parent": { "euuid": "9a7927a4-2ae7-4f5d-8c09-a4ddcdc11645", "name": "Groups" } }, { "euuid": "bf0617dc-d522-4bc4-a382-15743310c1ea", "name": "Delete", "parent": { "euuid": "9a7927a4-2ae7-4f5d-8c09-a4ddcdc11645", "name": "Groups" } }, { "euuid": "e2d6aac4-67bb-4242-96cb-b45cb0f0aa71", "name": "Roles", "parent": { "euuid": "52e64d64-867c-4827-a2d8-c96a9ae173d8", "name": "Administration" } }, { "euuid": "2f352f5c-f17c-4072-affa-2cc2a9e9b024", "name": "Add", "parent": { "euuid": "e2d6aac4-67bb-4242-96cb-b45cb0f0aa71", "name": "Roles" } }, { "euuid": "67f5108f-ee9b-4564-8cad-bba6bfc9643d", "name": "Delete", "parent": { "euuid": "e2d6aac4-67bb-4242-96cb-b45cb0f0aa71", "name": "Roles" } }, { "euuid": "10c05ba4-de95-4f04-a90b-a2b1081a030a", "name": "Data", "parent": { "euuid": "28d8b0bf-7647-4ff4-b799-fc72b22c06f0", "name": "Eywa" } }, { "euuid": "84447fe2-673e-4d39-8eda-aeb1fb54a7ca", "name": "Datasets", "parent": { "euuid": "10c05ba4-de95-4f04-a90b-a2b1081a030a", "name": "Data" } }, { "euuid": "27209429-fe7c-469f-96ed-65faec81afc4", "name": "Add", "parent": { "euuid": "84447fe2-673e-4d39-8eda-aeb1fb54a7ca", "name": "Datasets" } }, { "euuid": "11786a5a-244b-4f16-b9a3-d482cb70bf56", "name": "Delete", "parent": { "euuid": "84447fe2-673e-4d39-8eda-aeb1fb54a7ca", "name": "Datasets" } } ] }}
Since we are searching tree, results are returned for whole tree. First EYWA will find records that match search query, than it will reconstruct tree until it reaches root node, and all records (nodes) that are on that path are returned. By specifying selection attributes user can get enough information to reconstruct tree structure on client side.
Visually search would return following nodes.