As of September 2019, Compose will soon no longer support JanusGraph on the platform. Provisioning of new JanusGraph deployments is disabled.
Exploring your graph data from the command line can be a complex task. For beginners and initial data exploration, there can be difficulty in forming your traversals on the command line. When you get results, it can often be hard to convert the the text outputs into digestible graph relationships. This where the Browser for JanusGraph on Compose comes in.
Browser for Compose JanusGraph combines an easy to use Query Builder with rich Query Response Cards which stack up below the builder. Each card records the query and displays the results as an interactive JSON view and as a visualized graph which can be explored. Each card can help you refine your next query.
The link to the Browser is located on the browser tab of your JanusGraph deployment. Clicking on Open will load the interface into a new tab.
Enabling the Browser
The new Browser will be available on any newly provisioned JanusGraph deployment. If you have an existing deployment want the newest version of the browser, or do not see the Browser tab, please contact support or email [email protected] to get it enabled.
This is a view of the browser after a first query has been run.
At the top (1) is the Query Builder where queries are created, edited and executed.
Below the Query Builder (2) is a Query Response card. New cards are inserted at the top of the card stack. The previous top card was (3) the interactive introduction to the browser. This appears whenever you start the browser.
The Query Builder is a simple multi-line editor with syntax highlighting to assist in the composition of Gremlin scripts.
Each query generates a response card that contains your query, a JSON response and, if available, a graph visualization of the query results.
The top of each card displays the query that was run(1), and three options:
- (2) A copy button.
- (3) Collapse/Expand button.
- (4) A close button.
As you run more queries, each will get it's own response card, with newest response cards at the top pushing the previous ones down the page. If the page gets long, or you notice decresed performance, you can use the Collapse button to save some frames. If you no longer need the results on a card, you can close it completely. Closing a response card will not delete any data in the graph.
If your query result can be visualized, the card will display a graph with vertices and edges. The visualizer has many features:
- Click and drag the vertices to move them around and lock them into position.
- Click on any vertex or edge to see the JSON details.
- Use the Legend drop-down menu to change how the vertices and edges are labeled.
- Use the Layout drop-down menu to change the orientation of the vertices and edges.
def g=ConfiguredGraphFactory.open("example").traversal(); g.V().has(T.label, "god").outE().inV().path();
produces the following response card with a visualization:
It shows all the vertices in the graph that represent the gods, and both in and out edges from those vertices. Moving the vertices around makes them easier to read:
Get the details of a vertex by clicking on it:
Change the labels for the vertices to "name":
Or select the "breadthfirst" layout:
The visualizer only renders what is in the JSON results on the left, so only the returned vertices and edges are shown. That's why, if you just query for vertices you just get a set of unconnected nodes appear in the visualization as there are no edges to connect them. There are a number of ways to populate the results with edges. A simple but powerful one is the
path() function. This, when added to a Gremlin query, asks for the route taken to get to the vertices in the graph to be included. If the route traverses only vertices, then only vertices are returned, but if it includes edges, these are included in the results. The Gremlin documentation on path-step has more on the
The JSON viewer is a syntax-highlighted text view of the response. Lines are numbered for easier navigation through the results. Where the JSON document is nested, small arrows are displayed. These can be clicked to fold up the nested section.
Some commands in the browser can return a
null result. This is typically because the value they return is not, currently, serializable. The most common example of that is any command or expression which returns a graph, including the
create methods. Extend your command to return vertices and edges; although null is displayed, the actual values are intact within JanusGraph and are available to use in a query.
If this article didn't solve things, summon a human and get some help!
Updated almost 3 years ago