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

fix: issues in exporters and citations for PermaLink/non-DOI PIDs #10790

Merged
merged 20 commits into from
Feb 6, 2025
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2b2da99
fix: remove unnecessary slash in perma PIDs in DDI exporters
vera Aug 22, 2024
c8cdb8b
fix: remove doi property for perma PIDs in BibTeX citation
vera Aug 22, 2024
ccf74f9
fix: fix PID formatting in EndNote XML citation
vera Aug 22, 2024
34a795c
fix: use correct PID separator in DDI exporters (WIP)
vera Aug 22, 2024
825d503
fix: use correct PID separator in DDI exporters (WIP)
vera Aug 23, 2024
b8a068e
fix: use correct PID separator in DDI exporters
vera Aug 23, 2024
70031f3
fix: use GlobalId methods to create PID URLs/strings in DdiExportUtil
vera Aug 26, 2024
f6e1b06
fix: set separator when creating new dataset
vera Aug 27, 2024
46de8fb
test: add tests for DDI exports for datasets with PermaLinks
vera Aug 27, 2024
3275eba
Merge branch 'develop' into fix/perma-exporters-and-citations
vera Oct 23, 2024
07e327c
fix: fix failing DdiExportUtilTest by updating PermaLink config
vera Oct 23, 2024
a553458
fix: improve PID formatting in EndNote XML citation output
vera Oct 25, 2024
ae058d1
release note
qqmyers Oct 25, 2024
7317ac9
Merge branch 'develop' into fix/perma-exporters-and-citations
vera Dec 5, 2024
cf3ced8
Merge branch 'develop' into fix/perma-exporters-and-citations #10790
pdurbin Dec 18, 2024
0d75b88
rename sql script #10790
pdurbin Dec 18, 2024
746b2b4
new test and doc update
qqmyers Jan 17, 2025
43dcb00
Merge pull request #2 from GlobalDataverseCommunityConsortium/fix/per…
vera Jan 20, 2025
ed03452
Merge branch 'develop' into fix/perma-exporters-and-citations
vera Jan 20, 2025
b078516
Merge branch 'develop' into fix/perma-exporters-and-citations
vera Feb 5, 2025
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
Prev Previous commit
Next Next commit
fix: use correct PID separator in DDI exporters (WIP)
vera committed Aug 22, 2024
commit 34a795c97db8bcfce246bff51231946745981a05
16 changes: 15 additions & 1 deletion src/main/java/edu/harvard/iq/dataverse/DvObject.java
Original file line number Diff line number Diff line change
@@ -144,12 +144,14 @@ public String visit(DataFile df) {
@Column(insertable = false, updatable = false) private String dtype;

/*
* Add DOI related fields
* Add PID related fields
*/

private String protocol;
private String authority;

private String separator;

@Temporal(value = TemporalType.TIMESTAMP)
private Date globalIdCreateTime;

@@ -324,6 +326,16 @@ public void setAuthority(String authority) {
globalId=null;
}

public String getSeparator() {
return separator;
}

public void setSeparator(String separator) {
this.separator = separator;
//Remove cached value
globalId=null;
}

public Date getGlobalIdCreateTime() {
return globalIdCreateTime;
}
@@ -354,11 +366,13 @@ public void setGlobalId( GlobalId pid ) {
if ( pid == null ) {
setProtocol(null);
setAuthority(null);
setSeparator(null);
setIdentifier(null);
} else {
//These reset globalId=null
setProtocol(pid.getProtocol());
setAuthority(pid.getAuthority());
setSeparator(pid.getSeparator());
setIdentifier(pid.getIdentifier());
}
}
2 changes: 2 additions & 0 deletions src/main/java/edu/harvard/iq/dataverse/GlobalId.java
Original file line number Diff line number Diff line change
@@ -63,6 +63,8 @@
return authority;
}

public String getSeparator() { return separator; }

Check failure on line 66 in src/main/java/edu/harvard/iq/dataverse/GlobalId.java

GitHub Actions / Checkstyle job

[reviewdog] reported by reviewdog 🐶 '{' at column 34 should have line break after. Raw Output: /github/workspace/./src/main/java/edu/harvard/iq/dataverse/GlobalId.java:66:34: error: '{' at column 34 should have line break after. (com.puppycrawl.tools.checkstyle.checks.blocks.LeftCurlyCheck)

