Class: Provenance

Provenance()

new Provenance()

Read and update a package's history: which data came from other data, which programs produced or consumed it, and which program runs followed earlier runs. The relationships are stored in the Resource Map's RDF graph.
Since:
  • 2.39.0
Source:

Methods

addGeneratedByProgram(dataPid, programPid) → {Provenance}

Record that a program package member produced a data object. The data may be inside or outside the package.
Parameters:
Name Type Description
dataPid string PID of the generated data object.
programPid string PID of the program package member.
Source:
Returns:
Updated provenance instance.
Type
Provenance

addUsedByProgram(dataPid, programPid) → {Provenance}

Record that a program package member consumed a data object as input. The data may be inside or outside the package.
Parameters:
Name Type Description
dataPid string PID of the used data object.
programPid string PID of the program package member.
Source:
Returns:
Updated provenance instance.
Type
Provenance

addWasDerivedFrom(derivedPid, sourcePid) → {Provenance}

Record that one data object was created from another (`derivedPid --wasDerivedFrom--> sourcePid`).
Parameters:
Name Type Description
derivedPid string PID of the derived data node.
sourcePid string PID of the source data node.
Source:
Returns:
Updated provenance instance.
Type
Provenance

getGeneratedByPrograms() → {Array.<ExecutionProgramRelationship>}

Return the program runs that produced data objects.
Source:
Returns:
Generation relationships, e.g. `[{ dataPid: "derived.1", programPid: "program.1", executionId: "urn:uuid:exec.1" }]`
Type
Array.<ExecutionProgramRelationship>

getTypeAssertions() → {Array.<TypeAssertion>}

Return `Data` and `Program` classifications that are written explicitly or inferred from how each PID is used in provenance relationships.
Source:
Returns:
Classifications keyed by PID, e.g. `[{ pid: "program.1", className: "Program" }]`
Type
Array.<TypeAssertion>

getUsedByPrograms() → {Array.<ExecutionProgramRelationship>}

Return the program runs that consumed data objects as inputs.
Source:
Returns:
Usage relationships, e.g. `[{ dataPid: "data.1", programPid: "program.1", executionId: "urn:uuid:exec.1" }]`
Type
Array.<ExecutionProgramRelationship>
Return pairs showing which data objects were created from which source data. RDF values that cannot be tied to PIDs are omitted.
Source:
Returns:
Derivation relationships, e.g. `[{ derivedPid: "derived.1", sourcePid: "data.1" }]`
Type
Array.<WasDerivedFromRelationship>

getWasInformedByPrograms() → {Array.<ProgramLineageRelationship>}

Return current/previous program pairs when one program run followed another (`prov:wasInformedBy`).
Source:
Returns:
Program ordering relationships, e.g. `[{ programPid: "program.1", previousProgramPid: "program.2" }]`
Type
Array.<ProgramLineageRelationship>

normalize(optionsopt) → {Provenance}

Add missing execution type or identifier statements only when existing relationships make the repair unambiguous.
Parameters:
Name Type Attributes Description
options object <optional>
Normalization options.
Properties
Name Type Attributes Description
markDirty boolean <optional>
Mark normalization changes unsaved.
Source:
Returns:
Updated provenance instance.
Type
Provenance

removeGeneratedByProgram(dataPid, programPid) → {Provenance}

Remove the record that a program produced a data object.
Parameters:
Name Type Description
dataPid string PID of the generated data object.
programPid string PID of the program object.
Source:
Returns:
Updated provenance instance.
Type
Provenance

removeUsedByProgram(dataPid, programPid) → {Provenance}

Remove the record that a program consumed a data object.
Parameters:
Name Type Description
dataPid string PID of the used data object.
programPid string PID of the program object.
Source:
Returns:
Updated provenance instance.
Type
Provenance

removeWasDerivedFrom(derivedPid, sourcePid) → {Provenance}

Remove the record that one data object was created from another.
Parameters:
Name Type Description
derivedPid string PID of the derived data node.
sourcePid string PID of the source data node.
Source:
Returns:
Updated provenance instance.
Type
Provenance

toJSON() → {object}

Return a consistently ordered provenance summary for diffs, tests, and JSON output.
Source:
Returns:
Ordered provenance summary
Type
object

validate() → {Array.<object>}

Check that provenance relationships have usable PIDs and reference valid program package members.
Source:
Returns:
Validation issues.
Type
Array.<object>

