-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Add an importer for Citavi backup files #8848
Conversation
Add generated citavi xsd schema
… utf-8 BOM bytes in the XML file
Fix some resouces leaks Use AuthorListParser
Thank you very much for your work! Impressive 👍 I took a more in-depth look at the author handling code, that's really ugly but I couldn't find a general better approach. However, you do not have to iterate over the whole String, the ids are all UUIDs that have a fixed length of 36 characters. So you can improve your loops. Second thing: I implemented an example of using JabRef's Author and AuthorLIst class for adding new authors. You just need to adjust your test bib files (Lastname, Firstname), can be done in JabRef's GUI: (Quality-> Cleanup -> Normalize in persons) and maybe the same for other persons fields. |
Store referenceId and identified persons also
@lishangyu9 I came up with a more efficient solution for the authors and editors. Instead of iterating through the whole author + person list for every reference, I create a mapping between referenceId and Persons. In addition, I introduced a second Map for storing Persons we already know (if the same author with the same uuid comes up multiple times, so we don't have to through all Person objects everytime. Antoher thing we can use for our advantage: We know that all UUIDs have a length of 36 chars and we know that the first only the first UUID is the referenceID. So we can safely assume that the rest of the string are the Person ids. So we can use split to get an array of all person ids if we just split at the semicolon, after we removed the refId from it. This can be adapted for other oneToN relationships as well |
Thank you @Siedlerchr . We will check and fix it today. |
Hi @Siedlerchr, we fixed other's OneToN relationships, "Keywords" and "Publishers". We followed the method you have made and created the "buildKeywordList" and "buildPublisherList" functions for mapping the data and reference Id. We appreciate your help. |
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.
Just some minor changes, but overall looks very good to me!
src/main/java/org/jabref/logic/importer/fileformat/CitaviXmlImporter.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/logic/importer/fileformat/CitaviXmlImporter.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/logic/importer/fileformat/CitaviXmlImporter.java
Outdated
Show resolved
Hide resolved
@claell You were using citavi previously, it would be nice if you could testt this PR. |
…porter.java Co-authored-by: Christoph <[email protected]>
…porter.java Co-authored-by: Christoph <[email protected]>
@Siedlerchr when I find the time, I'll try that. I don't have GitHub's cli tools installed. Is there another easy way or should I just use them? Also, I likely cannot do too in depth testing due to constrained time. |
gh cli is supposed to be the easy way... you can of course also follow the "command line instructions" on the bottom of this page |
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.
In general, it is OK. Some nitpicks, but we can fix them for ourselves later.
The thing I see here, that there was strong test-driven development somehow:
buildPersonList
, buildKeywordList
, buildPublisherList
should all have been package private and tested by CitaviXmlImporter
.
However, I think, this project is over. Think about using JUnit and the play / debug button also for methods themselves the next java project.
src/main/java/org/jabref/logic/importer/fileformat/CitaviXmlImporter.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/logic/importer/fileformat/CitaviXmlImporter.java
Show resolved
Hide resolved
I just mentioned you are mixing the old io and the new nio file apis. Is there a chance to switch completely to the new nio API? Provides thread safety i.a.... |
@calixtus Ehm they are meant to be interoperable, for example Files.newInputStream returns an InputStream. And Inputstream is just the base class in java.io. There is not all in nio. |
* upstream/main: Add an importer for Citavi backup files (#8848) Reviewdoc: Comment on PRs (#8878) Squashed 'buildres/csl/csl-styles/' changes from 649aac4..e740261 Use JDK 15 text blocks to improve injected languages readability (#8874) Fix fetcher tests (#8877) Fix #8390 by allowing multiple group deletion for Remove groups > Kee… (#8875) Add restart warning on SSL configuration change (#8871) Update to lucene 9.2 (#8868) Fix for removing several groups deletes only one of them (#8801) Disable Write XMP Button in General tab of Entry-Editor when action is in progress (#8728) Bump jsoup from 1.14.3 to 1.15.1 (#8864) Bump unirest-java from 3.13.8 to 3.13.10 (#8869) Bump unoloader from 7.3.2 to 7.3.3 (#8863) Bump pascalgn/automerge-action from 0.15.2 to 0.15.3 (#8860) Bump classgraph from 4.8.146 to 4.8.147 (#8861) Bump mockito-core from 4.5.1 to 4.6.0 (#8862) Lucence dir checkers should only delete lucence dirs (#8854) Update README.md (#8858) Update adr.md Update adr.md
Thanks again for your valuable contribution and your quick follow up! 👍 |
Fixes #8322 .
This importer for Citavi support ‘ctv5bak’ and ‘ctv6bak’ files.
CHANGELOG.md
described in a way that is understandable for the average user (if applicable)What we have added
The Citavi file format support
Add the definition of Citavi file in the “StandardFileType.java”.The XSD file defined the Citavi XML file
Add the file “scitavi.xsd” for generating the java class “CitaviExchangeData.java”.The importer for Citavi file “ctv5bak” and “ctv6bak”
Because the “ctv6bak” and “ctv5bak” are compressed files. We add the function “getReaderFromZip” to unzip the file before parsing.
The test of Citavi importer
The test class of Citavi importer is “CitaviXmlImporterTestFiles.java”.There are 4 test cases:
“CitaviXmlImporterTest1.ctv6bak”, “CitaviXmlImporterTest1.bib”
“CitaviXmlImporterTest2.ctv6bak”, “CitaviXmlImporterTest2.bib”
“CitaviXmlImporterTest3.ctv6bak”, “CitaviXmlImporterTest3.bib”
“CitaviXmlImporterTest4.ctv6bak”, “CitaviXmlImporterTest4.bib”
How to use the Citavi Importer