Wednesday 9 May 2018

Part 2/2: Graphs are Bloom-ing

Earlier I wrote about how I connected the newly announced preview version of Neo4j Bloom to my good old faithful Belgian BeerGraph. See part 1 of this 2-part series for that story. I actually split up the story into two parts, because I feel like there's a super interesting and powerful part to Bloom that deserves a bit more attention: the mechanism of the custom Search Phrases.

As we mentioned in the previous post, Bloom structures your exploration and discovery into specific "views" on the graph data, called "Perspectives. You can select the perspective you find most appropriate from a dropdown - and customize/tweak/create perspectives yourself if you are not happy with the auto-generated starting point.

That's that. Now let's turn to the second mechanism to explore the data - which I find supremely powerful: custom search phrases. This is basically a technology that allows you to create super complicated (or not-so-complicated, in my humble case) Cypher statements, including all the power of the Awesome Procedures on Cypher (APOC), and make them accessible with a simple "near-natural language" question.

Here's how you do that.
There's basically 4 components:
  1. a Parametrised, near-natural language search phrase: this is literally a piece of human-readable text that is specific to your domain, and that takes a number of "parameters" that will be added based on the graph that you are exploring. 
  2. an easy to read description - simple.
  3. a Parametrised Cypher Query: this is where the magic happens. This is a full-fledged Cypher query, which you can test in the well-known Neo4j Browser, that takes its input from the near-natural language parameters that you have received from the user in 1. As the user completes the parameters in the search phrase with specific values, the parameters in the cypher query also get updated.
  4. one or more "Suggestion queries" in Cypher: as you use the custom search phrase in Bloom, it will provide tooltips and suggestions for the parameter values, based on the suggestions rendered by the suggestion queries. Super simple, right?
Here's a few examples of custom search phrases that I built in no time, specific to the "domain" of Belgian Beers:

I hope that's clear. It's super easy, really - I got the hang of it in no time, and immediately saw that this could be super useful to give non-technical users a very real and immediate access to the power of graph exploration with Cypher.

Here's a few results: as I type my question, Bloom autocompletes/tooltips my near-natural language, and offers help based on the custom search phrase pattern that I have completed.

When I run the search phrase, my question gets translated into Cypher in the background, and I get my graph results back in no time.
Same thing for the other search phrases:
And then of course I can continue to explore and visualize to my heart's content with Bloom. It's really good at displaying really large graphs too:
 And zooming into it is as easy as ever with the command keys:
That's it, really. I am hoping you like this as much as I did.

If you got a bit lost during the above, I also created a little video that may clarify things a bit more:

Hoping that helps. Any questions or comments, please don't hesitate to reach out.



No comments:

Post a Comment