任何人都可以帮助在单个密码查询中填充连接的节点。我使用Neo4j服务器,似乎批量命令是要走的路。一整天都在努力弄明白。
START n=node:ErrandLocation('withinDistance:[-2.80, 56.34, 100.00]') WITH n MATCH person-[r:POSTED]->n WITH n, person SET n.owner = person RETURN n ORDER BY n.added DESC SKIP 0 LIMIT 10
Exception is "[Node[184]:org.neo4j.kernel.impl.core.NodeProxy] is not a supported property value"
答案 0 :(得分:0)
您正在为节点设置属性吗?
可能你想建立一种关系?但你已经拥有:POSTED
一个?
或者您想设置n.owner = person.name
?
答案 1 :(得分:0)
当您编写自己的密码查询时,请使用@QueryResult来检索已连接的节点。不要在SDN Rest中使用@Fetch注释,因为路径匹配将连续发生,而不是批量发生。当SDN可以在单个查询中完成时,SDN将进行额外的REST调用以尝试序列化整个对象图。 例如,
public class Person {
@RelatedTo (type = "MARRIED", direction = BOTH)
private Person partner;
}
@QueryResult
public class PersonResult {
@ResultColumn("person")
private Person person;
@ResultColumn("partner")
private Person partner;
}
在您的存储库中,然后获取结果
public interface PersonRepository extends GraphRepository <Person> {
@Query ("MATCH person-[m:MARRIED]-partner RETURN person, partner)
List<PersonResult> findAllMarried ();
}
在问题案例中,只需返回该人员即可批量获取cypher查询对象,并使用@ResultColumn字段或接口方法。