如何在spring数据neo4j 4中查询路径? [英] How do I query for paths in spring data neo4j 4?

查看:319
本文介绍了如何在spring数据neo4j 4中查询路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在较早版本的spring数据neo4j(3.3.1)中,我能够查询数据库中的路径,并将其作为Iterable<EntityPath<S,E>>返回,如下所示:

In an earlier version of spring data neo4j (3.3.1), I was able to query for paths in my database and return them as Iterable<EntityPath<S,E>> like this:

public interface ArgumentNodeRepository extends GraphRepository<ArgumentNode> {
    @Query("START t=node({0}), r=node({1}) MATCH p=t<-[:SUPPORTED_BY|INTERPRETS*0..]-r RETURN p")
    Iterable<EntityPath<ArgumentNode, ArgumentNode>> getPaths(long childId, long rootId);
}

我正在尝试迁移到4.0.0,而EntityPath类似乎已消失.我没有在迁移指南.我的新退货类型是什么?

I'm trying to migrate to 4.0.0 and the EntityPath class seems to have disappeared. I don't see any mention of EntityPath in the migration guide. What's my new return type?

推荐答案

SDN 4不支持EntityPath,但是您仍然可以查询路径. 我有一个示例此处包含返回路径的Cypher查询-返回类型为Iterable<Map<String, Object>>

EntityPath isn't supported in SDN 4, but you can still query for paths. I have an example here which contains a Cypher query that returns a path- the return type is Iterable<Map<String, Object>>

这表示路径的集合,每个路径包含交错节点列表和路径中的关系(节点和关系表示为Map).我如何处理路径的示例是 https://github.com/luanne/flavorwocky/blob/sdn/src/main/java/com/flavorwocky/service/PairingServiceImpl.java#L57

This represents a collection of paths, each path containing a list of interleaved nodes and relationships in the path (nodes and relationships represented as a Map). An example of how I processed the path is https://github.com/luanne/flavorwocky/blob/sdn/src/main/java/com/flavorwocky/service/PairingServiceImpl.java#L57

这篇关于如何在spring数据neo4j 4中查询路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