Skip to content

Commit 52455be

Browse files
committed
Update attribution property for CE PNA based on specs.
1 parent f9a38c7 commit 52455be

File tree

1 file changed

+18
-2
lines changed
  • src/main/server/adapter/ce

1 file changed

+18
-2
lines changed

src/main/server/adapter/ce/pna.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,30 @@ async function pnaEndpoint() {
3838
name: process.env.PNA_DIRECTORY_NAME ? process.env.PNA_DIRECTORY_NAME : "",
3939
dateCreated: formattedNow
4040
};
41+
let attribution = "";
42+
if (framework["ceterms:ownedBy"]) {
43+
if (Array.isArray(framework["ceterms:ownedBy"]) && framework["ceterms:ownedBy"].length > 0) {
44+
attribution = framework["ceterms:ownedBy"][0];
45+
} else {
46+
attribution = framework["ceterms:ownedBy"];
47+
}
48+
}
49+
if (attribution == "" && framework["schema:author"]) {
50+
if (Array.isArray(framework["schema:author"]) && framework["schema:author"].length > 0) {
51+
attribution = framework["schema:author"][0];
52+
} else {
53+
attribution = framework["schema:author"];
54+
}
55+
}
4156
pnaData["container"] = {
4257
id: ceasnEndpointFramework + query["id"],
4358
type: "Collection",
4459
fromDirectory: process.env.PNA_DIRECTORY ? process.env.PNA_DIRECTORY : "",
4560
name: framework["name"],
4661
description: framework["description"],
47-
attributionURL: framework["author"] ? framework["author"] : (framework["ceterms:ownedBy"] ? framework["ceterms:ownedBy"] : ""),
48-
beneficiaryRights: framework["rights"] ? framework["rights"] : (framework["license"] ? framework["license"] : ""),
62+
attributionName: attribution.startsWith('http') ? "" : attribution,
63+
attributionURL: attribution.startsWith('http') ? attribution : "",
64+
beneficiaryRights: framework["ceasn:license"] ? framework["ceasn:license"] : (framework["schema:license"] ? framework["schema:license"] : ""),
4965
dataURL: ceasnEndpointFramework + query["id"],
5066
providerMetaModel: process.env.PNA_PROVIDER_META_MODEL ?process.env. PNA_PROVIDER_META_MODEL : "",
5167
registryRights: process.env.PNA_REGISTRY_RIGHTS ? process.env.PNA_REGISTRY_RIGHTS : "",

0 commit comments

Comments
 (0)