Skip to content

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

@Siedlerchr

Description

@Siedlerchr

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)) {

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions