Skip to content

Commit

Permalink
Merge pull request #2 from virtual-vehicle/1-make-pipeline-look-for-c…
Browse files Browse the repository at this point in the history
…dk-elements-in-all-particles-not-only-in-stcrationale

1 make pipeline look for cdk elements in all particles not only in stcrationale
  • Loading branch information
levanthanh3005 authored Oct 25, 2024
2 parents 1fd9d78 + 2583f26 commit 0edfc69
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ jobs:
git commit -m "Add results [actions skip]"
git push
No_0_RequirementsPhase_DefineModelRequirements:
uses: virtual-vehicle/gaiax-ci/.github/workflows/No.0.RequirementsPhase.DefineModelRequirements.yaml@main
uses: virtual-vehicle/gaiax-ci/.github/workflows/No.0.RequirementsPhase.DefineModelRequirements.yaml@1-make-pipeline-look-for-cdk-elements-in-all-particles-not-only-in-stcrationale
secrets:
WRITE_WORKFLOW: ${{secrets.WRITE_WORKFLOW}}
No_1_ImplementationPhase_ImplementModel:
uses: virtual-vehicle/gaiax-ci/.github/workflows/No.1.ImplementationPhase.ImplementModel.yaml@main
uses: virtual-vehicle/gaiax-ci/.github/workflows/No.1.ImplementationPhase.ImplementModel.yaml@1-make-pipeline-look-for-cdk-elements-in-all-particles-not-only-in-stcrationale
secrets:
WRITE_WORKFLOW: ${{secrets.WRITE_WORKFLOW}}
2 changes: 1 addition & 1 deletion workflow_utils/parse_to_yaml.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if (stmdString === undefined)
// the locations are given as string arrays like
// ["stmd:SimulationTaskMetaData", "stmd:ImplementationPhase", "stmd:ImplementModel", "stc:Rationale"]
let stmdCrud = new StmdCrud(stmdString);
var stmdRationales = stmdCrud.findAllParticleLocation("stc:Rationale")
var stmdRationales = stmdCrud.getAllCredibilityLocations();

// create one workflow for each Rationale of a process phase
var count = 0;
Expand Down
3 changes: 2 additions & 1 deletion workflow_utils/stmd-crud/src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,5 @@ exports.GENERAL_INFORMATION_NAME = GENERAL_INFORMATION_NAME;
exports.CLASSIFICATION_PARENT_NAME = CLASSIFICATION_PARENT_NAME;
exports.ANNOTATIONS_PARENT_NAME = ANNOTATIONS_PARENT_NAME;
exports.RESOURCE_NAME = RESOURCE_NAME;
exports.RESOUCE_REFERENCE_NAME = RESOUCE_REFERENCE_NAME;
exports.RESOUCE_REFERENCE_NAME = RESOUCE_REFERENCE_NAME;
exports.PARTICLE_NAMES = particles;
24 changes: 14 additions & 10 deletions workflow_utils/stmd-crud/src/stmd_class.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const {
ROOT_ELEMENT_NAME,
LIFECYCLE_PARENT_NAME,
LIFECYCLE_ENTRY_NAMES,
GENERAL_INFORMATION_NAME } = require('./constants');
GENERAL_INFORMATION_NAME,
PARTICLE_NAMES } = require('./constants');

const {StmdWriter} = require('./stmd_writer');

Expand Down Expand Up @@ -1024,9 +1025,11 @@ exports.StmdReader = class StmdReader {
}

/**
* Find all Rational Tag location
* Returns all particle locations where cdk:Credibility elements are contained
*
* @returns {string[][]}
*/
findAllParticleLocation(particleName) {
getAllCredibilityLocations() {
let locationList = [];
let phaseRawParsed, stepRawParsed, currentLocation;

Expand All @@ -1036,20 +1039,21 @@ exports.StmdReader = class StmdReader {
phaseRawParsed = this.#stmdRawParsed[ROOT_ELEMENT_NAME][phase];
if (phaseRawParsed === undefined) continue;

currentLocation = [ROOT_ELEMENT_NAME, phase];
this.#addLinks(phaseRawParsed, currentLocation);

// loop through all steps of a phase (stmd:DefineModelRequirements, stmd:DefineParameterRequirements, ...)
const stmdStepNames = Object.keys(PHASE_TREE[ROOT_ELEMENT_NAME][phase]);
for (let step of stmdStepNames) {
stepRawParsed = phaseRawParsed[step];
if (stepRawParsed === undefined) continue;
if (stepRawParsed[particleName] == undefined) continue;
currentLocation = [ROOT_ELEMENT_NAME, phase, step, particleName];
// this.#addLinks(stepRawParsed, currentLocation);
locationList.push(currentLocation)

for (let particleName of Object.keys(PARTICLE_NAMES)) {
currentLocation = [ROOT_ELEMENT_NAME, phase, step, particleName];
let possibleCdkElement = this.getCdkElement(currentLocation);
if (possibleCdkElement.Processing.length > 0 || possibleCdkElement.Evidence.length > 0)
locationList.push(currentLocation);
}
}
}

return locationList;
}
}

0 comments on commit 0edfc69

Please sign in to comment.