-
Notifications
You must be signed in to change notification settings - Fork 493
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
base: develop
Are you sure you want to change the base?
Changes from 6 commits
2b2da99
c8cdb8b
ccf74f9
34a795c
825d503
b8a068e
70031f3
f6e1b06
46de8fb
3275eba
07e327c
a553458
ae058d1
7317ac9
cf3ced8
0d75b88
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -162,11 +162,12 @@ private static void createStdyDscr(XMLStreamWriter xmlw, DatasetDTO datasetDto) | |
|
||
String persistentAuthority = datasetDto.getAuthority(); | ||
String persistentId = datasetDto.getIdentifier(); | ||
String persistentSeparator = datasetDto.getSeparator(); | ||
|
||
String pid = persistentProtocol + ":" + persistentAuthority + "/" + 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")) { | ||
if(!pidUri.equals("null:nullnullnull")) { | ||
pidUri= PidUtil.parseAsGlobalID(persistentProtocol, persistentAuthority, persistentId).asURL(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you avoid line 167 by checking for parseAsGlobalId returning null here and setting pid/pidUri using GlobalId if it exists and to the constant "null:nullnullnull" if it doesn't? (Mostly a minor style thing but it avoids writing out unexpected invalid identifier entries as well.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! |
||
} | ||
// The "persistentAgency" tag is used for the "agency" attribute of the | ||
|
@@ -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 + "/" + persistentId); | ||
xmlw.writeCharacters(persistentProtocol + ":" + persistentAuthority + persistentSeparator + persistentId); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same - can you parse the authority/separator/identifier and use GlobalId.asString() ? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ALTER TABLE dvobject ADD COLUMN IF NOT EXISTS separator character varying(255) DEFAULT ''; | ||
|
||
UPDATE dvobject SET separator='/' WHERE protocol = 'doi' OR protocol = 'hdl'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -266,7 +266,7 @@ public void testToEndNoteString_withTitleAndAuthor() throws ParseException { | |
"<edition>V1</edition>" + | ||
"<publisher>LibraScholar</publisher>" + | ||
"<urls><related-urls><url>https://doi.org/10.5072/FK2/LK0D1H</url></related-urls></urls>" + | ||
"<electronic-resource-num>doi/10.5072/FK2/LK0D1H</electronic-resource-num>" + | ||
"<electronic-resource-num>doi:10.5072/FK2/LK0D1H</electronic-resource-num>" + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's weird that this old test expected There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @qqmyers commented above that this slash might be required by EndNote, although it does look weird to me 🤔 |
||
"</record>" + | ||
"</records>" + | ||
"</xml>"; | ||
|
@@ -295,7 +295,7 @@ public void testToEndNoteString_withoutTitleAndAuthor() throws ParseException { | |
"<edition>V1</edition>" + | ||
"<publisher>LibraScholar</publisher>" + | ||
"<urls><related-urls><url>https://doi.org/10.5072/FK2/LK0D1H</url></related-urls></urls>" + | ||
"<electronic-resource-num>doi/10.5072/FK2/LK0D1H</electronic-resource-num>" + | ||
"<electronic-resource-num>doi:10.5072/FK2/LK0D1H</electronic-resource-num>" + | ||
"</record>" + | ||
"</records>" + | ||
"</xml>"; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has it been verified that an initial : after protocol is OK for EndNote import? It seems like the original code used / because ICPSR did. Can someone look at what EndNote exports and make sure we match it here? @adam3smith says he can check this next week if no one else has access.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, I wondered about that slash there. I tried to find some info on the EndNote XML format but found only this schema, which didn't specify anything about the format of
electronic-resource-num
, so I thought it might have been a mistake to use the slash. It would be great if someone could check.