From b3e463581a5c388877556e2f5476ed2c8018c3b9 Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Thu, 1 Aug 2024 13:57:00 -0400 Subject: [PATCH 1/6] Remap oai_dc fields dc:type, dc:date, and dc:rights #8129. The `oai_dc` export and harvesting format has had the following fields remapped: - dc:type was mapped to the field "Kind of Data". Now it is hard-coded to the word "Dataset". - dc:date was mapped to the field "Production Date" when available and otherwise to "Publication Date". Now it is mapped only to the field "Publication Date". - dc:rights was not mapped to anything. Now it is mapped (when available) to terms of use, restrictions, and license. --- doc/release-notes/8129-harvesting.md | 11 +++++ doc/sphinx-guides/source/api/changelog.rst | 9 ++++ .../dublincore/DublinCoreExportUtil.java | 46 ++++++++++++++++--- 3 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 doc/release-notes/8129-harvesting.md diff --git a/doc/release-notes/8129-harvesting.md b/doc/release-notes/8129-harvesting.md new file mode 100644 index 00000000000..05e2e7f455c --- /dev/null +++ b/doc/release-notes/8129-harvesting.md @@ -0,0 +1,11 @@ +### Remap oai_dc export and harvesting format fields: dc:type, dc:date, and dc:rights + +The `oai_dc` export and harvesting format has had the following fields remapped: + +- dc:type was mapped to the field "Kind of Data". Now it is hard-coded to the word "Dataset". +- dc:date was mapped to the field "Production Date" when available and otherwise to "Publication Date". Now it is mapped only to the field "Publication Date". +- dc:rights was not mapped to anything. Now it is mapped (when available) to terms of use, restrictions, and license. + +As these are backward incompatible changes, they have been noted in the [API changelog](https://guides.dataverse.org/en/latest/api/changelog.html). + +For more information, please see issue #8129. diff --git a/doc/sphinx-guides/source/api/changelog.rst b/doc/sphinx-guides/source/api/changelog.rst index a7af3e84b28..680057a7807 100644 --- a/doc/sphinx-guides/source/api/changelog.rst +++ b/doc/sphinx-guides/source/api/changelog.rst @@ -7,6 +7,15 @@ This API changelog is experimental and we would love feedback on its usefulness. :local: :depth: 1 +v6.4 +---- + +- For the ``oai_dc`` metadata export and harvesting (OAI-PMH) format: + + - dc:type was mapped to the field "Kind of Data". Now it is hard-coded to the word "Dataset". + - dc:date was mapped to the field "Production Date" when available and otherwise to "Publication Date". Now it is mapped only to the field "Publication Date". + - dc:rights was not mapped to anything. Now it is mapped (when available) to terms of use, restrictions, and license. + v6.3 ---- diff --git a/src/main/java/edu/harvard/iq/dataverse/export/dublincore/DublinCoreExportUtil.java b/src/main/java/edu/harvard/iq/dataverse/export/dublincore/DublinCoreExportUtil.java index 6b7cb844f3e..0766466c699 100644 --- a/src/main/java/edu/harvard/iq/dataverse/export/dublincore/DublinCoreExportUtil.java +++ b/src/main/java/edu/harvard/iq/dataverse/export/dublincore/DublinCoreExportUtil.java @@ -176,11 +176,16 @@ private static void createOAIDC(XMLStreamWriter xmlw, DatasetDTO datasetDto, Str writeFullElementList(xmlw, dcFlavor+":"+"language", dto2PrimitiveList(version, DatasetFieldConstant.language)); - String date = dto2Primitive(version, DatasetFieldConstant.productionDate); - if (date == null) { - date = datasetDto.getPublicationDate(); - } - writeFullElement(xmlw, dcFlavor+":"+"date", date); + /** + * dc:date. "I suggest changing the Dataverse / DC Element (oai_dc) + * mapping, so that dc:date is mapped with Publication Date. This is + * also in line with citation recommendations. The publication date is + * the preferred date when citing research data; see, e.g., page 12 in + * The Tromsø Recommendations for Citation of Research Data in + * Linguistics; https://doi.org/10.15497/rda00040 ." -- + * https://github.com/IQSS/dataverse/issues/8129 + */ + writeFullElement(xmlw, dcFlavor+":"+"date", datasetDto.getPublicationDate()); writeFullElement(xmlw, dcFlavor+":"+"contributor", dto2Primitive(version, DatasetFieldConstant.depositor)); @@ -188,9 +193,38 @@ private static void createOAIDC(XMLStreamWriter xmlw, DatasetDTO datasetDto, Str writeFullElementList(xmlw, dcFlavor+":"+"relation", dto2PrimitiveList(version, DatasetFieldConstant.relatedDatasets)); - writeFullElementList(xmlw, dcFlavor+":"+"type", dto2PrimitiveList(version, DatasetFieldConstant.kindOfData)); + /** + * dc:type. "Dublin Core (see + * https://www.dublincore.org/specifications/dublin-core/dcmi-terms/#http://purl.org/dc/terms/type + * ) recommends “to use a controlled vocabulary such as the DCMI Type + * Vocabulary” for dc:type." So we hard-coded it to "Dataset". See + * https://github.com/IQSS/dataverse/issues/8129 + */ + writeFullElement(xmlw, dcFlavor+":"+"type", "Dataset"); writeFullElementList(xmlw, dcFlavor+":"+"source", dto2PrimitiveList(version, DatasetFieldConstant.dataSources)); + + /** + * dc:rights. As stated in https://github.com/IQSS/dataverse/issues/8129 + * "A correct value in this field would enable BASE to indicate the + * degree of Open Access (see more information at + * https://www.base-search.net/about/en/faq_oai.php#dc-rights ). For + * datasets without access restriction, the dc:rights field could look + * like this: info:eu-repo/semantics/openAccess (see more information at + * https://guidelines.openaire.eu/en/latest/data/field_rights.html#rightsuri-ma) + * ." + * + * Instead of a single instance of dc:rights, we are including multiple. + * We borrow logic from the `createDC` (dcterms) method but we are using + * only dc:rights rather than also using dc:license because dc:license + * is not one of the 15 fields defined by Simple Dublin Core. + */ + LicenseDTO licDTO = version.getLicense(); + if(licDTO != null) { + writeFullElement(xmlw, dcFlavor+":"+"rights", licDTO.getName()); + } + writeFullElement(xmlw, dcFlavor+":"+"rights", version.getTermsOfUse()); + writeFullElement(xmlw, dcFlavor+":"+"rights", version.getRestrictions()); } From c59f743a87d55f0586b9528e21ba9c5edc0c5243 Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Fri, 2 Aug 2024 14:23:23 -0400 Subject: [PATCH 2/6] add tests for export and citation date #8129 --- .../harvard/iq/dataverse/api/DatasetsIT.java | 73 +++++++++++++++++-- .../edu/harvard/iq/dataverse/api/UtilIT.java | 14 ++++ 2 files changed, 82 insertions(+), 5 deletions(-) diff --git a/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java b/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java index cb9481d3491..be6ff01b28c 100644 --- a/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java +++ b/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java @@ -546,8 +546,7 @@ public void testCreatePublishDestroyDataset() { Response exportDatasetAsDublinCore = UtilIT.exportDataset(datasetPersistentId, "oai_dc", apiToken); exportDatasetAsDublinCore.prettyPrint(); exportDatasetAsDublinCore.then().assertThat() - // FIXME: Get this working. See https://github.com/rest-assured/rest-assured/wiki/Usage#example-3---complex-parsing-and-validation - // .body("oai_dc:dc.find { it == 'dc:title' }.item", hasItems("Darwin's Finches")) + .body("oai_dc.title", is("Darwin's Finches")) .statusCode(OK.getStatusCode()); Response exportDatasetAsDdi = UtilIT.exportDataset(datasetPersistentId, "ddi", apiToken); @@ -1111,8 +1110,7 @@ public void testExport() { Response exportDatasetAsDublinCore = UtilIT.exportDataset(datasetPersistentId, "oai_dc", apiToken); exportDatasetAsDublinCore.prettyPrint(); exportDatasetAsDublinCore.then().assertThat() - // FIXME: Get this working. See https://github.com/rest-assured/rest-assured/wiki/Usage#example-3---complex-parsing-and-validation - // .body("oai_dc:dc.find { it == 'dc:title' }.item", hasItems("Darwin's Finches")) + .body("oai_dc.title", is("Dataset One")) .statusCode(OK.getStatusCode()); Response exportDatasetAsDdi = UtilIT.exportDataset(datasetPersistentId, "ddi", apiToken); @@ -3955,7 +3953,72 @@ public void getDatasetVersionCitation() { .assertThat().body("data.message", containsString(String.valueOf(persistentId))); } - + @Test + public void testCitationDate() throws IOException { + + Response createUser = UtilIT.createRandomUser(); + createUser.then().assertThat().statusCode(OK.getStatusCode()); + String username = UtilIT.getUsernameFromResponse(createUser); + String apiToken = UtilIT.getApiTokenFromResponse(createUser); + + Response createDataverse = UtilIT.createRandomDataverse(apiToken); + createDataverse.then().assertThat().statusCode(CREATED.getStatusCode()); + String dataverseAlias = UtilIT.getAliasFromResponse(createDataverse); + Integer dataverseId = UtilIT.getDataverseIdFromResponse(createDataverse); + Response createDataset = UtilIT.createRandomDatasetViaNativeApi(dataverseAlias, apiToken); + createDataset.then().assertThat().statusCode(CREATED.getStatusCode()); + Integer datasetId = UtilIT.getDatasetIdFromResponse(createDataset); + String datasetPid = JsonPath.from(createDataset.getBody().asString()).getString("data.persistentId"); + + Path pathToAddDateOfDepositJson = Paths.get(java.nio.file.Files.createTempDirectory(null) + File.separator + "dateOfDeposit.json"); + String dateOfDeposit = """ +{ + "fields": [ + { + "typeName": "dateOfDeposit", + "value": "1999-12-31" + } + ] +} +"""; + java.nio.file.Files.write(pathToAddDateOfDepositJson, dateOfDeposit.getBytes()); + + Response addDateOfDeposit = UtilIT.addDatasetMetadataViaNative(datasetPid, pathToAddDateOfDepositJson.toString(), apiToken); + addDateOfDeposit.prettyPrint(); + addDateOfDeposit.then().assertThat() + .statusCode(OK.getStatusCode()) + .body("data.metadataBlocks.citation.fields[5].value", equalTo("1999-12-31")); + + Response setCitationDate = UtilIT.setDatasetCitationDateField(datasetPid, "dateOfDeposit", apiToken); + setCitationDate.prettyPrint(); + setCitationDate.then().assertThat().statusCode(OK.getStatusCode()); + + UtilIT.publishDataverseViaNativeApi(dataverseAlias, apiToken); + UtilIT.publishDatasetViaNativeApi(datasetId, "major", apiToken).then().assertThat().statusCode(OK.getStatusCode()); + + Response getCitationAfter = UtilIT.getDatasetVersionCitation(datasetId, DS_VERSION_LATEST_PUBLISHED, true, apiToken); + getCitationAfter.prettyPrint(); + + String doi = datasetPid.substring(4); + + // Note that the year 1999 appears in the citation because we + // set the citation date field to a field that has that year. + String expectedCitation = "Finch, Fiona, 1999, \"Darwin's Finches\", https://doi.org/" + doi + ", Root, V1"; + + getCitationAfter.then().assertThat() + .statusCode(OK.getStatusCode()) + .body("data.message", is(expectedCitation)); + + Response exportDatasetAsDublinCore = UtilIT.exportDataset(datasetPid, "oai_dc", apiToken); + exportDatasetAsDublinCore.prettyPrint(); + String todayDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); + exportDatasetAsDublinCore.then().assertThat() + .body("oai_dc.type", equalTo("Dataset")) + .body("oai_dc.date", equalTo(todayDate)) + .body("oai_dc.rights", equalTo("CC0 1.0")) + .statusCode(OK.getStatusCode()); + } + @Test public void getVersionFiles() throws IOException, InterruptedException { Response createUser = UtilIT.createRandomUser(); diff --git a/src/test/java/edu/harvard/iq/dataverse/api/UtilIT.java b/src/test/java/edu/harvard/iq/dataverse/api/UtilIT.java index 917154c80cc..960b520ded5 100644 --- a/src/test/java/edu/harvard/iq/dataverse/api/UtilIT.java +++ b/src/test/java/edu/harvard/iq/dataverse/api/UtilIT.java @@ -3672,6 +3672,20 @@ static Response getDatasetVersionCitation(Integer datasetId, String version, boo return response; } + static Response setDatasetCitationDateField(String datasetIdOrPersistentId, String dateField, String apiToken) { + String idInPath = datasetIdOrPersistentId; // Assume it's a number. + String optionalQueryParam = ""; // If idOrPersistentId is a number we'll just put it in the path. + if (!NumberUtils.isCreatable(datasetIdOrPersistentId)) { + idInPath = ":persistentId"; + optionalQueryParam = "?persistentId=" + datasetIdOrPersistentId; + } + Response response = given() + .header(API_TOKEN_HTTP_HEADER, apiToken) + .body(dateField) + .put("/api/datasets/" + idInPath + "/citationdate" + optionalQueryParam); + return response; + } + static Response getFileCitation(Integer fileId, String datasetVersion, String apiToken) { Boolean includeDeaccessioned = null; return getFileCitation(fileId, datasetVersion, includeDeaccessioned, apiToken); From a9f7d79f96414cb4f0e35ad15a94a870195e537d Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Mon, 5 Aug 2024 11:51:30 -0400 Subject: [PATCH 3/6] map dc:date to pub date or field for citation date #8129 --- doc/release-notes/8129-harvesting.md | 2 +- doc/sphinx-guides/source/api/changelog.rst | 2 +- doc/sphinx-guides/source/api/native-api.rst | 2 ++ .../dublincore/DublinCoreExportUtil.java | 12 +++++++++++- .../harvard/iq/dataverse/api/DatasetsIT.java | 19 ++++++++++++++++++- .../edu/harvard/iq/dataverse/api/UtilIT.java | 13 +++++++++++++ 6 files changed, 46 insertions(+), 4 deletions(-) diff --git a/doc/release-notes/8129-harvesting.md b/doc/release-notes/8129-harvesting.md index 05e2e7f455c..92d705709fc 100644 --- a/doc/release-notes/8129-harvesting.md +++ b/doc/release-notes/8129-harvesting.md @@ -3,7 +3,7 @@ The `oai_dc` export and harvesting format has had the following fields remapped: - dc:type was mapped to the field "Kind of Data". Now it is hard-coded to the word "Dataset". -- dc:date was mapped to the field "Production Date" when available and otherwise to "Publication Date". Now it is mapped only to the field "Publication Date". +- dc:date was mapped to the field "Production Date" when available and otherwise to "Publication Date". Now it is mapped the field “Publication Date” or the field used for the citation date, if set (see [Set Citation Date Field Type for a Dataset](https://guides.dataverse.org/en/6.3/api/native-api.html#set-citation-date-field-type-for-a-dataset)). - dc:rights was not mapped to anything. Now it is mapped (when available) to terms of use, restrictions, and license. As these are backward incompatible changes, they have been noted in the [API changelog](https://guides.dataverse.org/en/latest/api/changelog.html). diff --git a/doc/sphinx-guides/source/api/changelog.rst b/doc/sphinx-guides/source/api/changelog.rst index 680057a7807..071b14f3ca3 100644 --- a/doc/sphinx-guides/source/api/changelog.rst +++ b/doc/sphinx-guides/source/api/changelog.rst @@ -13,7 +13,7 @@ v6.4 - For the ``oai_dc`` metadata export and harvesting (OAI-PMH) format: - dc:type was mapped to the field "Kind of Data". Now it is hard-coded to the word "Dataset". - - dc:date was mapped to the field "Production Date" when available and otherwise to "Publication Date". Now it is mapped only to the field "Publication Date". + - dc:date was mapped to the field "Production Date" when available and otherwise to "Publication Date". Now it is mapped the field "Publication Date" or the field used for the citation date, if set (see :ref:`set-citation-date-field`). - dc:rights was not mapped to anything. Now it is mapped (when available) to terms of use, restrictions, and license. v6.3 diff --git a/doc/sphinx-guides/source/api/native-api.rst b/doc/sphinx-guides/source/api/native-api.rst index a5f7d03899a..92310187885 100644 --- a/doc/sphinx-guides/source/api/native-api.rst +++ b/doc/sphinx-guides/source/api/native-api.rst @@ -1756,6 +1756,8 @@ The fully expanded example above (without environment variables) looks like this .. note:: You cannot deaccession a dataset more than once. If you call this endpoint twice for the same dataset version, you will get a not found error on the second call, since the dataset you are looking for will no longer be published since it is already deaccessioned. +.. _set-citation-date-field: + Set Citation Date Field Type for a Dataset ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/main/java/edu/harvard/iq/dataverse/export/dublincore/DublinCoreExportUtil.java b/src/main/java/edu/harvard/iq/dataverse/export/dublincore/DublinCoreExportUtil.java index 0766466c699..b9992d08c91 100644 --- a/src/main/java/edu/harvard/iq/dataverse/export/dublincore/DublinCoreExportUtil.java +++ b/src/main/java/edu/harvard/iq/dataverse/export/dublincore/DublinCoreExportUtil.java @@ -7,6 +7,8 @@ import com.google.gson.Gson; import edu.harvard.iq.dataverse.DatasetFieldConstant; +import edu.harvard.iq.dataverse.DatasetFieldType; +import edu.harvard.iq.dataverse.DatasetServiceBean; import edu.harvard.iq.dataverse.GlobalId; import edu.harvard.iq.dataverse.api.dto.DatasetDTO; import edu.harvard.iq.dataverse.api.dto.DatasetVersionDTO; @@ -184,8 +186,16 @@ private static void createOAIDC(XMLStreamWriter xmlw, DatasetDTO datasetDto, Str * The Tromsø Recommendations for Citation of Research Data in * Linguistics; https://doi.org/10.15497/rda00040 ." -- * https://github.com/IQSS/dataverse/issues/8129 + * + * However, if the citation date field has been set, use that. */ - writeFullElement(xmlw, dcFlavor+":"+"date", datasetDto.getPublicationDate()); + String date = datasetDto.getPublicationDate(); + DatasetFieldType citationDataType = jakarta.enterprise.inject.spi.CDI.current().select(DatasetServiceBean.class).get().findByGlobalId(globalId.asString()).getCitationDateDatasetFieldType(); + if (citationDataType != null) { + date = dto2Primitive(version, citationDataType.getName()); + } + + writeFullElement(xmlw, dcFlavor+":"+"date", date); writeFullElement(xmlw, dcFlavor+":"+"contributor", dto2Primitive(version, DatasetFieldConstant.depositor)); diff --git a/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java b/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java index be6ff01b28c..180410ede97 100644 --- a/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java +++ b/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java @@ -4011,8 +4011,25 @@ public void testCitationDate() throws IOException { Response exportDatasetAsDublinCore = UtilIT.exportDataset(datasetPid, "oai_dc", apiToken); exportDatasetAsDublinCore.prettyPrint(); - String todayDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); exportDatasetAsDublinCore.then().assertThat() + .body("oai_dc.type", equalTo("Dataset")) + .body("oai_dc.date", equalTo("1999-12-31")) + .body("oai_dc.rights", equalTo("CC0 1.0")) + .statusCode(OK.getStatusCode()); + + Response clearDateField = UtilIT.clearDatasetCitationDateField(datasetPid, apiToken); + clearDateField.prettyPrint(); + clearDateField.then().assertThat().statusCode(OK.getStatusCode()); + + // Clearing not enough. You have to reexport because the previous date is cached. + Response rexport = UtilIT.reexportDatasetAllFormats(datasetPid); + rexport.prettyPrint(); + rexport.then().assertThat().statusCode(OK.getStatusCode()); + + String todayDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); + Response exportPostClear = UtilIT.exportDataset(datasetPid, "oai_dc", apiToken); + exportPostClear.prettyPrint(); + exportPostClear.then().assertThat() .body("oai_dc.type", equalTo("Dataset")) .body("oai_dc.date", equalTo(todayDate)) .body("oai_dc.rights", equalTo("CC0 1.0")) diff --git a/src/test/java/edu/harvard/iq/dataverse/api/UtilIT.java b/src/test/java/edu/harvard/iq/dataverse/api/UtilIT.java index 960b520ded5..655b5cbae60 100644 --- a/src/test/java/edu/harvard/iq/dataverse/api/UtilIT.java +++ b/src/test/java/edu/harvard/iq/dataverse/api/UtilIT.java @@ -3686,6 +3686,19 @@ static Response setDatasetCitationDateField(String datasetIdOrPersistentId, Stri return response; } + static Response clearDatasetCitationDateField(String datasetIdOrPersistentId, String apiToken) { + String idInPath = datasetIdOrPersistentId; // Assume it's a number. + String optionalQueryParam = ""; // If idOrPersistentId is a number we'll just put it in the path. + if (!NumberUtils.isCreatable(datasetIdOrPersistentId)) { + idInPath = ":persistentId"; + optionalQueryParam = "?persistentId=" + datasetIdOrPersistentId; + } + Response response = given() + .header(API_TOKEN_HTTP_HEADER, apiToken) + .delete("/api/datasets/" + idInPath + "/citationdate" + optionalQueryParam); + return response; + } + static Response getFileCitation(Integer fileId, String datasetVersion, String apiToken) { Boolean includeDeaccessioned = null; return getFileCitation(fileId, datasetVersion, includeDeaccessioned, apiToken); From 1968b87514cb46b97e78aaa4308f0d535288a2ac Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Mon, 9 Sep 2024 16:28:46 -0400 Subject: [PATCH 4/6] back out of any changes to dc:rights #8129 --- doc/release-notes/8129-harvesting.md | 3 +-- doc/sphinx-guides/source/api/changelog.rst | 1 - .../dublincore/DublinCoreExportUtil.java | 23 ------------------- .../harvard/iq/dataverse/api/DatasetsIT.java | 2 -- 4 files changed, 1 insertion(+), 28 deletions(-) diff --git a/doc/release-notes/8129-harvesting.md b/doc/release-notes/8129-harvesting.md index 92d705709fc..bc5b681b3b2 100644 --- a/doc/release-notes/8129-harvesting.md +++ b/doc/release-notes/8129-harvesting.md @@ -1,10 +1,9 @@ -### Remap oai_dc export and harvesting format fields: dc:type, dc:date, and dc:rights +### Remap oai_dc export and harvesting format fields: dc:type and dc:date The `oai_dc` export and harvesting format has had the following fields remapped: - dc:type was mapped to the field "Kind of Data". Now it is hard-coded to the word "Dataset". - dc:date was mapped to the field "Production Date" when available and otherwise to "Publication Date". Now it is mapped the field “Publication Date” or the field used for the citation date, if set (see [Set Citation Date Field Type for a Dataset](https://guides.dataverse.org/en/6.3/api/native-api.html#set-citation-date-field-type-for-a-dataset)). -- dc:rights was not mapped to anything. Now it is mapped (when available) to terms of use, restrictions, and license. As these are backward incompatible changes, they have been noted in the [API changelog](https://guides.dataverse.org/en/latest/api/changelog.html). diff --git a/doc/sphinx-guides/source/api/changelog.rst b/doc/sphinx-guides/source/api/changelog.rst index 071b14f3ca3..9ce0f940494 100644 --- a/doc/sphinx-guides/source/api/changelog.rst +++ b/doc/sphinx-guides/source/api/changelog.rst @@ -14,7 +14,6 @@ v6.4 - dc:type was mapped to the field "Kind of Data". Now it is hard-coded to the word "Dataset". - dc:date was mapped to the field "Production Date" when available and otherwise to "Publication Date". Now it is mapped the field "Publication Date" or the field used for the citation date, if set (see :ref:`set-citation-date-field`). - - dc:rights was not mapped to anything. Now it is mapped (when available) to terms of use, restrictions, and license. v6.3 ---- diff --git a/src/main/java/edu/harvard/iq/dataverse/export/dublincore/DublinCoreExportUtil.java b/src/main/java/edu/harvard/iq/dataverse/export/dublincore/DublinCoreExportUtil.java index b9992d08c91..9a2c3085d2d 100644 --- a/src/main/java/edu/harvard/iq/dataverse/export/dublincore/DublinCoreExportUtil.java +++ b/src/main/java/edu/harvard/iq/dataverse/export/dublincore/DublinCoreExportUtil.java @@ -214,29 +214,6 @@ private static void createOAIDC(XMLStreamWriter xmlw, DatasetDTO datasetDto, Str writeFullElementList(xmlw, dcFlavor+":"+"source", dto2PrimitiveList(version, DatasetFieldConstant.dataSources)); - /** - * dc:rights. As stated in https://github.com/IQSS/dataverse/issues/8129 - * "A correct value in this field would enable BASE to indicate the - * degree of Open Access (see more information at - * https://www.base-search.net/about/en/faq_oai.php#dc-rights ). For - * datasets without access restriction, the dc:rights field could look - * like this: info:eu-repo/semantics/openAccess (see more information at - * https://guidelines.openaire.eu/en/latest/data/field_rights.html#rightsuri-ma) - * ." - * - * Instead of a single instance of dc:rights, we are including multiple. - * We borrow logic from the `createDC` (dcterms) method but we are using - * only dc:rights rather than also using dc:license because dc:license - * is not one of the 15 fields defined by Simple Dublin Core. - */ - LicenseDTO licDTO = version.getLicense(); - if(licDTO != null) { - writeFullElement(xmlw, dcFlavor+":"+"rights", licDTO.getName()); - } - writeFullElement(xmlw, dcFlavor+":"+"rights", version.getTermsOfUse()); - writeFullElement(xmlw, dcFlavor+":"+"rights", version.getRestrictions()); - - } private static void writeAuthorsElement(XMLStreamWriter xmlw, DatasetVersionDTO datasetVersionDTO, String dcFlavor) throws XMLStreamException { diff --git a/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java b/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java index 0a5734aa1bf..f52aa4fe9bd 100644 --- a/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java +++ b/src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java @@ -4162,7 +4162,6 @@ public void testCitationDate() throws IOException { exportDatasetAsDublinCore.then().assertThat() .body("oai_dc.type", equalTo("Dataset")) .body("oai_dc.date", equalTo("1999-12-31")) - .body("oai_dc.rights", equalTo("CC0 1.0")) .statusCode(OK.getStatusCode()); Response clearDateField = UtilIT.clearDatasetCitationDateField(datasetPid, apiToken); @@ -4180,7 +4179,6 @@ public void testCitationDate() throws IOException { exportPostClear.then().assertThat() .body("oai_dc.type", equalTo("Dataset")) .body("oai_dc.date", equalTo(todayDate)) - .body("oai_dc.rights", equalTo("CC0 1.0")) .statusCode(OK.getStatusCode()); } From c4e3097d87e7b776443ee78788ca909270eb86e9 Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Mon, 9 Sep 2024 16:31:03 -0400 Subject: [PATCH 5/6] remove OAI-PMH changes from API changelog (also in release note) #8129 --- doc/sphinx-guides/source/api/changelog.rst | 8 -------- 1 file changed, 8 deletions(-) diff --git a/doc/sphinx-guides/source/api/changelog.rst b/doc/sphinx-guides/source/api/changelog.rst index 9ce0f940494..a7af3e84b28 100644 --- a/doc/sphinx-guides/source/api/changelog.rst +++ b/doc/sphinx-guides/source/api/changelog.rst @@ -7,14 +7,6 @@ This API changelog is experimental and we would love feedback on its usefulness. :local: :depth: 1 -v6.4 ----- - -- For the ``oai_dc`` metadata export and harvesting (OAI-PMH) format: - - - dc:type was mapped to the field "Kind of Data". Now it is hard-coded to the word "Dataset". - - dc:date was mapped to the field "Production Date" when available and otherwise to "Publication Date". Now it is mapped the field "Publication Date" or the field used for the citation date, if set (see :ref:`set-citation-date-field`). - v6.3 ---- From 2805eb5ed6a39795fbb9cbd2f03dbd43e32a14f9 Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Mon, 9 Sep 2024 16:39:01 -0400 Subject: [PATCH 6/6] tweak release note, mention backward incompatibility, reexport #8129 --- doc/release-notes/8129-harvesting.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/doc/release-notes/8129-harvesting.md b/doc/release-notes/8129-harvesting.md index bc5b681b3b2..63ca8744941 100644 --- a/doc/release-notes/8129-harvesting.md +++ b/doc/release-notes/8129-harvesting.md @@ -3,8 +3,16 @@ The `oai_dc` export and harvesting format has had the following fields remapped: - dc:type was mapped to the field "Kind of Data". Now it is hard-coded to the word "Dataset". -- dc:date was mapped to the field "Production Date" when available and otherwise to "Publication Date". Now it is mapped the field “Publication Date” or the field used for the citation date, if set (see [Set Citation Date Field Type for a Dataset](https://guides.dataverse.org/en/6.3/api/native-api.html#set-citation-date-field-type-for-a-dataset)). +- dc:date was mapped to the field "Production Date" when available and otherwise to "Publication Date". Now it is mapped the field "Publication Date" or the field used for the citation date, if set (see [Set Citation Date Field Type for a Dataset](https://guides.dataverse.org/en/6.3/api/native-api.html#set-citation-date-field-type-for-a-dataset)). -As these are backward incompatible changes, they have been noted in the [API changelog](https://guides.dataverse.org/en/latest/api/changelog.html). +In order for these changes to be reflected in existing datasets, a [reexport all](https://guides.dataverse.org/en/6.3/admin/metadataexport.html#batch-exports-through-the-api) should be run. -For more information, please see issue #8129. +For more information, please see #8129 and #10737. + +### Backward incompatible changes + +See the "Remap oai_dc export" section above. + +### Upgrade instructions + +In order for changes to the `oai_dc` metadata export format to be reflected in existing datasets, a [reexport all](https://guides.dataverse.org/en/6.3/admin/metadataexport.html#batch-exports-through-the-api) should be run.