Stack Overflow Roundup: Neo4j (Bolt and Cypher Tricks)
Looking for your weekly fix of what's going on in the world of Neo4j on Stack Overflow? Well, look no further as it's that time of the week again!
Join the DZone community and get the full member experience.Join For Free
It's that time again, folks: Time to see what has been going on in the world of Neo4j on Stack Overflow this past week.
To be honest, it's been kind of a quiet week with a mix of varied questions. I have chosen three questions in particular, though, to focus on, highlighting any ongoing trends as well as showing off just what Neo4j can do.
One of the biggest questions that came with the release of Neo4j 3.0 was just how well Neo's new Bolt driver would stack up performance-wise against the pre-existing HTTP APIs. As the dust continues to settle on the matter (which could take a long while), it is important to understand not just the differences between Bolt and the HTTP APIs, but also the metrics being used to compare the two.
This question posted here raises such a point, and I encourage anyone reading this to follow the question as it progresses (there is no accepted answer as of the time of this writing). The first "answer" given, however, does an excellent job of pointing out some those key differences between Bolt and the HTTP APIs, especially where state is concerned.
It will be interesting to see how the comparison develops, especially with respect to the metrics used, as already users of Bolt on other platforms are starting to add "me too"'s to the post.
Shortest Path Based on Pattern
In an interesting twist to the problem of determining the shortest path between two nodes, the question posted here adds the condition that the shortest path must follow a certain pattern/set of criteria, and ignore paths violating that condition, even if those paths are shorter.
We are reminded here of some of the tricks that Cypher is capable of, especially when it comes to functions that operate on collections and aggregates. The answer essentially implements a "slice" operation. Can you work out the solution before viewing the answer?
Returning Composite Objects in Cypher
A little-known feature of Cypher is the ability to return custom objects (nodes) in Cypher, as the question here demonstrates. It may seem obvious, but often times it is overlooked and/or forgotten about.
And, with the release of the "apoc" libraries for Neo4j, there is an additional way to accomplish the same feature, even mutating existing nodes that are returned.
Have a look at the question on Stack Overflow to see how easy this is to accomplish.
While we looked at some interesting things that Cypher can do, we also notice that the Bolt question is still floating around. Questions surrounding Neo4j 3.x can be expected to continue on for some time to come, as is to be expected with any major release; however, there is a marked decrease in Neo4j 3-specific questions in the past week on Stack Overflow. Perhaps a corner has been turned!
Opinions expressed by DZone contributors are their own.