Provenance(options)

new Provenance(options)

Parameters:
Name Type Description
options object Provenance options.
Properties
Name Type Description
resourceMap ResourceMap Resource Map whose graph stores the provenance statements
Source:

Methods

addGeneratedByProgram(dataPid, programPid) → {Provenance}

Record that a program package member produced a data object. The data may be inside or outside the package.
Parameters:
Name Type Description
dataPid string PID of the generated data object.
programPid string PID of the program package member.
Source:
Returns:
Updated provenance instance.
Type
Provenance

addUsedByProgram(dataPid, programPid) → {Provenance}

Record that a program package member consumed a data object as input. The data may be inside or outside the package.
Parameters:
Name Type Description
dataPid string PID of the used data object.
programPid string PID of the program package member.
Source:
Returns:
Updated provenance instance.
Type
Provenance

addWasDerivedFrom(derivedPid, sourcePid) → {Provenance}

Record that one data object was created from another (`derivedPid --wasDerivedFrom--> sourcePid`).
Parameters:
Name Type Description
derivedPid string PID of the derived data node.
sourcePid string PID of the source data node.
Source:
Returns:
Updated provenance instance.
Type
Provenance

getGeneratedByPrograms() → {Array.<ExecutionProgramRelationship>}

Return the program runs that produced data objects.
Source:
Returns:
Generation relationships, e.g. `[{ dataPid: "derived.1", programPid: "program.1", executionId: "urn:uuid:exec.1" }]`
Type
Array.<ExecutionProgramRelationship>

getTypeAssertions() → {Array.<TypeAssertion>}

Return `Data` and `Program` classifications that are written explicitly or inferred from how each PID is used in provenance relationships.
Source:
Returns:
Classifications keyed by PID, e.g. `[{ pid: "program.1", className: "Program" }]`
Type
Array.<TypeAssertion>

getUsedByPrograms() → {Array.<ExecutionProgramRelationship>}

Return the program runs that consumed data objects as inputs.
Source:
Returns:
Usage relationships, e.g. `[{ dataPid: "data.1", programPid: "program.1", executionId: "urn:uuid:exec.1" }]`
Type
Array.<ExecutionProgramRelationship>
Return pairs showing which data objects were created from which source data. RDF values that cannot be tied to PIDs are omitted.
Source:
Returns:
Derivation relationships, e.g. `[{ derivedPid: "derived.1", sourcePid: "data.1" }]`
Type
Array.<WasDerivedFromRelationship>

getWasInformedByPrograms() → {Array.<ProgramLineageRelationship>}

Return current/previous program pairs when one program run followed another (`prov:wasInformedBy`).
Source:
Returns:
Program ordering relationships, e.g. `[{ programPid: "program.1", previousProgramPid: "program.2" }]`
Type
Array.<ProgramLineageRelationship>

normalize(optionsopt) → {Provenance}

Add missing execution type or identifier statements only when existing relationships make the repair unambiguous.
Parameters:
Name Type Attributes Description
options object <optional>
Normalization options.
Properties
Name Type Attributes Description
markDirty boolean <optional>
Mark normalization changes unsaved.
Source:
Returns:
Updated provenance instance.
Type
Provenance

removeGeneratedByProgram(dataPid, programPid) → {Provenance}

Remove the record that a program produced a data object.
Parameters:
Name Type Description
dataPid string PID of the generated data object.
programPid string PID of the program object.
Source:
Returns:
Updated provenance instance.
Type
Provenance

removeUsedByProgram(dataPid, programPid) → {Provenance}

Remove the record that a program consumed a data object.
Parameters:
Name Type Description
dataPid string PID of the used data object.
programPid string PID of the program object.
Source:
Returns:
Updated provenance instance.
Type
Provenance

removeWasDerivedFrom(derivedPid, sourcePid) → {Provenance}

Remove the record that one data object was created from another.
Parameters:
Name Type Description
derivedPid string PID of the derived data node.
sourcePid string PID of the source data node.
Source:
Returns:
Updated provenance instance.
Type
Provenance

toJSON() → {object}

Return a consistently ordered provenance summary for diffs, tests, and JSON output.
Source:
Returns:
Ordered provenance summary
Type
object

validate() → {Array.<object>}

Check that provenance relationships have usable PIDs and reference valid program package members.
Source:
Returns:
Validation issues.
Type
Array.<object>