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

adding description info to the fileDsc seciton in DDI CodeBook. #5051 #10938

Merged
merged 1 commit into from
Nov 13, 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 @@ -98,8 +98,10 @@ public class DDIExportServiceBean {
public static final String LEVEL_FILE = "file";
public static final String NOTE_TYPE_UNF = "VDC:UNF";
public static final String NOTE_TYPE_TAG = "DATAVERSE:TAG";
public static final String NOTE_TYPE_FILEDESCRIPTION = "DATAVERSE:FILEDESC";
public static final String NOTE_SUBJECT_UNF = "Universal Numeric Fingerprint";
public static final String NOTE_SUBJECT_TAG = "Data File Tag";
public static final String NOTE_SUBJECT_FILEDESCRIPTION = "DataFile Description";

/*
* Internal service objects:
Expand Down Expand Up @@ -742,11 +744,6 @@ private void createFileDscr(XMLStreamWriter xmlw, Set<String> excludedFieldSet,
xmlw.writeEndElement(); // fileName
}

/*
xmlw.writeStartElement("fileCont");
xmlw.writeCharacters( df.getContentType() );
xmlw.writeEndElement(); // fileCont
*/
// dimensions
if (checkField("dimensns", excludedFieldSet, includedFieldSet)) {
if (dt.getCaseQuantity() != null || dt.getVarQuantity() != null || dt.getRecordsPerCase() != null) {
Expand Down Expand Up @@ -801,26 +798,6 @@ private void createFileDscr(XMLStreamWriter xmlw, Set<String> excludedFieldSet,
xmlw.writeEndElement(); // notes
}

/*
xmlw.writeStartElement("notes");
writeAttribute( xmlw, "type", "vdc:category" );
xmlw.writeCharacters( fm.getCategory() );
xmlw.writeEndElement(); // notes
*/
// A special note for LOCKSS crawlers indicating the restricted
// status of the file:

/*
if (tdf != null && isRestrictedFile(tdf)) {
xmlw.writeStartElement("notes");
writeAttribute( xmlw, "type", NOTE_TYPE_LOCKSS_CRAWL );
writeAttribute( xmlw, "level", LEVEL_FILE );
writeAttribute( xmlw, "subject", NOTE_SUBJECT_LOCKSS_PERM );
xmlw.writeCharacters( "restricted" );
xmlw.writeEndElement(); // notes

}
*/
if (checkField("tags", excludedFieldSet, includedFieldSet) && df.getTags() != null) {
for (int i = 0; i < df.getTags().size(); i++) {
xmlw.writeStartElement("notes");
Expand All @@ -831,6 +808,17 @@ private void createFileDscr(XMLStreamWriter xmlw, Set<String> excludedFieldSet,
xmlw.writeEndElement(); // notes
}
}

// A dedicated node for the Description entry
if (!StringUtilisEmpty(fm.getDescription())) {
xmlw.writeStartElement("notes");
xmlw.writeAttribute("level", LEVEL_FILE);
xmlw.writeAttribute("type", NOTE_TYPE_FILEDESCRIPTION);
xmlw.writeAttribute("subject", NOTE_SUBJECT_FILEDESCRIPTION);
xmlw.writeCharacters(fm.getDescription());
xmlw.writeEndElement(); // notes
}

xmlw.writeEndElement(); // fileDscr
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
import static edu.harvard.iq.dataverse.export.DDIExportServiceBean.LEVEL_FILE;
import static edu.harvard.iq.dataverse.export.DDIExportServiceBean.NOTE_SUBJECT_TAG;
import static edu.harvard.iq.dataverse.export.DDIExportServiceBean.NOTE_SUBJECT_UNF;
import static edu.harvard.iq.dataverse.export.DDIExportServiceBean.NOTE_SUBJECT_FILEDESCRIPTION;
import static edu.harvard.iq.dataverse.export.DDIExportServiceBean.NOTE_TYPE_TAG;
import static edu.harvard.iq.dataverse.export.DDIExportServiceBean.NOTE_TYPE_UNF;
import static edu.harvard.iq.dataverse.export.DDIExportServiceBean.NOTE_TYPE_FILEDESCRIPTION;
import edu.harvard.iq.dataverse.export.DDIExporter;
import edu.harvard.iq.dataverse.pidproviders.PidUtil;
import edu.harvard.iq.dataverse.settings.SettingsServiceBean;
Expand Down Expand Up @@ -1901,6 +1903,8 @@ private static void createFileDscr(XMLStreamWriter xmlw, JsonArray fileDetails)
xmlw.writeEndElement(); // notes
}

// If any tabular tags are present, each is formatted in a
// dedicated note:
if (fileJson.containsKey("tabularTags")) {
JsonArray tags = fileJson.getJsonArray("tabularTags");
for (int j = 0; j < tags.size(); j++) {
Expand All @@ -1912,6 +1916,17 @@ private static void createFileDscr(XMLStreamWriter xmlw, JsonArray fileDetails)
xmlw.writeEndElement(); // notes
}
}

// Adding a dedicated node for the description entry (for
// non-tabular files we format it under the <txt> field)
if (fileJson.containsKey("description")) {
xmlw.writeStartElement("notes");
xmlw.writeAttribute("level", LEVEL_FILE);
xmlw.writeAttribute("type", NOTE_TYPE_FILEDESCRIPTION);
xmlw.writeAttribute("subject", NOTE_SUBJECT_FILEDESCRIPTION);
xmlw.writeCharacters(fileJson.getString("description"));
xmlw.writeEndElement(); // notes
}

// TODO: add the remaining fileDscr elements!
xmlw.writeEndElement(); // fileDscr
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/propertyFiles/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1464,7 +1464,7 @@ dataset.editBtn.itemLabel.deleteDataset=Delete Dataset
dataset.editBtn.itemLabel.deleteDraft=Delete Draft Version
dataset.editBtn.itemLabel.deaccession=Deaccession Dataset
dataset.exportBtn=Export Metadata
dataset.exportBtn.itemLabel.ddi=DDI
dataset.exportBtn.itemLabel.ddi=DDI Codebook v2
dataset.exportBtn.itemLabel.dublinCore=Dublin Core
dataset.exportBtn.itemLabel.schemaDotOrg=Schema.org JSON-LD
dataset.exportBtn.itemLabel.datacite=DataCite
Expand Down Expand Up @@ -1934,7 +1934,7 @@ file.downloadBtn.format.all=All File Formats + Information
file.downloadBtn.format.tab=Tab-Delimited
file.downloadBtn.format.original={0} (Original File Format)
file.downloadBtn.format.rdata=RData
file.downloadBtn.format.var=Variable Metadata
file.downloadBtn.format.var=DDI Codebook v2
pdurbin marked this conversation as resolved.
Show resolved Hide resolved
file.downloadBtn.format.citation=Data File Citation
file.download.filetype.unknown=Original File Format
file.more.information.link=Link to more file information for
pdurbin marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Loading