Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#3304 Extended markup regarding DOI and file references #3382

Merged
merged 2 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

import lombok.AllArgsConstructor;

import java.util.List;

/**
* Class representing the DDI fileTxt element.
*/
Expand All @@ -16,9 +18,9 @@ public class FileTxt {
public FileTxt() {}

@XmlElement(name = "fileName")
String fileName;
List<TextElement> fileName;

@XmlElement(name = "fileCont")
TextElement fileCont;
List<TextElement> fileCont;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package eu.dzhw.fdz.metadatamanagement.datapackagemanagement.domain.ddicodebook;

import lombok.AllArgsConstructor;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlValue;

/**
* ID element for the study (e.g. DOI).
*/
@AllArgsConstructor
public class IdNo {

public IdNo() {}

/**
* The agency the ID is registered with (e.g. 'DOI').
*/
@XmlAttribute
String agency;

/**
* The data package version (e.g. '1.0.0').
*/
@XmlAttribute
String elementVersion;

/**
* The ID value.
*/
@XmlValue
String value;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package eu.dzhw.fdz.metadatamanagement.datapackagemanagement.domain.ddicodebook;

import lombok.AllArgsConstructor;

import javax.xml.bind.annotation.XmlAttribute;

/**
* A wrapper element for the dataset ID a variable is linked to.
*/
@AllArgsConstructor
public class Location {

/**
* The dataset ID a variable is linked to (e.g. 'project-ds1').
*/
@XmlAttribute(name = "fileid")
String fileId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ public TitlStmt() {}
@XmlElement(name = "parTitl")
TextElement parTitle;

@XmlElement(name = "IDNo")
IdNo idNo;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public Var() {}
@XmlAttribute(name = "name")
String name;

@XmlAttribute(name = "files")
String files;
@XmlElement
Location location;

@XmlElement(name = "labl")
List<TextElement> labl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
import eu.dzhw.fdz.metadatamanagement.datapackagemanagement.domain.ddicodebook.DataDscr;
import eu.dzhw.fdz.metadatamanagement.datapackagemanagement.domain.ddicodebook.FileDscr;
import eu.dzhw.fdz.metadatamanagement.datapackagemanagement.domain.ddicodebook.FileTxt;
import eu.dzhw.fdz.metadatamanagement.datapackagemanagement.domain.ddicodebook.IdNo;
import eu.dzhw.fdz.metadatamanagement.datapackagemanagement.domain.ddicodebook.LanguageEnum;
import eu.dzhw.fdz.metadatamanagement.datapackagemanagement.domain.ddicodebook.Location;
import eu.dzhw.fdz.metadatamanagement.datapackagemanagement.domain.ddicodebook.StdyDscr;
import eu.dzhw.fdz.metadatamanagement.datapackagemanagement.domain.ddicodebook.TextElement;
import eu.dzhw.fdz.metadatamanagement.datapackagemanagement.domain.ddicodebook.TitlStmt;
Expand Down Expand Up @@ -243,8 +245,8 @@ private Var getDdiVar(VariableSubDocument variableDoc) {
log.error("An exception occurred querying the variables index. ", e);
}
String name = variableDoc.getId().split("\\$")[0];
String files = variableDoc.getDataSetId().split("\\$")[0];
return new Var(name, files, varLablList,
final var location = new Location(variableDoc.getDataSetId().split("\\$")[0]);
return new Var(name, location, varLablList,
qstnList.size() > 0 ? qstnList : null,
txtList.size() > 0 ? txtList : null,
catgryList);
Expand All @@ -256,9 +258,17 @@ private Var getDdiVar(VariableSubDocument variableDoc) {
* @return the fileDscr element
*/
private FileDscr getDdiFileDsrc(DataSetSubDocument dataset) {
String id = dataset.getId().split("\\$")[0];
TextElement fileCont = new TextElement(LanguageEnum.de, dataset.getDescription().getDe());
FileTxt fileTxt = new FileTxt(id, fileCont);
var id = dataset.getId().split("\\$")[0];
final var fileTxt = new FileTxt(
List.of(
new TextElement(LanguageEnum.de, id),
new TextElement(LanguageEnum.en, id)
),
List.of(
new TextElement(LanguageEnum.de, dataset.getDescription().getDe()),
new TextElement(LanguageEnum.en, dataset.getDescription().getEn())
)
);
return new FileDscr(id, fileTxt);
}

Expand All @@ -270,7 +280,11 @@ private FileDscr getDdiFileDsrc(DataSetSubDocument dataset) {
private StdyDscr getDdiStdyDscr(DataPackageSearchDocument doc) {
TextElement titl = new TextElement(LanguageEnum.de, doc.getTitle().getDe());
TextElement parTitl = new TextElement(LanguageEnum.en, doc.getTitle().getEn());
Citation citation = new Citation(new TitlStmt(titl, parTitl));
IdNo idNo = null;
if (doc.getDoi() != null && !doc.getDoi().isBlank()) {
idNo = new IdNo("DOI", doc.getRelease().getVersion(), doc.getDoi());
}
Citation citation = new Citation(new TitlStmt(titl, parTitl, idNo));
return new StdyDscr(citation);
}
}
Loading