I don't think it's possible to do what I'm seeking, but I thought I'd throw it out for creative suggestions. The Unified Medical Language System (UMLS; https://uts.nlm.nih.gov/home.html) is a semantic ontology which has a variety of bidirectional relationships between nodes. For example x isa y and y inverse_isa x. The problem is there are many such names and their reverse directed relationship. Thus, in a query, it is not enough to exclude one because the listing has many possibilities, which is cumbersome and may overlook something. The problem, in other words, is can you create a directed acyclic graph query when there are relationships that will reverse the traversal. If you have a outbound relationship from node x to y, you want to ignore the inbound relationship to x from y. I'm using Neo4j 2.3.0. The UMLS, as I'm filtering the data, has ~11M nodes and 45M relationships. There are 654 relationship types and the list is dynamically growing; this is another reason for a generic solution not dependent on a specific listing in- and out-bound relationships.
我不认为我可以做我正在寻找的东西,但我想我会把它扔出去提出创造性的建议。统一医学语言系统(UMLS; https://uts.nlm.nih.gov/home.html)是一种语义本体,在节点之间具有各种双向关系。例如,x isa y和y inverse_isa x。问题是有很多这样的名字和他们的反向关系。因此,在查询中,排除一个是不够的,因为列表具有许多可能性,这是麻烦的并且可能忽略某些东西。换句话说,问题是,当存在将反转遍历的关系时,您是否可以创建有向非循环图查询。如果从节点x到y有出站关系,则要忽略y与x的入站关系。我正在使用Neo4j 2.3.0。 UMLS,因为我正在过滤数据,有~11M节点和45M关系。有654种关系类型,该列表正在动态增长;这是通用解决方案不依赖于特定列表入站和出站关系的另一个原因。
2 个解决方案
#1
If, in UMLS, every "inverted" relationship is paired with a corresponding "positive" relationship (i.e., they link the same 2 nodes, but go in opposite directions), then you could just omit the inverted relationship in the neo4j DB, since neo4j can navigate relationships in either direction. Would this solve your problem?
如果在UMLS中,每个“反向”关系与相应的“正”关系配对(即,它们链接相同的2个节点,但是朝相反的方向),那么你可以省略neo4j DB中的反转关系,因为neo4j可以在任何一个方向上导航关系。这会解决你的问题吗?
#2
I am sorry I have only a very little understanding of the problem.
对不起,我对这个问题的了解很少。
Please see if this is of any help. For inverted relationships, you can query for something like this. Here, b will be used for the reverse relationship.
请查看这是否有任何帮助。对于反向关系,您可以查询类似的内容。这里,b将用于反向关系。
match (n)-[a]->(m)-[b]->(n) return m;
#1
If, in UMLS, every "inverted" relationship is paired with a corresponding "positive" relationship (i.e., they link the same 2 nodes, but go in opposite directions), then you could just omit the inverted relationship in the neo4j DB, since neo4j can navigate relationships in either direction. Would this solve your problem?
如果在UMLS中,每个“反向”关系与相应的“正”关系配对(即,它们链接相同的2个节点,但是朝相反的方向),那么你可以省略neo4j DB中的反转关系,因为neo4j可以在任何一个方向上导航关系。这会解决你的问题吗?
#2
I am sorry I have only a very little understanding of the problem.
对不起,我对这个问题的了解很少。
Please see if this is of any help. For inverted relationships, you can query for something like this. Here, b will be used for the reverse relationship.
请查看这是否有任何帮助。对于反向关系,您可以查询类似的内容。这里,b将用于反向关系。
match (n)-[a]->(m)-[b]->(n) return m;