What is the most transparent stack that returns results as nested objects?


(Joshfindit) #1

I'm looking to switch away from Neo4j-rb, so I'm open to any stack at this point, but here's my wish-list:

  • The ability to do a manual Cypher query

  • Nodes have methods that traverse the relationship (Examples: author.posts[0], post.comments[i].author.posts)

  • Most important: Queries can return the full results as populated objects

Examples:

MATCH (node1:Label1)-->(node2:Label2)
WHERE node1.propertyA = {value}
RETURN node2.propertyA

Returns [propertyA, propertyA, propertyA, ...]

MATCH (nyc:City {name:"New York"})<-[:LOCATED_IN]-(restaurant)-[:SERVES]->(cusine)
RETURN nyc, restaurant, cusine

(From https://neo4j.com/graphgist/restaurant-recommendations)

Returns
1 City node, 2 Restaurant nodes, and 1 Cuisine node all connected together where all of the following are possible without an additional DB query:

  • zushi_zam.located_in.name // "New York"
  • zushi_zam.serves.name // "Sushi"
  • zushi_zam.located_in.serves[i].name // "Zushi Zam" or "iSushi", depending on i

Any suggestions that meet the wish list are appreciated, double bonus points for real-world examples.