From 91de853dfd817ee4fea126c055c6910244b6b46f Mon Sep 17 00:00:00 2001 From: "kari.glover" Date: Thu, 28 Sep 2023 12:21:05 -0700 Subject: [PATCH] Add uri of undefined competency to export, for consistency with data. --- src/main/server/adapter/ceasn/ceasn.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/server/adapter/ceasn/ceasn.js b/src/main/server/adapter/ceasn/ceasn.js index 2b4a1a4a8..8394ce3a4 100644 --- a/src/main/server/adapter/ceasn/ceasn.js +++ b/src/main/server/adapter/ceasn/ceasn.js @@ -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); @@ -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;