// Provenance entities involved in the IsCSVReadyFileExists event. // representing some user input as an artifact ProvenanceArtifact CSVRootPathArtifact = pcf.newArtifact("CSVRootPathArtifact", PC3Utilities.ns("CSVRootPathResource")); // representing the call itself ProvenanceProcess IsCSVReadyFileExistsProcess = pcf.newProcess("IsCSVReadyFileExistsProcess",PC3Utilities.ns("IsCSVReadyFileExistsProcess")); // representing the boolean artifact generated by a call to IsCSVReadyFileExists ProvenanceArtifact IsCSVReadyFileExistsArtifact = pcf.newArtifact("IsCSVReadyFileExistsArtifact", PC3Utilities.ns("IsCSVReadyFileExistsArtifact")); // representing the conditional which check that IsCSVReadyFileExists returned true ProvenanceProcess IsCSVReadyFileExistsConditional = pcf.newProcess("IsCSVReadyFileExistsConditional", PC3Utilities.ns("IsCSVReadyFileExistsConditional")); boolean IsCSVReadyFileExistsOutput = LoadAppLogic.IsCSVReadyFileExists(CSVRootPath); // Assert OPM relationships between entities // say the users input artifact was used the OPM process representing the call to IsCSVReadyFileExists pcf.assertUsed(IsCSVReadyFileExistsProcess, CSVRootPathArtifact, pcf.newRole("path to csv directory", PC3Utilities.ns("role1")), account); // say the OPM process representing the call to IsCSVReadyFileExists generates the OPM artifact representing the boolean result pcf.assertGeneratedBy(IsCSVReadyFileExistsArtifact, IsCSVReadyFileExistsProcess, pcf.newRole("check result", PC3Utilities.ns("role2")), account); if (!IsCSVReadyFileExistsOutput) throw new RuntimeException("IsCSVReadyFileExists failed"); // More OPM assertions about this event // say the OPM process representing the conditional used the boolean artifact produced by a call to IsCSVReadyFileExists pcf.assertUsed(IsCSVReadyFileExistsConditional, IsCSVReadyFileExistsArtifact, pcf.newRole("boolean input", PC3Utilities.ns("role3")), account); // representing an event that will be executed next in the workflow ProvenanceProcess ReadCSVReadyFileProcess = pcf.newProcess("ReadCSVReadyFileProcess", PC3Utilities.ns("ReadCSVReadyFileProcess")); // assert that since the conditional did not throw an exception that the conditional process triggers the next event pcf.assertTriggeredBy(ReadCSVReadyFileProcess, IsCSVReadyFileExistsConditional, account);