diff --git a/conf/solr/9.3.0/schema.xml b/conf/solr/9.3.0/schema.xml
index 3c15b659c4e..3711ffeddba 100644
--- a/conf/solr/9.3.0/schema.xml
+++ b/conf/solr/9.3.0/schema.xml
@@ -246,7 +246,7 @@
-
+
diff --git a/doc/release-notes/9428-alternative-title.md b/doc/release-notes/9428-alternative-title.md
new file mode 100644
index 00000000000..3bc74f218b5
--- /dev/null
+++ b/doc/release-notes/9428-alternative-title.md
@@ -0,0 +1,9 @@
+Alternative Title is made repeatable.
+- One will need to update database with updated citation block.
+`curl http://localhost:8080/api/admin/datasetfield/load -H "Content-type: text/tab-separated-values" -X POST --upload-file scripts/api/data/metadatablocks/citation.tsv`
+- One will also need to update solr schema:
+Change in "alternativeTitle" field multiValued="true" in `/usr/local/solr/solr-8.11.1/server/solr/collection1/conf/schema.xml`
+Reload solr schema: `curl "http://localhost:8983/solr/admin/cores?action=RELOAD&core=collection1"`
+
+Since Alternative Title is repeatable now, old json apis would not be compatable with a new version since value of alternative title has changed from simple string to an array.
+For example, instead "value": "Alternative Title", the value canbe "value": ["Alternative Title1", "Alternative Title2"]
diff --git a/scripts/api/data/dataset-create-new-all-default-fields.json b/scripts/api/data/dataset-create-new-all-default-fields.json
index 4af128955c9..1118ed98a03 100644
--- a/scripts/api/data/dataset-create-new-all-default-fields.json
+++ b/scripts/api/data/dataset-create-new-all-default-fields.json
@@ -22,9 +22,9 @@
},
{
"typeName": "alternativeTitle",
- "multiple": false,
+ "multiple": true,
"typeClass": "primitive",
- "value": "Alternative Title"
+ "value": ["Alternative Title"]
},
{
"typeName": "alternativeURL",
diff --git a/scripts/api/data/metadatablocks/citation.tsv b/scripts/api/data/metadatablocks/citation.tsv
index 18bc31c2dd6..b21b6bcce57 100644
--- a/scripts/api/data/metadatablocks/citation.tsv
+++ b/scripts/api/data/metadatablocks/citation.tsv
@@ -3,7 +3,7 @@
#datasetField name title description watermark fieldType displayOrder displayFormat advancedSearchField allowControlledVocabulary allowmultiples facetable displayoncreate required parent metadatablock_id termURI
title Title The main title of the Dataset text 0 TRUE FALSE FALSE FALSE TRUE TRUE citation http://purl.org/dc/terms/title
subtitle Subtitle A secondary title that amplifies or states certain limitations on the main title text 1 FALSE FALSE FALSE FALSE FALSE FALSE citation
- alternativeTitle Alternative Title Either 1) a title commonly used to refer to the Dataset or 2) an abbreviation of the main title text 2 FALSE FALSE FALSE FALSE FALSE FALSE citation http://purl.org/dc/terms/alternative
+ alternativeTitle Alternative Title Either 1) a title commonly used to refer to the Dataset or 2) an abbreviation of the main title text 2 FALSE FALSE TRUE FALSE FALSE FALSE citation http://purl.org/dc/terms/alternative
alternativeURL Alternative URL Another URL where one can view or access the data in the Dataset, e.g. a project or personal webpage https:// url 3 #VALUE FALSE FALSE FALSE FALSE FALSE FALSE citation https://schema.org/distribution
otherId Other Identifier Another unique identifier for the Dataset (e.g. producer's or another repository's identifier) none 4 : FALSE FALSE TRUE FALSE FALSE FALSE citation
otherIdAgency Agency The name of the agency that generated the other identifier text 5 #VALUE FALSE FALSE FALSE FALSE FALSE FALSE otherId citation
diff --git a/src/main/java/edu/harvard/iq/dataverse/api/imports/ImportDDIServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/api/imports/ImportDDIServiceBean.java
index 8f7934dd528..73a83035fc5 100644
--- a/src/main/java/edu/harvard/iq/dataverse/api/imports/ImportDDIServiceBean.java
+++ b/src/main/java/edu/harvard/iq/dataverse/api/imports/ImportDDIServiceBean.java
@@ -1338,6 +1338,7 @@ private void processProdStmt(XMLStreamReader xmlr, MetadataBlockDTO citation) th
List> producers = new ArrayList<>();
List> grants = new ArrayList<>();
List> software = new ArrayList<>();
+ List prodPlac = new ArrayList<>();
for (int event = xmlr.next(); event != XMLStreamConstants.END_DOCUMENT; event = xmlr.next()) {
if (event == XMLStreamConstants.START_ELEMENT) {
@@ -1353,9 +1354,7 @@ private void processProdStmt(XMLStreamReader xmlr, MetadataBlockDTO citation) th
} else if (xmlr.getLocalName().equals("prodDate")) {
citation.getFields().add(FieldDTO.createPrimitiveFieldDTO("productionDate", parseDate(xmlr, "prodDate")));
} else if (xmlr.getLocalName().equals("prodPlac")) {
- List prodPlac = new ArrayList<>();
- prodPlac.add(parseText(xmlr, "prodPlac"));
- citation.getFields().add(FieldDTO.createMultiplePrimitiveFieldDTO(DatasetFieldConstant.productionPlace, prodPlac));
+ prodPlac.add(parseText(xmlr));
} else if (xmlr.getLocalName().equals("software")) {
HashSet set = new HashSet<>();
addToSet(set,"softwareVersion", xmlr.getAttributeValue(null, "version"));
@@ -1388,6 +1387,9 @@ private void processProdStmt(XMLStreamReader xmlr, MetadataBlockDTO citation) th
if (producers.size()>0) {
citation.getFields().add(FieldDTO.createMultipleCompoundFieldDTO("producer", producers));
}
+ if (prodPlac.size() > 0) {
+ citation.getFields().add(FieldDTO.createMultiplePrimitiveFieldDTO(DatasetFieldConstant.productionPlace, prodPlac));
+ }
return;
}
}
@@ -1397,6 +1399,7 @@ private void processProdStmt(XMLStreamReader xmlr, MetadataBlockDTO citation) th
private void processTitlStmt(XMLStreamReader xmlr, DatasetDTO datasetDTO) throws XMLStreamException, ImportException {
MetadataBlockDTO citation = datasetDTO.getDatasetVersion().getMetadataBlocks().get("citation");
List> otherIds = new ArrayList<>();
+ List altTitles = new ArrayList<>();
for (int event = xmlr.next(); event != XMLStreamConstants.END_DOCUMENT; event = xmlr.next()) {
if (event == XMLStreamConstants.START_ELEMENT) {
@@ -1407,8 +1410,7 @@ private void processTitlStmt(XMLStreamReader xmlr, DatasetDTO datasetDTO) throws
FieldDTO field = FieldDTO.createPrimitiveFieldDTO("subtitle", parseText(xmlr));
citation.getFields().add(field);
} else if (xmlr.getLocalName().equals("altTitl")) {
- FieldDTO field = FieldDTO.createPrimitiveFieldDTO("alternativeTitle", parseText(xmlr));
- citation.getFields().add(field);
+ altTitles.add(parseText(xmlr));
} else if (xmlr.getLocalName().equals("IDNo")) {
if ( AGENCY_HANDLE.equals( xmlr.getAttributeValue(null, "agency") ) || AGENCY_DOI.equals( xmlr.getAttributeValue(null, "agency") ) ) {
importGenericService.reassignIdentifierAsGlobalId(parseText(xmlr), datasetDTO);
@@ -1436,6 +1438,10 @@ private void processTitlStmt(XMLStreamReader xmlr, DatasetDTO datasetDTO) throws
if (otherIds.size()>0) {
citation.addField(FieldDTO.createMultipleCompoundFieldDTO("otherId", otherIds));
}
+ if (!altTitles.isEmpty()) {
+ FieldDTO field = FieldDTO.createMultiplePrimitiveFieldDTO(DatasetFieldConstant.alternativeTitle, altTitles);
+ citation.getFields().add(field);
+ }
return;
}
}
diff --git a/src/main/java/edu/harvard/iq/dataverse/export/ddi/DdiExportUtil.java b/src/main/java/edu/harvard/iq/dataverse/export/ddi/DdiExportUtil.java
index 24449e8010a..1b61a9c9970 100644
--- a/src/main/java/edu/harvard/iq/dataverse/export/ddi/DdiExportUtil.java
+++ b/src/main/java/edu/harvard/iq/dataverse/export/ddi/DdiExportUtil.java
@@ -188,7 +188,10 @@ private static void createStdyDscr(XMLStreamWriter xmlw, DatasetDTO datasetDto)
writeFullElement(xmlw, "titl", dto2Primitive(version, DatasetFieldConstant.title), datasetDto.getMetadataLanguage());
writeFullElement(xmlw, "subTitl", dto2Primitive(version, DatasetFieldConstant.subTitle));
- writeFullElement(xmlw, "altTitl", dto2Primitive(version, DatasetFieldConstant.alternativeTitle));
+ FieldDTO altField = dto2FieldDTO( version, DatasetFieldConstant.alternativeTitle, "citation" );
+ if (altField != null) {
+ writeMultipleElement(xmlw, "altTitl", altField, datasetDto.getMetadataLanguage());
+ }
xmlw.writeStartElement("IDNo");
writeAttribute(xmlw, "agency", persistentAgency);
@@ -988,7 +991,11 @@ private static void writeProducersElement(XMLStreamWriter xmlw, DatasetVersionDT
// productionPlace was made multiple as of 5.14:
// (a quick backward compatibility check was added to dto2PrimitiveList(),
// see the method for details)
- writeFullElementList(xmlw, "prodPlac", dto2PrimitiveList(version, DatasetFieldConstant.productionPlace));
+
+ FieldDTO prodPlac = dto2FieldDTO( version, DatasetFieldConstant.productionPlace, "citation" );
+ if (prodPlac != null) {
+ writeMultipleElement(xmlw, "prodPlac", prodPlac, null);
+ }
writeSoftwareElement(xmlw, version);
writeGrantElement(xmlw, version);
diff --git a/src/main/java/edu/harvard/iq/dataverse/export/openaire/OpenAireExportUtil.java b/src/main/java/edu/harvard/iq/dataverse/export/openaire/OpenAireExportUtil.java
index f7e75ca03fa..7b0a92a4372 100644
--- a/src/main/java/edu/harvard/iq/dataverse/export/openaire/OpenAireExportUtil.java
+++ b/src/main/java/edu/harvard/iq/dataverse/export/openaire/OpenAireExportUtil.java
@@ -1,11 +1,7 @@
package edu.harvard.iq.dataverse.export.openaire;
import java.io.OutputStream;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
import java.util.logging.Logger;
import jakarta.json.JsonObject;
@@ -325,12 +321,34 @@ public static void writeTitlesElement(XMLStreamWriter xmlw, DatasetVersionDTO da
String subtitle = dto2Primitive(datasetVersionDTO, DatasetFieldConstant.subTitle);
title_check = writeTitleElement(xmlw, "Subtitle", subtitle, title_check, language);
- String alternativeTitle = dto2Primitive(datasetVersionDTO, DatasetFieldConstant.alternativeTitle);
- title_check = writeTitleElement(xmlw, "AlternativeTitle", alternativeTitle, title_check, language);
-
+ title_check = writeMultipleTitleElement(xmlw, "AlternativeTitle", datasetVersionDTO, "citation", title_check, language);
writeEndTag(xmlw, title_check);
}
+ private static boolean writeMultipleTitleElement(XMLStreamWriter xmlw, String titleType, DatasetVersionDTO datasetVersionDTO, String metadataBlockName, boolean title_check, String language) throws XMLStreamException {
+ MetadataBlockDTO block = datasetVersionDTO.getMetadataBlocks().get(metadataBlockName);
+ if (block != null) {
+ logger.fine("Block is not empty");
+ List fieldsBlock = block.getFields();
+ if (fieldsBlock != null) {
+ for (FieldDTO fieldDTO : fieldsBlock) {
+ logger.fine(titleType + " " + fieldDTO.getTypeName());
+ if (titleType.toLowerCase().equals(fieldDTO.getTypeName().toLowerCase())) {
+ logger.fine("Found Alt title");
+ List fields = fieldDTO.getMultiplePrimitive();
+ for (String value : fields) {
+ if (!writeTitleElement(xmlw, titleType, value, title_check, language))
+ title_check = false;
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ return title_check;
+ }
+
/**
* 3, Title (with optional type sub-properties) (M)
*
diff --git a/src/test/java/edu/harvard/iq/dataverse/export/dataset-all-defaults.txt b/src/test/java/edu/harvard/iq/dataverse/export/dataset-all-defaults.txt
index f5aaefad64f..c9e429729df 100644
--- a/src/test/java/edu/harvard/iq/dataverse/export/dataset-all-defaults.txt
+++ b/src/test/java/edu/harvard/iq/dataverse/export/dataset-all-defaults.txt
@@ -42,9 +42,9 @@
},
{
"typeName": "alternativeTitle",
- "multiple": false,
+ "multiple": true,
"typeClass": "primitive",
- "value": "Alternative Title"
+ "value": ["Alternative Title"]
},
{
"typeName": "alternativeURL",
diff --git a/src/test/java/edu/harvard/iq/dataverse/export/ddi/dataset-create-new-all-ddi-fields.json b/src/test/java/edu/harvard/iq/dataverse/export/ddi/dataset-create-new-all-ddi-fields.json
index cf8fea222c9..bdff949bb36 100644
--- a/src/test/java/edu/harvard/iq/dataverse/export/ddi/dataset-create-new-all-ddi-fields.json
+++ b/src/test/java/edu/harvard/iq/dataverse/export/ddi/dataset-create-new-all-ddi-fields.json
@@ -51,9 +51,9 @@
},
{
"typeName": "alternativeTitle",
- "multiple": false,
+ "multiple": true,
"typeClass": "primitive",
- "value": "Alternative Title"
+ "value": ["Alternative Title1", "Alternative Title2"]
},
{
"typeName": "otherId",
diff --git a/src/test/java/edu/harvard/iq/dataverse/export/ddi/dataset-finch1.json b/src/test/java/edu/harvard/iq/dataverse/export/ddi/dataset-finch1.json
index 7845f77d33f..9bdc7e45349 100644
--- a/src/test/java/edu/harvard/iq/dataverse/export/ddi/dataset-finch1.json
+++ b/src/test/java/edu/harvard/iq/dataverse/export/ddi/dataset-finch1.json
@@ -29,6 +29,12 @@
"typeClass": "primitive",
"value": "Darwin's Finches"
},
+ {
+ "typeName": "alternativeTitle",
+ "multiple": true,
+ "typeClass": "primitive",
+ "value": ["Darwin's Finches Alternative Title1", "Darwin's Finches Alternative Title2"]
+ },
{
"typeName": "author",
"multiple": true,
diff --git a/src/test/java/edu/harvard/iq/dataverse/export/ddi/dataset-finch1.xml b/src/test/java/edu/harvard/iq/dataverse/export/ddi/dataset-finch1.xml
index 5bbfdae09ac..6730c44603a 100644
--- a/src/test/java/edu/harvard/iq/dataverse/export/ddi/dataset-finch1.xml
+++ b/src/test/java/edu/harvard/iq/dataverse/export/ddi/dataset-finch1.xml
@@ -17,6 +17,8 @@
Darwin's Finches
+ Darwin's Finches Alternative Title1
+ Darwin's Finches Alternative Title2
doi:10.5072/FK2/PCA2E3
diff --git a/src/test/java/edu/harvard/iq/dataverse/export/ddi/exportfull.xml b/src/test/java/edu/harvard/iq/dataverse/export/ddi/exportfull.xml
index 6e2ccfd5545..507d752192d 100644
--- a/src/test/java/edu/harvard/iq/dataverse/export/ddi/exportfull.xml
+++ b/src/test/java/edu/harvard/iq/dataverse/export/ddi/exportfull.xml
@@ -21,7 +21,8 @@
Replication Data for: Title
Subtitle
- Alternative Title
+ Alternative Title1
+ Alternative Title2
doi:10.5072/FK2/WKUKGV
OtherIDIdentifier1
OtherIDIdentifier2