Skip to content

Commit

Permalink
Add uri of undefined competency to export, for consistency with data.
Browse files Browse the repository at this point in the history
  • Loading branch information
gloverkari committed Sep 28, 2023
1 parent deed8ca commit 91de853
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/main/server/adapter/ceasn/ceasn.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async function competencyPromise(compId, competencies, allCompetencies, f, ctx,
try {
var c = competencies[compId];
if (!c) {
resolve(null);
resolve(compId);
return;
}
if (c == null) resolve(c);
Expand Down Expand Up @@ -402,10 +402,16 @@ async function cassFrameworkAsCeasn() {
if (!c) {
continue;
}
if (!c["ceasn:isChildOf"] || c["ceasn:isChildOf"] == null) {
f["ceasn:hasTopChild"]["@list"].push(await ceasnExportUriTransform(c["@id"]));
if (!c["@id"]) {
// URI does not reference a valid competency.
// For consistency with the data and possible debugging purposes, it should still be included in JSON-LD export
f["ceasn:hasTopChild"]["@list"].push(await ceasnExportUriTransform(c));
} else {
if (!c["ceasn:isChildOf"] || c["ceasn:isChildOf"] == null) {
f["ceasn:hasTopChild"]["@list"].push(await ceasnExportUriTransform(c["@id"]));
}
f.competency.push(await ceasnExportUriTransform(c["@id"]));
}
f.competency.push(await ceasnExportUriTransform(c["@id"]));
}
f.context = "https://schema.cassproject.org/0.4/jsonld1.1/cass2ceasn.json";
delete f.relation;
Expand Down

0 comments on commit 91de853

Please sign in to comment.