Skip to content

Commit

Permalink
Merge branch 'update_v6.3_oai' into update_v6.3_code
Browse files Browse the repository at this point in the history
  • Loading branch information
ffritze committed Aug 9, 2024
2 parents 1f747eb + b2ed7ff commit f218d95
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public class DatasetFieldConstant implements java.io.Serializable {
public final static String topicClassValue="topicClassValue";
public final static String topicClassVocab="topicClassVocab";
public final static String topicClassVocabURI="topicClassVocabURI";
public final static String topicClassTermURI="topicClassTermURI";
public final static String descriptionText="dsDescriptionValue";
public final static String descriptionDate="dsDescriptionDate";
public final static String timePeriodCovered="timePeriodCovered"; // SEK added 6/13/2016
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,16 @@
import java.util.regex.Pattern;
import jakarta.mail.internet.AddressException;
import jakarta.mail.internet.InternetAddress;
import org.jsoup.Jsoup;

public class OpenAireExportUtil {

private static final Logger logger = Logger.getLogger(OpenAireExportUtil.class.getCanonicalName());

public static String XSI_NAMESPACE = "http://www.w3.org/2001/XMLSchema-instance";
public static String SCHEMA_VERSION = "4.1";
public static String SCHEMA_VERSION = "4.5";
public static String RESOURCE_NAMESPACE = "http://datacite.org/schema/kernel-4";
public static String RESOURCE_SCHEMA_LOCATION = "http://schema.datacite.org/meta/kernel-4.1/metadata.xsd";
public static String RESOURCE_SCHEMA_LOCATION = "http://schema.datacite.org/meta/kernel-4.5/metadata.xsd";

public static String FunderType = "Funder";

Expand Down Expand Up @@ -480,6 +481,7 @@ public static void writeSubjectsElement(XMLStreamWriter xmlw, DatasetVersionDTO
String subject = null;
String subjectScheme = null;
String schemeURI = null;
String valueURI = null;

for (Iterator<FieldDTO> iterator = fieldDTOs.iterator(); iterator.hasNext();) {
FieldDTO next = iterator.next();
Expand All @@ -490,15 +492,19 @@ public static void writeSubjectsElement(XMLStreamWriter xmlw, DatasetVersionDTO
if (DatasetFieldConstant.topicClassVocab.equals(next.getTypeName())) {
subjectScheme = next.getSinglePrimitive();
}

if (DatasetFieldConstant.topicClassVocabURI.equals(next.getTypeName())) {
schemeURI = next.getSinglePrimitive();
}

if (DatasetFieldConstant.topicClassTermURI.equals(next.getTypeName())) {
valueURI = next.getSinglePrimitive();
}
}

if (StringUtils.isNotBlank(subject)) {
subject_check = writeOpenTag(xmlw, "subjects", subject_check);
writeSubjectElement(xmlw, subjectScheme, null, schemeURI, subject, language);
writeSubjectElement(xmlw, subjectScheme, valueURI, schemeURI, subject, language);
}
}
}
Expand Down Expand Up @@ -1139,6 +1145,8 @@ public static void writeDescriptionsElement(XMLStreamWriter xmlw, DatasetVersion
FieldDTO next = iterator.next();
if (DatasetFieldConstant.descriptionText.equals(next.getTypeName())) {
descriptionOfAbstract = next.getSinglePrimitive();
// From https://stackoverflow.com/questions/240546/remove-html-tags-from-a-string
descriptionOfAbstract = Jsoup.parse(descriptionOfAbstract).text();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public void testGetXMLNameSpace() throws Exception {
public void testGetXMLSchemaLocation() throws Exception {
System.out.println("getXMLSchemaLocation");
OpenAireExporter instance = new OpenAireExporter();
String expResult = "http://schema.datacite.org/meta/kernel-4.1/metadata.xsd";
String expResult = "http://schema.datacite.org/meta/kernel-4.5/metadata.xsd";
String result = instance.getXMLSchemaLocation();
assertEquals(expResult, result);
}
Expand All @@ -197,7 +197,7 @@ public void testGetXMLSchemaLocation() throws Exception {
public void testGetXMLSchemaVersion() throws Exception {
System.out.println("getXMLSchemaVersion");
OpenAireExporter instance = new OpenAireExporter();
String expResult = "4.1";
String expResult = "4.5";
String result = instance.getXMLSchemaVersion();
assertEquals(expResult, result);
}
Expand Down

0 comments on commit f218d95

Please sign in to comment.