public String getIdentifier() {
return identifier;
}
11 changes: 10 additions & 1 deletion src/main/java/edu/harvard/iq/dataverse/api/dto/DatasetDTO.java
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@ public class DatasetDTO implements java.io.Serializable {
private String identifier;
private String protocol;
private String authority;
private String separator;
private String globalIdCreateTime;
private String publisher;
private String publicationDate;
@@ -51,6 +52,14 @@ public void setAuthority(String authority) {
this.authority = authority;
}

public String getSeparator() {
return separator;
}

public void setSeparator(String separator) {
this.separator = separator;
}

public String getGlobalIdCreateTime() {
return globalIdCreateTime;
}
@@ -94,7 +103,7 @@ public void setPublicationDate(String publicationDate) {

@Override
public String toString() {
return "DatasetDTO{" + "id=" + id + ", identifier=" + identifier + ", protocol=" + protocol + ", authority=" + authority + ", globalIdCreateTime=" + globalIdCreateTime + ", datasetVersion=" + datasetVersion + ", dataFiles=" + dataFiles + '}';
return "DatasetDTO{" + "id=" + id + ", identifier=" + identifier + ", protocol=" + protocol + ", authority=" + authority + ", separator=" + separator + ", globalIdCreateTime=" + globalIdCreateTime + ", datasetVersion=" + datasetVersion + ", dataFiles=" + dataFiles + '}';
}

public void setMetadataLanguage(String metadataLanguage) {
Original file line number Diff line number Diff line change
@@ -162,8 +162,9 @@ private static void createStdyDscr(XMLStreamWriter xmlw, DatasetDTO datasetDto)

String persistentAuthority = datasetDto.getAuthority();
String persistentId = datasetDto.getIdentifier();
String persistentSeparator = datasetDto.getSeparator();

String pid = persistentProtocol + ":" + persistentAuthority + ("perma".equals(persistentAgency) ? "" : "/") + persistentId;
String pid = persistentProtocol + ":" + persistentAuthority + persistentSeparator + persistentId;
String pidUri = pid;
//Some tests don't send real PIDs - don't try to get their URL form
if(!pidUri.equals("null:null/null")) {
@@ -337,14 +338,15 @@ private static void writeDocDescElement (XMLStreamWriter xmlw, DatasetDTO datase

String persistentAuthority = datasetDto.getAuthority();
String persistentId = datasetDto.getIdentifier();
String persistentSeparator = datasetDto.getSeparator();

xmlw.writeStartElement("docDscr");
xmlw.writeStartElement("citation");
xmlw.writeStartElement("titlStmt");
writeFullElement(xmlw, "titl", dto2Primitive(version, DatasetFieldConstant.title), datasetDto.getMetadataLanguage());
xmlw.writeStartElement("IDNo");
writeAttribute(xmlw, "agency", persistentAgency);
xmlw.writeCharacters(persistentProtocol + ":" + persistentAuthority + ("perma".equals(persistentAgency) ? "" : "/") + persistentId);
xmlw.writeCharacters(persistentProtocol + ":" + persistentAuthority + persistentSeparator + persistentId);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same - can you parse the authority/separator/identifier and use GlobalId.asString() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

xmlw.writeEndElement(); // IDNo
xmlw.writeEndElement(); // titlStmt
xmlw.writeStartElement("distStmt");
Original file line number Diff line number Diff line change
@@ -397,6 +397,7 @@ public static JsonObjectBuilder json(Dataset ds, Boolean returnOwners) {
.add("persistentUrl", ds.getPersistentURL())
.add("protocol", ds.getProtocol())
.add("authority", ds.getAuthority())
.add("separator", ds.getSeparator())
.add("publisher", BrandingUtil.getInstallationBrandName())
.add("publicationDate", ds.getPublicationDateFormattedYYYYMMDD())
.add("storageIdentifier", ds.getStorageIdentifier());
1 change: 1 addition & 0 deletions src/main/resources/db/migration/V6.3.0.2.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE dvobject ADD COLUMN IF NOT EXISTS separator character varying(255);