Skip to contents

Add information about the relationships among DataObject members in a DataPackage, retrospectively describing the way in which derived data were created from source data using a processing program such as an R script. These provenance relationships allow the derived data to be understood sufficiently for users to be able to reproduce the computations that created the derived data, and to trace lineage of the derived data objects. The method describeWorkflow will add provenance relationships between a script that was executed, the files that it used as sources, and the derived files that it generated.


describeWorkflow(x, ...)

# S4 method for DataPackage
  sources = list(),
  program = NA_character_,
  derivations = list(),
  insertDerivations = TRUE,



The DataPackage to add provenance relationships to.


Additional parameters


A list of DataObjects for files that were read by the program. Alternatively, a list of DataObject identifiers can be specified as a list of character strings.


The DataObject created for the program such as an R script. Alternatively the DataObject identifier can be specified.


A list of DataObjects for files that were generated by the program. Alternatively, a list of DataObject identifiers can be specified as a list of character strings.


A logical value. If TRUE then the provenance relationship prov:wasDerivedFrom will be used to connect every source and derivation. The default value is TRUE.


This method operates on a DataPackage that has had DataObjects for the script, data sources (inputs), and data derivations (outputs) previously added to it, or can reference identifiers for objects that exist in other DataPackage instances. This allows a user to create a standalone package that contains all of its source, script, and derived data, or a set of data packages that are chained together via a set of derivation relationships between the members of those packages.

Provenance relationships are described following the the ProvONE data model, which can be viewed at In particular, the following relationships are inserted (among others):

  • prov:used indicates which source data was used by a program execution

  • prov:generatedBy indicates which derived data was created by a program execution

  • prov:wasDerivedFrom indicates the source data from which derived data were created using the program

See also

The R 'recordr' package for run-time recording of provenance relationships.


dp <- new("DataPackage")
# Add the script to the DataPackage
progFile <- system.file("./extdata/pkg-example/logit-regression-example.R", package="datapack")
progObj <- new("DataObject", format="application/R", filename=progFile)
dp <- addMember(dp, progObj)

# Add a script input to the DataPackage
inFile <- system.file("./extdata/pkg-example/binary.csv", package="datapack") 
inObj <- new("DataObject", format="text/csv", filename=inFile)
dp <- addMember(dp, inObj)

# Add a script output to the DataPackage
outFile <- system.file("./extdata/pkg-example/gre-predicted.png", package="datapack")
outObj <- new("DataObject", format="image/png", file=outFile)
dp <- addMember(dp, outObj)

# Add the provenenace relationshps, linking the input and output to the script execution
# Note: 'sources' and 'derivations' can also be lists of "DataObjects" or "DataObject' identifiers
dp <- describeWorkflow(dp, sources = inObj, program = progObj, derivations = outObj) 
# View the results
#>                                          subject
#> 6          _0e17df26-ccfb-42ba-86b2-3798afc14b43
#> 5          _0e17df26-ccfb-42ba-86b2-3798afc14b43
#> 1  urn:uuid:5fcae04b-8996-4103-bd17-7530422a45f1
#> 2  urn:uuid:630517d0-80fe-4dee-90d5-bea0a936b778
#> 11 urn:uuid:630517d0-80fe-4dee-90d5-bea0a936b778
#> 10 urn:uuid:630517d0-80fe-4dee-90d5-bea0a936b778
#>                                          predicate
#> 6
#> 5      
#> 1
#> 2
#> 11
#> 10
#>                                                      object subjectType
#> 6                  blank
#> 5             urn:uuid:768a2687-455e-4b74-b54c-1de0ea69fb12       blank
#> 1        <NA>
#> 2        <NA>
#> 11            urn:uuid:5fcae04b-8996-4103-bd17-7530422a45f1        <NA>
#> 10            urn:uuid:e59bb998-2b73-4631-926f-cc326237abc6        <NA>
#>    objectType dataTypeURI
#> 6         uri        <NA>
#> 5         uri        <NA>
#> 1         uri        <NA>
#> 2         uri        <NA>
#> 11       <NA>        <NA>
#> 10       <NA>        <NA>