簡體   English   中英

Neo4J Java API getRelationships不會返回所有關系

[英]Neo4J Java API getRelationships not returning all relationships

編輯:查看評論並忽略此問題

我有一個帶有以下代碼的Neo4J插件:

enum VrtrackRelationshipTypes implements RelationshipType { created_for }
Direction in = Direction.INCOMING;

System.out.println("will get nodes created_for study with node id " + study.getId());
int count = 0;
for (Relationship slRel: study.getRelationships(VrtrackRelationshipTypes.created_for, in)) {
    count++;
}
System.out.println(count);

哪個返回:

將獲得節點created_for研究,節點ID為1453769

3445

但是,使用Web前端和一些密碼:

match (n)-[:created_for]->(m) where id(m) = 1453769 return count(distinct(n))

返回值:

3631

怎么會這樣?

在原地,您計算了所有關系,在另一個中,您計算​​了不同的終端節點。

嘗試運行此命令並查看返回的結果:

match (n)-[r:created_for]->(m) 
where id(m) = 1453769 
return count(*) as paths, count(r) as rels, 
       count(n) as seen_n, count(distinct n) as distinct_n

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM