简体   繁体   English

neo4j中的超图建模

[英]Hypergraph modeling in neo4j

MATCH (hank)-[]->(hyperedge)-[]->(cletus)

If Hank has multiple relationships to hyperedge and/or hyperedge has multiple relationships to Cletus, but there is only one relationship from Hank through hyperedge to Cletus, will this query give me that relationship? 如果Hank与hyperedge有多个关系和/或hyperedge与Cletus具有多个关系,但是 Hank hyperedge Cletus仅有一个关系,此查询是否可以为我提供这种关系?

Assuming the answer to that is yes, if I do this: 假设答案是肯定的,如果我这样做:

CREATE (hank)-[:FOO]->(hyperedge)-[:BAR]->(cletus)

will

MATCH (hank)-[:FOO]->(hyperedge)-[:BAR]->(cletus)

give me the relationship I just created, if Hank has multiple FOO relationships to hyperedge and/or hyperedge has multiple BAR relationships to Cletus? 给我我刚刚创建的关系,如果Hank与hyperedge有多个FOO关系和/或hyperedge与Cletus有多个BAR关系?

It depends, if hank, hyperedge and cletus are fixed, then yes, 这取决于如果绞线,hyperedge和cletus是否固定,那么是的,

Otherwise you probably want to use: 否则,您可能要使用:

MATCH shortestPath((hank)-[:FOO]->(hyperedge)-[:BAR]->(cletus))

to get only one. 只得到一个。

Otherwise you have to "tag" that relationship somehow, eg with a property. 否则,您必须以某种方式“标记”该关系,例如使用属性。

MATCH (hank)-[:FOO {tag:1}]->(hyperedge)-[:BAR  {tag:1}]->(cletus)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM