【问题标题】:What will be the result of the neoj repository method that return path, and not a node?返回路径而不是节点的 neoj 存储库方法的结果是什么?
【发布时间】:2016-05-18 17:47:56
【问题描述】:

我在 airpair 的一篇文章中找到了这个示例,基本上它创建了一个密码查询,该查询返回一个路径而不是节点或关系,所以我想知道返回对象中会写什么。

 @Query("match p=(i:Ingredient {name:{0}})-[r:PAIRS_WITH*0..3]-(i2)-[:HAS_CATEGORY]->(cat) return p;")
    Iterable<Map<String, Object>> getFlavorPaths(String ingredientName);

【问题讨论】:

    标签: java spring neo4j spring-data-neo4j-4


    【解决方案1】:

    您将获得一组路径,其中每个路径是节点和关系的列表,每个节点或关系是表示属性的 Map。来源表示返回什么:https://github.com/luanne/flavorwocky/blob/sdn/src/main/java/com/flavorwocky/service/PairingServiceImpl.java#L56

    请注意,这仅在 Spring Data Neo4j 4.0.0.RELEASE 中有效。 SDN 4.1 不支持返回路径,因为现在自定义查询中返回的节点和关系可以映射到域实体。请参阅https://github.com/luanne/flavorwocky/blob/sdn-4.1/src/main/java/com/flavorwocky/repository/IngredientRepository.java#L19 了解 SDN 4.1.1 等效项。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-20
      • 2017-06-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-16
      相关资源
      最近更新 更多