Service for template-based provenance generation

Previously I blogged about prov-template, an approach for generating provenance. It consists of a declarative definition of the shape of provenance to be generated, referred to as template, and sets of values to instantiate templates into concrete provenance. Today, I am pleased to write about a new online service allowing such templates to be expanded into provenance.

The service is available from https://openprovenance.org/services/view/expander. I will now illustrate its use through a few examples.

First, let’s consider an example of template (see https://openprovenance.org/templates/org/openprovenance/generic/binaryop/1.provn for its provn version). Visually it look like this.

template

A template for a binary operation

It shows an activity, two entities used as input and an entity generated as output. There is an agent associated with the activity. The output is derived from the two inputs. This provenance description is contained in a provenance document, but what makes it a template is that the identities of nodes are variables (URIs in a reserved namespace with prefix varvar:produced, var:operation, …). These variables are meant to be replaced by concrete values. Variables are also allowed in value position of property-value pairs (cf. var:operation_type).

This template for instance could be used to describe the addition of two numbers resulting in their sum.

The template service looks as follows. Two input boxes respectively expect the URL to a template (you need to ensure that the template is accessible to the service) and the bindings between variables and values to instantiate the template.  For convenience, the template pull down menu already provides the link to the template described above. Likewise, the example pull down menu contains several examples of bindings. Let’s select the first one, and click on the SVG button to generate an SVG representation of the expanded provenance.

template-service

Template expansion service

The result is as follows, variable names have been instantiated with identities of activity, entities and agent, but also with values of properties. Property-value pairs whose value was variable not assigned by the bindings are simply removed from the expanded provenance (for instance, as variable var:operation_type is unassigned, the property type was removed from the expansion).

provenance-b1

Below, we find the expanded provenance for the fourth binding. There, we see that two different outputs were provided output1 and output2, and they have been given different numbers of attributes.

provenance-b4

The language to express the bindings is a simple json structure. The first set of bindings is expressed as follows.

{
  "var": {
    "operation": [
      {
        "@id": "ex:operation1"
      }
    ],
    "agent": [
      {
        "@id": "ex:ag1"
      }
    ],
    "consumed1": [
      {
        "@id": "ex:input_1"
      }
    ],
    "consumed_value1": [
      {
        "@value": "4",
        "@type": "xsd:int"
      }
    ],
    "consumed2": [
      {
        "@id": "ex:input_2"
      }
    ],
    "consumed_value2": [
      {
        "@value": "5",
        "@type": "xsd:int"
      }
    ],
    "produced": [
      {
        "@id": "ex:output"
      }
    ],
    "produced_type": [
      {
        "@id": "ex:Result"
      }
    ],
    "produced_value": [
      {
        "@value": "20",
        "@type": "xsd:int"
      }
    ]
  },
  "context": {
    "ex": "http://example.org/#"
  },
  "template": "https://openprovenance.org/templates/org/openprovenance/generic/binaryop/1.provn"
}

 

Go ahead and experiment with templates and bindings using the service. For more details, please see previous posts.

Happy prov-templating …

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s