From a6915d76e746b7b0b48322346241b12bf505f733 Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Thu, 11 Oct 2018 10:55:40 -0400 Subject: [PATCH] change "author" to "creator" #4371 "I think Google Dataset Search is ignoring author and prefers creator" --- src/main/java/edu/harvard/iq/dataverse/DatasetVersion.java | 2 +- .../java/edu/harvard/iq/dataverse/DatasetVersionTest.java | 2 +- .../iq/dataverse/export/SchemaDotOrgExporterTest.java | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/DatasetVersion.java b/src/main/java/edu/harvard/iq/dataverse/DatasetVersion.java index 371d36c6ce4..eeee3bb21e0 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DatasetVersion.java +++ b/src/main/java/edu/harvard/iq/dataverse/DatasetVersion.java @@ -1405,7 +1405,7 @@ public String getJsonLd() { } authors.add(author); } - job.add("author", authors); + job.add("creator", authors); /** * We are aware that there is a "datePublished" field but it means "Date * of first broadcast/publication." This only makes sense for a 1.0 diff --git a/src/test/java/edu/harvard/iq/dataverse/DatasetVersionTest.java b/src/test/java/edu/harvard/iq/dataverse/DatasetVersionTest.java index 500b30b2062..084626c14c3 100644 --- a/src/test/java/edu/harvard/iq/dataverse/DatasetVersionTest.java +++ b/src/test/java/edu/harvard/iq/dataverse/DatasetVersionTest.java @@ -130,7 +130,7 @@ public void testGetJsonLd() throws ParseException { assertEquals("", obj.getString("name")); // TODO: If it ever becomes easier to mock authors, test them. JsonArray emptyArray = Json.createArrayBuilder().build(); - assertEquals(emptyArray, obj.getJsonArray("author")); + assertEquals(emptyArray, obj.getJsonArray("creator")); // TODO: If it ever becomes easier to mock subjects, test them. assertEquals(emptyArray, obj.getJsonArray("keywords")); assertEquals("Dataverse", obj.getJsonObject("provider").getString("name")); diff --git a/src/test/java/edu/harvard/iq/dataverse/export/SchemaDotOrgExporterTest.java b/src/test/java/edu/harvard/iq/dataverse/export/SchemaDotOrgExporterTest.java index a24f99ccf8a..1c3131cf999 100644 --- a/src/test/java/edu/harvard/iq/dataverse/export/SchemaDotOrgExporterTest.java +++ b/src/test/java/edu/harvard/iq/dataverse/export/SchemaDotOrgExporterTest.java @@ -10,6 +10,7 @@ import edu.harvard.iq.dataverse.util.json.JsonUtil; import java.io.ByteArrayOutputStream; import java.io.File; +import java.io.PrintWriter; import java.io.StringReader; import java.nio.file.Files; import java.nio.file.Paths; @@ -161,8 +162,8 @@ public void testExportDataset() throws Exception { assertEquals("Dataset", json2.getString("@type")); assertEquals("https://doi.org/myAuthority/myIdentifier", json2.getString("identifier")); assertEquals("Darwin's Finches", json2.getString("name")); - assertEquals("Finch, Fiona", json2.getJsonArray("author").getJsonObject(0).getString("name")); - assertEquals("Birds Inc.", json2.getJsonArray("author").getJsonObject(0).getString("affiliation")); + assertEquals("Finch, Fiona", json2.getJsonArray("creator").getJsonObject(0).getString("name")); + assertEquals("Birds Inc.", json2.getJsonArray("creator").getJsonObject(0).getString("affiliation")); assertEquals("1955-11-05", json2.getString("dateModified")); assertEquals("1", json2.getString("version")); assertEquals("Darwin's finches (also known as the Galápagos finches) are a group of about fifteen species of passerine birds.", json2.getString("description"));