From 52455be9a64e1e22735b8a10e0bc8573af0847a4 Mon Sep 17 00:00:00 2001 From: "kari.glover" Date: Fri, 25 Oct 2024 09:16:09 -0700 Subject: [PATCH] Update attribution property for CE PNA based on specs. --- src/main/server/adapter/ce/pna.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main/server/adapter/ce/pna.js b/src/main/server/adapter/ce/pna.js index e2a919d77..cf0ee2b71 100644 --- a/src/main/server/adapter/ce/pna.js +++ b/src/main/server/adapter/ce/pna.js @@ -38,14 +38,30 @@ async function pnaEndpoint() { name: process.env.PNA_DIRECTORY_NAME ? process.env.PNA_DIRECTORY_NAME : "", dateCreated: formattedNow }; + let attribution = ""; + if (framework["ceterms:ownedBy"]) { + if (Array.isArray(framework["ceterms:ownedBy"]) && framework["ceterms:ownedBy"].length > 0) { + attribution = framework["ceterms:ownedBy"][0]; + } else { + attribution = framework["ceterms:ownedBy"]; + } + } + if (attribution == "" && framework["schema:author"]) { + if (Array.isArray(framework["schema:author"]) && framework["schema:author"].length > 0) { + attribution = framework["schema:author"][0]; + } else { + attribution = framework["schema:author"]; + } + } pnaData["container"] = { id: ceasnEndpointFramework + query["id"], type: "Collection", fromDirectory: process.env.PNA_DIRECTORY ? process.env.PNA_DIRECTORY : "", name: framework["name"], description: framework["description"], - attributionURL: framework["author"] ? framework["author"] : (framework["ceterms:ownedBy"] ? framework["ceterms:ownedBy"] : ""), - beneficiaryRights: framework["rights"] ? framework["rights"] : (framework["license"] ? framework["license"] : ""), + attributionName: attribution.startsWith('http') ? "" : attribution, + attributionURL: attribution.startsWith('http') ? attribution : "", + beneficiaryRights: framework["ceasn:license"] ? framework["ceasn:license"] : (framework["schema:license"] ? framework["schema:license"] : ""), dataURL: ceasnEndpointFramework + query["id"], providerMetaModel: process.env.PNA_PROVIDER_META_MODEL ?process.env. PNA_PROVIDER_META_MODEL : "", registryRights: process.env.PNA_REGISTRY_RIGHTS ? process.env.PNA_REGISTRY_RIGHTS : "",