From a66d68ff5ab042301de114c7413c18e5805f4a43 Mon Sep 17 00:00:00 2001 From: Juan Pablo Tosca Villanueva Date: Fri, 15 Mar 2024 16:47:27 -0400 Subject: [PATCH 1/5] Add dataverse support for croissant exporter --- docker-compose-dev.yml | 1 + .../java/edu/harvard/iq/dataverse/DatasetPage.java | 13 +++++++++++++ src/main/webapp/dataset.xhtml | 9 ++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index ae0aa2bdf76..6c56b5a3d6e 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -21,6 +21,7 @@ services: DATAVERSE_AUTH_OIDC_CLIENT_ID: test DATAVERSE_AUTH_OIDC_CLIENT_SECRET: 94XHrfNRwXsjqTqApRrwWmhDLDHpIYV8 DATAVERSE_AUTH_OIDC_AUTH_SERVER_URL: http://keycloak.mydomain.com:8090/realms/test + DATAVERSE_SPI_EXPORTERS_DIRECTORY: "/dv/exporters" # These two oai settings are here to get HarvestingServerIT to pass dataverse_oai_server_maxidentifiers: "2" dataverse_oai_server_maxrecords: "2" diff --git a/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java b/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java index 05325a26f3a..400075cd899 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java +++ b/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java @@ -5809,6 +5809,19 @@ public boolean isThisLatestReleasedVersion() { } + public String getCroissant() { + if (isThisLatestReleasedVersion()) { + final String CROISSANT_SCHEMA_NAME = "croissant"; + ExportService instance = ExportService.getInstance(); + String croissant = instance.getExportAsString(dataset, CROISSANT_SCHEMA_NAME); + if (croissant != null) { + logger.fine("Returning cached CROISSANT."); + return croissant; + } + } + return ""; + } + public String getJsonLd() { if (isThisLatestReleasedVersion()) { ExportService instance = ExportService.getInstance(); diff --git a/src/main/webapp/dataset.xhtml b/src/main/webapp/dataset.xhtml index 34c6d3dcbea..7b5db98b9dd 100644 --- a/src/main/webapp/dataset.xhtml +++ b/src/main/webapp/dataset.xhtml @@ -70,7 +70,14 @@ From 4a45caebfda51b8e445fd3b1936aeea05d54bd81 Mon Sep 17 00:00:00 2001 From: Juan Pablo Tosca Villanueva Date: Mon, 18 Mar 2024 15:53:24 -0400 Subject: [PATCH 2/5] Change to return null --- src/main/java/edu/harvard/iq/dataverse/DatasetPage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java b/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java index 400075cd899..fdb563e857b 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java +++ b/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java @@ -5819,7 +5819,7 @@ public String getCroissant() { return croissant; } } - return ""; + return null; } public String getJsonLd() { From d7fa076bc7b0bc3a39c40b6b08797d93372a1847 Mon Sep 17 00:00:00 2001 From: Juan Pablo Tosca Villanueva Date: Mon, 18 Mar 2024 16:45:48 -0400 Subject: [PATCH 3/5] Empty validation --- src/main/java/edu/harvard/iq/dataverse/DatasetPage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java b/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java index fdb563e857b..beb4c1f9db2 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java +++ b/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java @@ -5814,7 +5814,7 @@ public String getCroissant() { final String CROISSANT_SCHEMA_NAME = "croissant"; ExportService instance = ExportService.getInstance(); String croissant = instance.getExportAsString(dataset, CROISSANT_SCHEMA_NAME); - if (croissant != null) { + if (croissant != null && !croissant.isEmpty()) { logger.fine("Returning cached CROISSANT."); return croissant; } From 3220048999cfc431963f141717e54d75a4117485 Mon Sep 17 00:00:00 2001 From: Juan Pablo Tosca Villanueva Date: Tue, 19 Mar 2024 16:48:28 -0400 Subject: [PATCH 4/5] Release notes snippet --- doc/release-notes/10382-optional-croissant-exporter.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/release-notes/10382-optional-croissant-exporter.md diff --git a/doc/release-notes/10382-optional-croissant-exporter.md b/doc/release-notes/10382-optional-croissant-exporter.md new file mode 100644 index 00000000000..e5c47409a1b --- /dev/null +++ b/doc/release-notes/10382-optional-croissant-exporter.md @@ -0,0 +1 @@ +When a Dataverse installation is provided with a dataverse-exporter for the croissant format, the content for JSON-LD in the header will be replaced with the croissant format. However, both JSON-LD and Croissant will still be available for download on the Dataset page. \ No newline at end of file From 7023fbfb4d6abd1356882b998941be3f72958544 Mon Sep 17 00:00:00 2001 From: Juan Pablo Tosca Villanueva <142103991+jp-tosca@users.noreply.github.com> Date: Wed, 20 Mar 2024 09:09:17 -0400 Subject: [PATCH 5/5] Update doc/release-notes/10382-optional-croissant-exporter.md Co-authored-by: Philip Durbin --- doc/release-notes/10382-optional-croissant-exporter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/release-notes/10382-optional-croissant-exporter.md b/doc/release-notes/10382-optional-croissant-exporter.md index e5c47409a1b..e4c96115825 100644 --- a/doc/release-notes/10382-optional-croissant-exporter.md +++ b/doc/release-notes/10382-optional-croissant-exporter.md @@ -1 +1 @@ -When a Dataverse installation is provided with a dataverse-exporter for the croissant format, the content for JSON-LD in the header will be replaced with the croissant format. However, both JSON-LD and Croissant will still be available for download on the Dataset page. \ No newline at end of file +When a Dataverse installation is configured to use a metadata exporter for the [Croissant](https://github.com/mlcommons/croissant) format, the content of the JSON-LD in the `` of dataset landing pages will be replaced with that format. However, both JSON-LD and Croissant will still be available for download from the dataset page and API. \ No newline at end of file