简体   繁体   English

Neo4J Java API getRelationships不会返回所有关系

[英]Neo4J Java API getRelationships not returning all relationships

Edit: see comment and ignore this question 编辑:查看评论并忽略此问题

I have a Neo4J plugin with this code: 我有一个带有以下代码的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);

Which returns: 哪个返回:

will get nodes created_for study with node id 1453769 将获得节点created_for研究,节点ID为1453769

3445 3445

However, using the web frontend and some cypher: 但是,使用Web前端和一些密码:

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

Returns: 返回值:

3631 3631

How can this be? 怎么会这样?

In on place you counted all relationships, in the other you counted distinct end-nodes. 在原地,您计算了所有关系,在另一个中,您计算​​了不同的终端节点。

try to run this and see what it returns: 尝试运行此命令并查看返回的结果:

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