From 651c23685ea0bb23c66f89a1fce900a3fb6c9b89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aatu=20Nyk=C3=A4nen?= <27770287+aatuny@users.noreply.github.com> Date: Tue, 12 Nov 2024 12:07:01 +0200 Subject: [PATCH] Fix f540 and f856 generators (#186) * Fix f540 generation: uses now only predefined mappings for generating copyright note * Fix f856 generation logic --- src/transform/convert/common/generate5xx.js | 84 +++++++++++-------- src/transform/convert/common/generate8xx.js | 84 +++++++++++-------- .../generate5xx/generate540/01/input.json | 16 ---- .../generate5xx/generate540/01/metadata.json | 2 +- .../generate5xx/generate540/01/output.json | 16 +--- .../generate5xx/generate540/04/input.json | 32 +++++++ .../generate5xx/generate540/04/metadata.json | 4 + .../generate5xx/generate540/04/output.json | 1 + .../generate5xx/generate540/05/input.json | 32 +++++++ .../generate5xx/generate540/05/metadata.json | 4 + .../generate5xx/generate540/05/output.json | 1 + .../generate5xx/generate540/06/input.json | 32 +++++++ .../generate5xx/generate540/06/metadata.json | 4 + .../generate5xx/generate540/06/output.json | 1 + .../generate5xx/generate540/07/input.json | 9 ++ .../generate5xx/generate540/07/metadata.json | 4 + .../generate5xx/generate540/07/output.json | 10 +++ .../generate5xx/generate540/08/input.json | 9 ++ .../generate5xx/generate540/08/metadata.json | 4 + .../generate5xx/generate540/08/output.json | 10 +++ .../generate5xx/generate540/09/input.json | 9 ++ .../generate5xx/generate540/09/metadata.json | 4 + .../generate5xx/generate540/09/output.json | 10 +++ .../generate5xx/generate540/10/input.json | 9 ++ .../generate5xx/generate540/10/metadata.json | 4 + .../generate5xx/generate540/10/output.json | 10 +++ .../generate5xx/generate540/11/input.json | 9 ++ .../generate5xx/generate540/11/metadata.json | 4 + .../generate5xx/generate540/11/output.json | 10 +++ .../generate5xx/generate540/12/input.json | 9 ++ .../generate5xx/generate540/12/metadata.json | 4 + .../generate5xx/generate540/12/output.json | 10 +++ .../generate5xx/generate540/13/input.json | 9 ++ .../generate5xx/generate540/13/metadata.json | 4 + .../generate5xx/generate540/13/output.json | 1 + .../generate8xx/generate856/01/input.json | 2 +- .../generate8xx/generate856/01/metadata.json | 2 +- .../generate8xx/generate856/01/output.json | 3 +- .../generate8xx/generate856/03/input.json | 2 +- .../generate8xx/generate856/03/metadata.json | 2 +- .../generate8xx/generate856/04/input.json | 18 ++++ .../generate8xx/generate856/04/metadata.json | 4 + .../generate8xx/generate856/04/output.json | 9 ++ .../generate8xx/generate856/05/input.json | 18 ++++ .../generate8xx/generate856/05/metadata.json | 4 + .../generate8xx/generate856/05/output.json | 9 ++ 46 files changed, 433 insertions(+), 105 deletions(-) create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/04/input.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/04/metadata.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/04/output.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/05/input.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/05/metadata.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/05/output.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/06/input.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/06/metadata.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/06/output.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/07/input.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/07/metadata.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/07/output.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/08/input.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/08/metadata.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/08/output.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/09/input.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/09/metadata.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/09/output.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/10/input.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/10/metadata.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/10/output.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/11/input.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/11/metadata.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/11/output.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/12/input.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/12/metadata.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/12/output.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/13/input.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/13/metadata.json create mode 100644 test-fixtures/transform/convert/common/generate5xx/generate540/13/output.json create mode 100644 test-fixtures/transform/convert/common/generate8xx/generate856/04/input.json create mode 100644 test-fixtures/transform/convert/common/generate8xx/generate856/04/metadata.json create mode 100644 test-fixtures/transform/convert/common/generate8xx/generate856/04/output.json create mode 100644 test-fixtures/transform/convert/common/generate8xx/generate856/05/input.json create mode 100644 test-fixtures/transform/convert/common/generate8xx/generate856/05/metadata.json create mode 100644 test-fixtures/transform/convert/common/generate8xx/generate856/05/output.json diff --git a/src/transform/convert/common/generate5xx.js b/src/transform/convert/common/generate5xx.js index 8f33543..82bd70a 100644 --- a/src/transform/convert/common/generate5xx.js +++ b/src/transform/convert/common/generate5xx.js @@ -178,49 +178,65 @@ export function generate506({getFieldValues}) { * @returns Empty array or array containing field 540 */ export function generate540({getFieldValues}) { - if (blockGeneration({getFieldValues})) { + const rightsValues = getFieldValues('dc.rights'); + + if (blockGeneration(rightsValues)) { return []; } - const rights = generateRights(); - const uri = generateUri(); - const url = generateUrl(); - - return rights.concat(uri, url); - - function generateRights() { - const values = getFieldValues('dc.rights'); - return values.map(value => { - const subfields = generateSubfields(); - return {tag: '540', ind1: '', ind2: '', subfields}; - - function generateSubfields() { - return (/All rights reserved/u).test(value) ? [{code: 'a', value}] : [{code: 'c', value}]; - } - }); - } + const fieldMap = { + 'cc by-nc-nd 4.0': { + value: 'CC BY-NC-ND 4.0', + url: 'https://creativecommons.org/licenses/by-nc-nd/4.0/deed.fi' + }, + 'cc by-sa 4.0': { + value: 'CC BY-SA 4.0', + url: 'https://creativecommons.org/licenses/by-sa/4.0/deed.fi' + }, + 'cc by-sa 4.0 nimeä-jaasamoin': { + value: 'CC BY-SA 4.0', + url: 'https://creativecommons.org/licenses/by-sa/4.0/deed.fi' + }, + 'cc by-nd 4.0': { + value: 'CC BY-ND 4.0', + url: 'https://creativecommons.org/licenses/by-nd/4.0/deed.fi' + }, + 'cc by-nc 4.0': { + value: 'CC BY-NC 4.0', + url: 'https://creativecommons.org/licenses/by-nc/4.0/deed.fi' + }, + 'cc by-nc-sa 4.0': { + value: 'CC BY-NC-SA 4.0', + url: 'https://creativecommons.org/licenses/by-nc-sa/4.0/deed.fi' + }, + 'cc by 4.0': { + value: 'CC BY 4.0', + url: 'https://creativecommons.org/licenses/by/4.0/deed.fi' + } + }; - function generateUri() { - const values = getFieldValues('dc.rights.uri'); - return values.map(value => ({ + return rightsValues + .map(v => v.toLowerCase()) + .filter(v => Object.keys(fieldMap).includes(v)) + .map(k => ({ tag: '540', ind1: '', ind2: '', - subfields: [{code: 'u', value}] + subfields: [ + {code: 'f', value: fieldMap[k].value}, + {code: '2', value: 'cc'}, + {code: 'u', value: fieldMap[k].url} + ] })); - } - function generateUrl() { - const values = getFieldValues('dc.rights.url'); - return values.map(value => ({ - tag: '540', ind1: '', ind2: '', - subfields: [{code: 'u', value}] - })); - } - function blockGeneration({getFieldValues}) { - const rightsFields = getFieldValues('dc.rights'); - const blockValues = ['This publication is copyrighted. You may download, display and print it for Your own personal use. Commercial use is prohibited.']; + function blockGeneration(rightsValues) { + const blockValues = [ + 'This publication is copyrighted. You may download, display and print it for Your own personal use. Commercial use is prohibited.', + 'Tekijänoikeuslaki (404/1961) 9 § Tekijänoikeussuojaa vailla olevat teokset', + 'Upphovsrättslag (404/1961) 9 § Verk utan upphovsrättsskydd', + 'Copyright Act (404/1961) 9 § Works excluded from protection' + ]; - return rightsFields.some(v => blockValues.includes(v)); + return rightsValues.some(v => blockValues.includes(v)); } } diff --git a/src/transform/convert/common/generate8xx.js b/src/transform/convert/common/generate8xx.js index e03c37e..7e3f2f7 100644 --- a/src/transform/convert/common/generate8xx.js +++ b/src/transform/convert/common/generate8xx.js @@ -7,68 +7,82 @@ import {isOpenAccess, isValidLink} from '../util'; import {sourceConfig} from '../../../config'; /** - * Generates field 856 ($u: optional, $y: optional). - * Field generation is based on dc.rights.accesslevel value. - * 856 fields relating to publicly available access prioritization: - * URN and DOI > URI and URL. + * Generates field 856 ($u, $y: optional). * @param {Object} ValueInterface containing getFieldValues function * @returns Empty array or array containing field 856 ($u, $y) */ export function generate856({getFieldValues}) { - const publicAccessFields = generatePublicAccessFields(); - const otherUrnFields = generateOtherUrnFields(); + const publicAccessFields = generatePublicAccessFields({getFieldValues}); + const otherUrnFields = generateOtherUrnFields({getFieldValues}); return publicAccessFields.concat(otherUrnFields); - function generatePublicAccessFields() { + /** + * Generation prioritization if open access fields are to be generated: + * 1. If dc.identifier.urn has value(s), generate subfields using all these values + * 2. If dc.identifier.doi/dc.identifier.uri have value(s), generate subfields using all these values + */ + function generatePublicAccessFields({getFieldValues}) { const openAccess = isOpenAccess({getFieldValues}); - // NB: not having access level fields generates f856 public access field if (openAccess) { - const subfields = generateSubfields(); + const subfields = generateSubfields({getFieldValues}); return subfields.length > 0 ? [{tag: '856', ind1: '4', ind2: '0', subfields}] : []; } return []; - function generateSubfields() { - const linkSubfields = generateLinkSubfields(); + + function generateSubfields({getFieldValues}) { + const linkSubfields = generateLinkSubfields({getFieldValues}); return linkSubfields.length > 0 ? linkSubfields.concat({code: 'y', value: 'Linkki verkkoaineistoon'}) : []; } - } - function generateOtherUrnFields() { - const urn = getFieldValues('dc.relation.urn'); + function generateLinkSubfields({getFieldValues}) { + const urn = generateUrn({getFieldValues}); + const doi = generateU('dc.identifier.doi', {getFieldValues}); + const uri = generateU('dc.identifier.uri', {getFieldValues}); - return urn.length > 0 ? [ - { - tag: '856', ind1: '4', ind2: '2', - subfields: [{code: 'u', value: urn[0]}] + if (urn.length > 0) { + return urn; } - ] : []; - } - function generateLinkSubfields() { - const urn = generateUrn(); - const doi = generateU('dc.identifier.doi'); - const uri = generateU('dc.identifier.uri'); - const url = generateU('dc.identifier.url'); + return doi.concat(uri); - if (urn.length > 0) { - return doi ? urn.concat(doi) : urn; + // NB: URN needs to be in proper format (http|https://urn.fi/) or otherwise it will not be used in subfield generation + function generateUrn({getFieldValues}) { + const values = getFieldValues('dc.identifier.urn'); + return values + .filter(urnIsValid) + .map(mapUrnValue) + .map(v => ({code: 'u', value: v})); + } + + function generateU(path, {getFieldValues}) { + const values = getFieldValues(path); + return values.filter(value => isValidLink(value)).map(value => ({code: 'u', value})); + } } + } - return doi.concat(uri, url); + function generateOtherUrnFields({getFieldValues}) { + const urn = getFieldValues('dc.relation.urn'); + const firstUrnValue = urn.length > 0 ? urn[0] : null; + const validUrn = urnIsValid(firstUrnValue); - function generateUrn() { - const values = getFieldValues('dc.identifier.urn'); - return values.map(v => ({code: 'u', value: (/http:\/\/urn.fi\//u).test(v) ? v : `http://urn.fi/${v}`})); + if (!firstUrnValue || !validUrn) { + return []; } - function generateU(path) { - const values = getFieldValues(path); - return values.filter(value => isValidLink(value)).map(value => ({code: 'u', value})); - } + return [{tag: '856', ind1: '4', ind2: '2', subfields: [{code: 'u', value: mapUrnValue(firstUrnValue)}]}]; + } + + function urnIsValid(urn) { + return (/https?:\/\/urn.fi\//u).test(urn) || (/^URN:/u).test(urn); + } + + function mapUrnValue(urn) { + return (/https?:\/\/urn.fi\//u).test(urn) ? urn : `http://urn.fi/${urn}`; } } diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/01/input.json b/test-fixtures/transform/convert/common/generate5xx/generate540/01/input.json index afb6ef4..8d1185d 100644 --- a/test-fixtures/transform/convert/common/generate5xx/generate540/01/input.json +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/01/input.json @@ -5,21 +5,5 @@ "element": "rights", "value": "CC BY 4.0" } - }, - { - "$": { - "schema": "dc", - "element": "rights", - "qualifier": "url", - "value": "https://creativecommons.org/licenses/by/4.0/" - } - }, - { - "$": { - "schema": "dc", - "element": "rights", - "qualifier": "uri", - "value": "https://creativecommons.org/licenses/by/4.0/deed.en" - } } ] \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/01/metadata.json b/test-fixtures/transform/convert/common/generate5xx/generate540/01/metadata.json index bd99ac7..3a98e7f 100644 --- a/test-fixtures/transform/convert/common/generate5xx/generate540/01/metadata.json +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/01/metadata.json @@ -1,4 +1,4 @@ { - "description": "Generates f540 from each dc.rights, dc.rights.url and dc.rights.uri information", + "description": "Generates f540 for CC BY 4.0 using predefined mapping", "only": false } \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/01/output.json b/test-fixtures/transform/convert/common/generate5xx/generate540/01/output.json index a51dabf..0d97fe2 100644 --- a/test-fixtures/transform/convert/common/generate5xx/generate540/01/output.json +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/01/output.json @@ -2,19 +2,9 @@ { "tag": "540", "ind1": "", "ind2": "", "subfields": [ - {"code": "c", "value": "CC BY 4.0"} - ] - }, - { - "tag": "540", "ind1": "", "ind2": "", - "subfields": [ - {"code": "u", "value": "https://creativecommons.org/licenses/by/4.0/deed.en"} - ] - }, - { - "tag": "540", "ind1": "", "ind2": "", - "subfields": [ - {"code": "u", "value": "https://creativecommons.org/licenses/by/4.0/"} + {"code": "f", "value": "CC BY 4.0"}, + {"code": "2", "value": "cc"}, + {"code": "u", "value": "https://creativecommons.org/licenses/by/4.0/deed.fi"} ] } ] \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/04/input.json b/test-fixtures/transform/convert/common/generate5xx/generate540/04/input.json new file mode 100644 index 0000000..6ff832e --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/04/input.json @@ -0,0 +1,32 @@ +[ + { + "$": { + "schema": "dc", + "element": "rights", + "value": "CC BY 4.0" + } + }, + { + "$": { + "schema": "dc", + "element": "rights", + "qualifier": "url", + "value": "https://creativecommons.org/licenses/by/4.0/" + } + }, + { + "$": { + "schema": "dc", + "element": "rights", + "qualifier": "uri", + "value": "https://creativecommons.org/licenses/by/4.0/deed.en" + } + }, + { + "$": { + "schema": "dc", + "element": "rights", + "value": "Tekijänoikeuslaki (404/1961) 9 § Tekijänoikeussuojaa vailla olevat teokset" + } + } +] \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/04/metadata.json b/test-fixtures/transform/convert/common/generate5xx/generate540/04/metadata.json new file mode 100644 index 0000000..0bbb11e --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/04/metadata.json @@ -0,0 +1,4 @@ +{ + "description": "Blocks generation of f540 if dc.rights has note regarding exclusion from protection (Finnish)", + "only": false +} \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/04/output.json b/test-fixtures/transform/convert/common/generate5xx/generate540/04/output.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/04/output.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/05/input.json b/test-fixtures/transform/convert/common/generate5xx/generate540/05/input.json new file mode 100644 index 0000000..9e0050c --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/05/input.json @@ -0,0 +1,32 @@ +[ + { + "$": { + "schema": "dc", + "element": "rights", + "value": "CC BY 4.0" + } + }, + { + "$": { + "schema": "dc", + "element": "rights", + "qualifier": "url", + "value": "https://creativecommons.org/licenses/by/4.0/" + } + }, + { + "$": { + "schema": "dc", + "element": "rights", + "qualifier": "uri", + "value": "https://creativecommons.org/licenses/by/4.0/deed.en" + } + }, + { + "$": { + "schema": "dc", + "element": "rights", + "value": "Upphovsrättslag (404/1961) 9 § Verk utan upphovsrättsskydd" + } + } +] \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/05/metadata.json b/test-fixtures/transform/convert/common/generate5xx/generate540/05/metadata.json new file mode 100644 index 0000000..1907da3 --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/05/metadata.json @@ -0,0 +1,4 @@ +{ + "description": "Blocks generation of f540 if dc.rights has note regarding exclusion from protection (Swedish)", + "only": false +} \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/05/output.json b/test-fixtures/transform/convert/common/generate5xx/generate540/05/output.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/05/output.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/06/input.json b/test-fixtures/transform/convert/common/generate5xx/generate540/06/input.json new file mode 100644 index 0000000..d0aeca0 --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/06/input.json @@ -0,0 +1,32 @@ +[ + { + "$": { + "schema": "dc", + "element": "rights", + "value": "CC BY 4.0" + } + }, + { + "$": { + "schema": "dc", + "element": "rights", + "qualifier": "url", + "value": "https://creativecommons.org/licenses/by/4.0/" + } + }, + { + "$": { + "schema": "dc", + "element": "rights", + "qualifier": "uri", + "value": "https://creativecommons.org/licenses/by/4.0/deed.en" + } + }, + { + "$": { + "schema": "dc", + "element": "rights", + "value": "Copyright Act (404/1961) 9 § Works excluded from protection" + } + } +] \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/06/metadata.json b/test-fixtures/transform/convert/common/generate5xx/generate540/06/metadata.json new file mode 100644 index 0000000..6fb9f6f --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/06/metadata.json @@ -0,0 +1,4 @@ +{ + "description": "Blocks generation of f540 if dc.rights has note regarding exclusion from protection (English)", + "only": false +} \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/06/output.json b/test-fixtures/transform/convert/common/generate5xx/generate540/06/output.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/06/output.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/07/input.json b/test-fixtures/transform/convert/common/generate5xx/generate540/07/input.json new file mode 100644 index 0000000..d467030 --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/07/input.json @@ -0,0 +1,9 @@ +[ + { + "$": { + "schema": "dc", + "element": "rights", + "value": "CC BY-NC-ND 4.0" + } + } +] \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/07/metadata.json b/test-fixtures/transform/convert/common/generate5xx/generate540/07/metadata.json new file mode 100644 index 0000000..fa56cd6 --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/07/metadata.json @@ -0,0 +1,4 @@ +{ + "description": "Generates f540 for CC BY-NC-ND 4.0 using predefined mapping", + "only": false +} \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/07/output.json b/test-fixtures/transform/convert/common/generate5xx/generate540/07/output.json new file mode 100644 index 0000000..55d426e --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/07/output.json @@ -0,0 +1,10 @@ +[ + { + "tag": "540", "ind1": "", "ind2": "", + "subfields": [ + {"code": "f", "value": "CC BY-NC-ND 4.0"}, + {"code": "2", "value": "cc"}, + {"code": "u", "value": "https://creativecommons.org/licenses/by-nc-nd/4.0/deed.fi"} + ] + } +] \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/08/input.json b/test-fixtures/transform/convert/common/generate5xx/generate540/08/input.json new file mode 100644 index 0000000..65411c1 --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/08/input.json @@ -0,0 +1,9 @@ +[ + { + "$": { + "schema": "dc", + "element": "rights", + "value": "CC BY-SA 4.0 Nimeä-JaaSamoin" + } + } +] \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/08/metadata.json b/test-fixtures/transform/convert/common/generate5xx/generate540/08/metadata.json new file mode 100644 index 0000000..a88b983 --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/08/metadata.json @@ -0,0 +1,4 @@ +{ + "description": "Generates f540 for CC BY-SA 4.0 Nimeä-JaaSamoin using predefined mapping", + "only": false +} \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/08/output.json b/test-fixtures/transform/convert/common/generate5xx/generate540/08/output.json new file mode 100644 index 0000000..bd4bdf8 --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/08/output.json @@ -0,0 +1,10 @@ +[ + { + "tag": "540", "ind1": "", "ind2": "", + "subfields": [ + {"code": "f", "value": "CC BY-SA 4.0"}, + {"code": "2", "value": "cc"}, + {"code": "u", "value": "https://creativecommons.org/licenses/by-sa/4.0/deed.fi"} + ] + } +] \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/09/input.json b/test-fixtures/transform/convert/common/generate5xx/generate540/09/input.json new file mode 100644 index 0000000..c0275d8 --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/09/input.json @@ -0,0 +1,9 @@ +[ + { + "$": { + "schema": "dc", + "element": "rights", + "value": "cc by-sa 4.0" + } + } +] \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/09/metadata.json b/test-fixtures/transform/convert/common/generate5xx/generate540/09/metadata.json new file mode 100644 index 0000000..2c8c58c --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/09/metadata.json @@ -0,0 +1,4 @@ +{ + "description": "Generates f540 for cc by-sa 4.0 using predefined mapping", + "only": false +} \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/09/output.json b/test-fixtures/transform/convert/common/generate5xx/generate540/09/output.json new file mode 100644 index 0000000..bd4bdf8 --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/09/output.json @@ -0,0 +1,10 @@ +[ + { + "tag": "540", "ind1": "", "ind2": "", + "subfields": [ + {"code": "f", "value": "CC BY-SA 4.0"}, + {"code": "2", "value": "cc"}, + {"code": "u", "value": "https://creativecommons.org/licenses/by-sa/4.0/deed.fi"} + ] + } +] \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/10/input.json b/test-fixtures/transform/convert/common/generate5xx/generate540/10/input.json new file mode 100644 index 0000000..8558976 --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/10/input.json @@ -0,0 +1,9 @@ +[ + { + "$": { + "schema": "dc", + "element": "rights", + "value": "cc by-nd 4.0" + } + } +] \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/10/metadata.json b/test-fixtures/transform/convert/common/generate5xx/generate540/10/metadata.json new file mode 100644 index 0000000..ec6537c --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/10/metadata.json @@ -0,0 +1,4 @@ +{ + "description": "Generates f540 for cc by-nd 4.0 using predefined mapping", + "only": false +} \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/10/output.json b/test-fixtures/transform/convert/common/generate5xx/generate540/10/output.json new file mode 100644 index 0000000..722870b --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/10/output.json @@ -0,0 +1,10 @@ +[ + { + "tag": "540", "ind1": "", "ind2": "", + "subfields": [ + {"code": "f", "value": "CC BY-ND 4.0"}, + {"code": "2", "value": "cc"}, + {"code": "u", "value": "https://creativecommons.org/licenses/by-nd/4.0/deed.fi"} + ] + } +] \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/11/input.json b/test-fixtures/transform/convert/common/generate5xx/generate540/11/input.json new file mode 100644 index 0000000..e62e6f8 --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/11/input.json @@ -0,0 +1,9 @@ +[ + { + "$": { + "schema": "dc", + "element": "rights", + "value": "cc by-nc 4.0" + } + } +] \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/11/metadata.json b/test-fixtures/transform/convert/common/generate5xx/generate540/11/metadata.json new file mode 100644 index 0000000..75add4b --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/11/metadata.json @@ -0,0 +1,4 @@ +{ + "description": "Generates f540 for cc by-nc 4.0 using predefined mapping", + "only": false +} \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/11/output.json b/test-fixtures/transform/convert/common/generate5xx/generate540/11/output.json new file mode 100644 index 0000000..f420834 --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/11/output.json @@ -0,0 +1,10 @@ +[ + { + "tag": "540", "ind1": "", "ind2": "", + "subfields": [ + {"code": "f", "value": "CC BY-NC 4.0"}, + {"code": "2", "value": "cc"}, + {"code": "u", "value": "https://creativecommons.org/licenses/by-nc/4.0/deed.fi"} + ] + } +] \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/12/input.json b/test-fixtures/transform/convert/common/generate5xx/generate540/12/input.json new file mode 100644 index 0000000..2489c15 --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/12/input.json @@ -0,0 +1,9 @@ +[ + { + "$": { + "schema": "dc", + "element": "rights", + "value": "cc by-nc-sa 4.0" + } + } +] \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/12/metadata.json b/test-fixtures/transform/convert/common/generate5xx/generate540/12/metadata.json new file mode 100644 index 0000000..3dcca53 --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/12/metadata.json @@ -0,0 +1,4 @@ +{ + "description": "Generates f540 for cc by-nc-sa 4.0 using predefined mapping", + "only": false +} \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/12/output.json b/test-fixtures/transform/convert/common/generate5xx/generate540/12/output.json new file mode 100644 index 0000000..8aea3f2 --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/12/output.json @@ -0,0 +1,10 @@ +[ + { + "tag": "540", "ind1": "", "ind2": "", + "subfields": [ + {"code": "f", "value": "CC BY-NC-SA 4.0"}, + {"code": "2", "value": "cc"}, + {"code": "u", "value": "https://creativecommons.org/licenses/by-nc-sa/4.0/deed.fi"} + ] + } +] \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/13/input.json b/test-fixtures/transform/convert/common/generate5xx/generate540/13/input.json new file mode 100644 index 0000000..298c72a --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/13/input.json @@ -0,0 +1,9 @@ +[ + { + "$": { + "schema": "dc", + "element": "rights", + "value": "FooBar" + } + } +] \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/13/metadata.json b/test-fixtures/transform/convert/common/generate5xx/generate540/13/metadata.json new file mode 100644 index 0000000..f289c61 --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/13/metadata.json @@ -0,0 +1,4 @@ +{ + "description": "Does not generate f540 for random rights note", + "only": false +} \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate5xx/generate540/13/output.json b/test-fixtures/transform/convert/common/generate5xx/generate540/13/output.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/test-fixtures/transform/convert/common/generate5xx/generate540/13/output.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate8xx/generate856/01/input.json b/test-fixtures/transform/convert/common/generate8xx/generate856/01/input.json index a382b52..8dc1aae 100644 --- a/test-fixtures/transform/convert/common/generate8xx/generate856/01/input.json +++ b/test-fixtures/transform/convert/common/generate8xx/generate856/01/input.json @@ -28,7 +28,7 @@ "schema": "dc", "element": "identifier", "qualifier": "url", - "value": "http://foobar.example.com/handle/123/456?url=true" + "value": "http://foobar.example.com/handle/456/789?url=true" } }, { diff --git a/test-fixtures/transform/convert/common/generate8xx/generate856/01/metadata.json b/test-fixtures/transform/convert/common/generate8xx/generate856/01/metadata.json index a3d1da9..3d0a7b2 100644 --- a/test-fixtures/transform/convert/common/generate8xx/generate856/01/metadata.json +++ b/test-fixtures/transform/convert/common/generate8xx/generate856/01/metadata.json @@ -1,4 +1,4 @@ { - "description": "Generates f856 public access fields from doi, uri and url when dc.rights.accesslevel includes value of 'openAccess' and other access fields from dc.relation.urn", + "description": "Generates f856 public access fields from doi and uri but not from url when dc.rights.accesslevel includes value of 'openAccess'. Also generates other access fields from dc.relation.urn using mapper", "only": false } \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate8xx/generate856/01/output.json b/test-fixtures/transform/convert/common/generate8xx/generate856/01/output.json index bbd244e..5cd4d6b 100644 --- a/test-fixtures/transform/convert/common/generate8xx/generate856/01/output.json +++ b/test-fixtures/transform/convert/common/generate8xx/generate856/01/output.json @@ -4,14 +4,13 @@ "subfields": [ {"code": "u", "value": "https://doi.org/12.3456/example"}, {"code": "u", "value": "http://foobar.example.com/handle/123/456?uri=true"}, - {"code": "u", "value": "http://foobar.example.com/handle/123/456?url=true"}, {"code": "y", "value": "Linkki verkkoaineistoon"} ] }, { "tag": "856", "ind1": "4", "ind2": "2", "subfields": [ - {"code": "u", "value": "URN:ISBN:978-92-95055-20-9"} + {"code": "u", "value": "http://urn.fi/URN:ISBN:978-92-95055-20-9"} ] } ] \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate8xx/generate856/03/input.json b/test-fixtures/transform/convert/common/generate8xx/generate856/03/input.json index c54af94..cb61b20 100644 --- a/test-fixtures/transform/convert/common/generate8xx/generate856/03/input.json +++ b/test-fixtures/transform/convert/common/generate8xx/generate856/03/input.json @@ -19,7 +19,7 @@ "$": { "schema": "dc", "element": "identifier", - "qualifier": "url", + "qualifier": "doi", "value": "http://foobar.example.com/handle/123/456?url=true" } }, diff --git a/test-fixtures/transform/convert/common/generate8xx/generate856/03/metadata.json b/test-fixtures/transform/convert/common/generate8xx/generate856/03/metadata.json index 19d5eba..a0cdd62 100644 --- a/test-fixtures/transform/convert/common/generate8xx/generate856/03/metadata.json +++ b/test-fixtures/transform/convert/common/generate8xx/generate856/03/metadata.json @@ -1,4 +1,4 @@ { - "description": "Http link generated from dc.identifier.urn is preferred over information in dc.identifier.uri or dc.identifier.url", + "description": "Http link generated from dc.identifier.urn is preferred over information in dc.identifier.uri or dc.identifier.doi", "only": false } \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate8xx/generate856/04/input.json b/test-fixtures/transform/convert/common/generate8xx/generate856/04/input.json new file mode 100644 index 0000000..def58d6 --- /dev/null +++ b/test-fixtures/transform/convert/common/generate8xx/generate856/04/input.json @@ -0,0 +1,18 @@ +[ + { + "$": { + "schema": "dc", + "element": "rights", + "qualifier": "accesslevel", + "value": "openAccess" + } + }, + { + "$": { + "schema": "dc", + "element": "identifier", + "qualifier": "urn", + "value": "http://urn.fi/URN:ISBN:978-92-95055-20-9" + } + } +] \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate8xx/generate856/04/metadata.json b/test-fixtures/transform/convert/common/generate8xx/generate856/04/metadata.json new file mode 100644 index 0000000..c1f9e03 --- /dev/null +++ b/test-fixtures/transform/convert/common/generate8xx/generate856/04/metadata.json @@ -0,0 +1,4 @@ +{ + "description": "Http link generation identifies HTTP url from dc.identifier.urn correctly", + "only": false +} \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate8xx/generate856/04/output.json b/test-fixtures/transform/convert/common/generate8xx/generate856/04/output.json new file mode 100644 index 0000000..8b09066 --- /dev/null +++ b/test-fixtures/transform/convert/common/generate8xx/generate856/04/output.json @@ -0,0 +1,9 @@ +[ + { + "tag": "856", "ind1": "4", "ind2": "0", + "subfields": [ + {"code": "u", "value": "http://urn.fi/URN:ISBN:978-92-95055-20-9"}, + {"code": "y", "value": "Linkki verkkoaineistoon"} + ] + } +] \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate8xx/generate856/05/input.json b/test-fixtures/transform/convert/common/generate8xx/generate856/05/input.json new file mode 100644 index 0000000..5215d47 --- /dev/null +++ b/test-fixtures/transform/convert/common/generate8xx/generate856/05/input.json @@ -0,0 +1,18 @@ +[ + { + "$": { + "schema": "dc", + "element": "rights", + "qualifier": "accesslevel", + "value": "openAccess" + } + }, + { + "$": { + "schema": "dc", + "element": "identifier", + "qualifier": "urn", + "value": "https://urn.fi/URN:ISBN:978-92-95055-20-9" + } + } +] \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate8xx/generate856/05/metadata.json b/test-fixtures/transform/convert/common/generate8xx/generate856/05/metadata.json new file mode 100644 index 0000000..2533880 --- /dev/null +++ b/test-fixtures/transform/convert/common/generate8xx/generate856/05/metadata.json @@ -0,0 +1,4 @@ +{ + "description": "Http link generation identifies HTTPS url from dc.identifier.urn correctly", + "only": false +} \ No newline at end of file diff --git a/test-fixtures/transform/convert/common/generate8xx/generate856/05/output.json b/test-fixtures/transform/convert/common/generate8xx/generate856/05/output.json new file mode 100644 index 0000000..beb56f2 --- /dev/null +++ b/test-fixtures/transform/convert/common/generate8xx/generate856/05/output.json @@ -0,0 +1,9 @@ +[ + { + "tag": "856", "ind1": "4", "ind2": "0", + "subfields": [ + {"code": "u", "value": "https://urn.fi/URN:ISBN:978-92-95055-20-9"}, + {"code": "y", "value": "Linkki verkkoaineistoon"} + ] + } +] \ No newline at end of file