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

Import bib files from BIbDesk and parse the groups + linked files #10381

Closed
Siedlerchr opened this issue Sep 14, 2023 · 4 comments · Fixed by #10968
Closed

Import bib files from BIbDesk and parse the groups + linked files #10381

Siedlerchr opened this issue Sep 14, 2023 · 4 comments · Fixed by #10968

Comments

@Siedlerchr
Copy link
Member

Siedlerchr commented Sep 14, 2023

Is your suggestion for improvement related to a problem? Please describe.
I want to switch from BibDesk (a reference manager on macOS which also uses BibTeX as basis) to JabRef and import my library in JabRef.

Describe the solution you'd like
I want to have the groups I used in BibDesk to be in JabRef.

Extra: Be able to parse the linked files

Additional context

JabRef should be able to parse the metadata and convert it to JabRef groups.

Groups In BibDesk are stored as metadata in the comment field.
Entries in the group are identified by their citation key.

Extra: Be able to convert the linked files to format:
LInked files are stored in some kind of binary/base64 encoded file path. It's a mac os alias.

Decode the base64 data:

bdsk-file-1 = {YnBsaXN0MDDSAQIDBFxyZWxhdGl2ZVBhdGhZYWxpYXNEYXRhXxAbLi4vRG93bmxvYWRzLzIzMDkuMDY5MzIucGRmTxEBUgAAAAABUgACAAAMTWFjaW50b3NoIEhEAAAAAAAAAAAAAAAAAAAA4O/yLkJEAAH/////DjIzMDkuMDY5MzIucGRmAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/////hKRjCAAAAAAAAAAAAAQACAAAKIGN1AAAAAAAAAAAAAAAAAAlEb3dubG9hZHMAAAIAKy86VXNlcnM6Y2hyaXN0b3BoczpEb3dubG9hZHM6MjMwOS4wNjkzMi5wZGYAAA4AHgAOADIAMwAwADkALgAwADYAOQAzADIALgBwAGQAZgAPABoADABNAGEAYwBpAG4AdABvAHMAaAAgAEgARAASAClVc2Vycy9jaHJpc3RvcGhzL0Rvd25sb2Fkcy8yMzA5LjA2OTMyLnBkZgAAEwABLwAAFQACABH//wAAAAgADQAaACQAQgAAAAAAAAIBAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAGY},

with base64 -D | plutil -p -

That gives

{
  "aliasData" => {length = 338, bytes = 0x00000000 01520002 00000c4d 6163696e ... 00020011 ffff0000 }
  "relativePath" => "../Downloads/2309.06932.pdf"
}

Example:

@comment{BibDesk Static Groups{
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
	<dict>
		<key>group name</key>
		<string>testSammlung</string>
		<key>keys</key>
		<string>Kraljic:2023aa,Kovakkuni:2023aa,Pereira-Santaella:2023aa,Cooper:2023aa,Heyl:2023aa,Swain:2023aa</string>
	</dict>
</array>
</plist>
}}

Complete File:
TestbIbDesk.bib.txt

Implementation hint
Parse the metadata at

private void parseJabRefComment(Map<String, String> meta) {
StringBuilder buffer;
try {
buffer = parseBracketedFieldContent();
} catch (IOException e) {
// if we get an IO Exception here, then we have an unbracketed comment,
// which means that we should just return and the comment will be picked up as arbitrary text
// by the parser
LOGGER.info("Found unbracketed comment");
return;
}
String comment = buffer.toString().replaceAll("[\\x0d\\x0a]", "");
if (comment.substring(0, Math.min(comment.length(), MetaData.META_FLAG.length())).equals(MetaData.META_FLAG)) {

@foice
Copy link

foice commented Sep 25, 2023

This tried to convert the group information of BibDesk into OS X tags over the files (metadata of the file that you see in Finder and search over) as well as try to create an independent database of keywords based on the groups of BibDesk. Maybe it can help with parsing. As far as I know this code was fully able to parse BibDesk groups and even to use the info on the date of last modification of the group (intended as the date at which a paper was added)

@Siedlerchr
Copy link
Member Author

Wow, that's great!

@Frequinzy
Copy link
Contributor

Hello, we (@Frequinzy @Tian0602 @annamaartensson @LottaJohnsson @filippanilsson) are a group of university students who would like to take an attempt at this issue if possible!

@ThiloteE ThiloteE added the FirstTimeCodeContribution Triggers GitHub Greeter Workflow label Feb 24, 2024
Copy link
Contributor

As a general advice for newcomers: check out Contributing for a start. Also, guidelines for setting up a local workspace is worth having a look at.

Feel free to ask here at GitHub, if you have any issue related questions. If you have questions about how to setup your workspace use JabRef's Gitter chat. Try to open a (draft) pull-request early on, so that people can see you are working on the issue and so that they can see the direction the pull request is heading towards. This way, you will likely receive valuable feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants