Reports - ge-semtk/semtk GitHub Wiki

Reports allow a set of nodegroups and other functions to be run against a dataset, and a variety of analyses to be displayed. Reports are specified by JSON and can be re-run against multiple datasets, and the results saved as HTML. Report specification JSON can be saved in the report store or on disk.


On this page


Overview

Reporting is performed through the SPARQLgraph web user interface, on the "Reports" tab.

This tab consists of

  • a button bar
  • top section for dragging in JSON and running reports
  • editor section - edit a report specification JSON
  • results section

Button Bar Functions

Centered in the button bar is the name of the connection against which any reports will be run. The connection can be changed using the Connection menu.

Buttons include:

  • Clear - clears the loaded report spec JSON and the editor
  • Open store - open the report spec store for loading or deleting JSON
  • Save - save the report spec JSON to the store
  • Download - download the report spec JSON to disk
  • JSONEditor - link to the opensource JSONEditor project used in the Editor tab

Drag and Run

The top section of the Reports tab includes

  • a drop zone for dropping report spec JSON files
  • the title of the current report
  • a Run button to run the loaded report against the current connection

Live Demo Instructions

If you would like to follow along with a live demo of the following documentation, perform these steps first:

  1. open SPARQLgraph and load the "demoConn" connection which is automatically created by SemTK
  2. download the nodegroup file demoNodegroup-temp-gt-200.json
    • drag it onto the SPARQLgraph Query tab
    • use the Nodegroup->Save to Store menu to save this nodegroup to the store with the name "demoNodegroup temp gt 200"
  3. download the sample report file demoReport.json
    • drag it onto the SPARQLgraph Reports tab dropzone

Your local SPARQLgraph will now mirror the rest of this documentation.

Edit Report Spec

Opening the Editor section with a report spec loaded shows the JSONEditor:

A report contains a text title and an array of sections. Each section contains an optional description which holds html which will be displayed at the top of each section. Sections each may recursively contain sub-sections.

Attributes of each section can be turned on and off using the properties button provided by JSONEditor.

Section types and their parameters are described below.

Section Cardinality

A section including a Special property can have it's id set to cardinality. The editor section will look like this:

This section will check all cardinality restrictions in the model. Examples of cardinality in the SADL language are shown on the SADL 3 Cardinality page

Running the cardinality report section on the demoConn demo provides this section in the report:

These reports show that class Layer has a property creator which is modelled as a single value. However the data has many examples of Layer objects which have an actual cardinality of 0.

Section Class Count

A section including a Special property can have it's id set to class count.

This section will count the number of instances of each class in the model.

Running the class count report section on the demoConn demo provides this section in the report:

Section Table

A section including a Table property can have it's nodegroup set to the name of any nodegroup currently in the nodegroup store. These may be selected off a drop-down list. The editor section will look like this:

This section will run the nodegroup in SELECT DISTINCT mode and display the resulting table.

Running this section on demoNodegroup on the demoConn demo provides this section in the report:

Section Graph

A section including a Graph property is similar to Table except that it will run the nodegroup in CONSTRUCT mode and display the resulting graph.

Running this section on demoNodegroup on the demoConn demo provides this section in the report:

Section Plot

A section including a Plot adds a plotname property which should specify the name of a plot associated with a nodegroup. See the Plotting page

Running this section on demoNodegroup with plotname of Demo Plot - Bar on the demoConn demo provides this section in the report:

Section Count

A section including a Count property is similar to Table except that it will run the nodegroup in COUNT mode and display the count.

Running this section on demoNodegroup on the demoConn demo provides this section in the report:

Adding Ranges and Sub-sections to a count

Count sections are highly configurable through the use of ranges and sub-sections.

Each range contains

  • a list of conditions gte or lte (greater than or equal, and less than or equal) - the first range in a count section whose gte and/or lte conditions all match will be printed in the report. Previous non-matching and subsequent ranges will not be printed.
  • a format property with a sentence to be printed if this range matches. {0} will be replaced by the count.
  • a status property of "success" or "failure" indicating which icon should be displayed
  • optional sub-sections which will be printed if this range matches.

This example runs a new version of the demoNodegroup that only prints temperatures over 200. The image below shows the "Found none" range collaped, but the details of the failure case shown. This failure range prints the format message with a failure icon if the result is gte 1. It then prints a subsection where a table of the violating rows is printed.

Since there are three violations in our demo data, running this section on demoNodegroup on the demoConn demo provides this section in the report:

Section table_test_row_count

Since the count section with ranges is very flexible, it can be verbose. So a simple table_test_row_count section type performs the very common task of running a count query and printing the table if the count doesn't match the expected value.

Its parameters are simply:

  • nodegroup - the nodegroup to run
  • success_rows - the expected number of rows for "success"
  • success_rows_op - optional operator (defaults to "==") used to compare actual rows found to the success_rows field to achieve success

running this section on demoNodegroup with success_rows=0 on the demoConn demo provides this section in the report:

Run-and-Save

In summary, to run the report and get all the output sections shown above, use the Run button in the top section of the report tab. The results will show up in the bottom section of the page. Results are interactive:

  • tables can be filtered and the view changed
  • construct graphs can be manipulated
  • plots often have mouse-overs
  • etc.

Using the Download button at the top of the report output will save HTML resulting a less-interactive version of the report.

The report specification JSON can be downloaded or saved to the store using the button bar at the top of the page.

⚠️ **GitHub.com Fallback** ⚠️