Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ce 1328.1 #284

Merged
merged 3 commits into from
Sep 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions src/main/server/adapter/ceasn/ceasn.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,12 @@ async function competencyPromise(compId, competencies, allCompetencies, f, ctx,
return new Promise(async (resolve) => {
try {
var c = competencies[compId];
if (!c) {
resolve(compId);
return;
}
if (c == null) resolve(c);
if (c["ceasn:hasChild"] != null && c["ceasn:hasChild"]["@list"] != null)
if (c["ceasn:hasChild"] != null && c["ceasn:hasChild"]["@list"] && c["ceasn:hasChild"]["@list"] != null)
c["ceasn:hasChild"]["@list"].sort(function (a, b) {
return allCompetencies.indexOf(a) - allCompetencies.indexOf(b);
});
Expand Down Expand Up @@ -395,10 +399,16 @@ async function cassFrameworkAsCeasn() {
};
}
for (let c of competencies) {
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 Expand Up @@ -502,6 +512,9 @@ async function cassFrameworkAsCeasn() {
results.push(f);
for (var k in competencies) {
var c = competencies[k];
if (!c) {
continue;
}
var found = false;
for (var j = 0; j < results.length; j++)
if (results[j]["@id"] == competencies[k]["@id"]) {
Expand Down
Loading