-1

I have found this example on one of airpair articles basically it creates a cypher query that return a path instead of node or relationship, so i wonder what would be written in the return Object.

 @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);
Luanne
  • 19,145
  • 1
  • 39
  • 51
Dmitrij Kostyushko
  • 636
  • 1
  • 8
  • 20

1 Answers1

1

You'll get a collection of paths, where each path is a list of nodes and relationships, and each node or relationship is a Map representing properties. The source indicates what is returned: https://github.com/luanne/flavorwocky/blob/sdn/src/main/java/com/flavorwocky/service/PairingServiceImpl.java#L56

Please note that this is valid only in Spring Data Neo4j 4.0.0.RELEASE. Returning paths are not supported in SDN 4.1 because now nodes and relationships returned in a custom query can be mapped to domain entities. See https://github.com/luanne/flavorwocky/blob/sdn-4.1/src/main/java/com/flavorwocky/repository/IngredientRepository.java#L19 for the SDN 4.1.1 equivalent.

Luanne
  • 19,145
  • 1
  • 39
  • 51