英文:
Skip a partical node while showing connection in graph view
问题
在图形数据库(Neo4j)中,我需要维护基于微服务架构的所有现有资源的库存。为此,我必须创建两个视图,一个顶层视图和一个详细视图。
考虑这是我的关系:
节点(lambdaXYZ) -[r:API_CALL]- 节点(NatGatewayABC) -[r:API_CALL]- 节点(ec2ABC)
但我想要两种不同类型的视图:
-
第一个是上述视图类型
lambdaXYZ -> NatGatewayABC -> ec2ABC
-
第二个是摘要视图,类似于这样
lambdaXYZ -> ec2ABC
基本上我想跳过一些节点,只显示一个预览。
这是因为我需要在数据库中保留NatGateway以存储IP地址等信息。
如何实现这个目标?
英文:
In a graph DB (Neo4j), I need to maintain inventory of all the existing resources in a microservices-based architecture. For this I have to create 2 views, a top level view and a detailed view.
Consider this is my relationship:
Node(lambdaXYZ) -[r:API_CALL]- Node(NatGatewayABC) -[r:API_CALL]- Node(ec2ABC)
but I want 2 different types of views:
-
the first is the above view type
lambdaXYZ -> NatGatewayABC -> ec2ABC
-
second is a summary view which is something like this
lambdaXYZ -> ec2ABC
Basically I want to skip some nodes and show only a preview.
This is because I need to have NatGateway in the database to store the IP address from etc.
How to achieve this?
答案1
得分: 0
It looks like you want to create a virtual relationship to represent a "summary" path (going from the first Node
to the last Node
in some actual path).
For example, here is how you can create a SUMMARY-CALL
virtual relationship between the lambdaXYZ
Node and the last Node in any chain of outgoing API_CALL
relationships (up to length 7):
MATCH (n1:Node)-[:API_CALL*..7]->(n2:Node)
WHERE n1.id = 'lambdaXYZ' AND NOT EXISTS((n2)-[:API_CALL]->())
RETURN n1, n2, apoc.create.vRelationship(n1,'SUMMARY_CALL',{}, n2)
英文:
It looks like you want to create a virtual relationship to represent a "summary" path (going from from the first Node
to the last Node
in some actual path).
For example, here is how you can create a SUMMARY-CALL
virtual relationship between the lambdaXYZ
Node and the last Node in any chain of outgoing API_CALL
relationships (up to length 7):
MATCH (n1:Node)-[:API_CALL*..7]->(n2:Node)
WHERE n1.id = 'lambdaXYZ' AND NOT EXISTS((n2)-[:API_CALL]->())
RETURN n1, n2, apoc.create.vRelationship(n1,'SUMMARY_CALL',{}, n2)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论