Querying data in AppMaps

This example shows how to import AppMap data into neo4j where it can be queried using the neo4j query language.

An example query finds classes that don’t call any other methods in other classes. These classes are “leaves” of the AppMap call graph.

Check out the code »

Components used

This examples uses the CallTree model, which is available in the open source appmap-models project.

Customizations

In this example, a CallTree is created for each AppMap file provided on the command line. The CallTree is flattened into an array. Each array element contains information about a method call: the class that contains the method, and an array of methods called by that method (child methods).

For each element in the flattened array, a node in a graph database is created for the containing class. For each element in the array of child methods, an edge is created from the new node to a node for the class of the child method.

The example requires a neo4j instance to be available.

Data sources

The examples use AppMap data recorded from the tests for the open source application Discourse, “A platform for community discussion”. The recordings were created using the appmap-ruby client. Since the Discourse application is open source and public on AppLand, the recorded scenario data can be freely downloaded from scenarios in the application.

To obtain raw scenario data, visit the the AppLand sandbox, view the public applications, and click on the Discourse application.

From the application page, choose a scenario:

Open the properties for the scenario:

Download the data:

Downloading several sets of data will make the query results more interesting.

The scenarios of applications in the AppLand sandbox each contain a Timeline view, showing the call sequence contained in the AppMap data.

« Back to the code gallery