3

I need to read .bib file and insert it tags into an objects of bib-entries

the file is big (almost 4000 lines) , so my first question is what to use (bufferrReader or FileReader) the general format is

@ARTICLE{orleans01DJ,
author = {Doug Orleans and Karl Lieberherr},
title = {{{DJ}: {Dynamic} Adaptive Programming in {Java}}},
journal = {Metalevel Architectures and Separation of Crosscutting Concerns 3rd
Int'l Conf. (Reflection 2001), {LNCS} 2192},
year = {2001},
pages = {73--80},
month = sep,
editor = {A. Yonezawa and S. Matsuoka},
owner = {Administrator},
publisher = {Springer-Verlag},
timestamp = {2009.03.09}
}

@ARTICLE{Ossher:1995:SOCR,
author = {Harold Ossher and Matthew Kaplan and William Harrison and Alexander
Katz},
title = {{Subject-Oriented Composition Rules}},
journal = {ACM SIG{\-}PLAN Notices},
year = {1995},
volume = {30},
pages = {235--250},
number = {10},
month = oct,
acknowledgement = {Nelson H. F. Beebe, University of Utah, Department of Mathematics,
110 LCB, 155 S 1400 E RM 233, Salt Lake City, UT 84112-0090, USA,
Tel: +1 801 581 5254, FAX: +1 801 581 4148, e-mail: \path|beebe@math.utah.edu|,
\path|beebe@acm.org|, \path|beebe@computer.org| (Internet), URL:
\path|http://www.math.utah.edu/~beebe/|},
bibdate = {Fri Apr 30 12:33:10 MDT 1999},
coden = {SINODQ},
issn = {0362-1340},
keywords = {ACM; object-oriented programming systems; OOPSLA; programming languages;
SIGPLAN},
owner = {Administrator},
timestamp = {2009.02.26}
}

As you can see , there are some entries that have more than line, entries that end with } entries that end with }, or }},

Also , some entries have {..},{..}.. in the middle so , i am a little bit confused on how to start reading this file and how to get these entries and manipulate them. Any help will be highly appreciated.

Ali123
  • 740
  • 13
  • 38
  • Here's a parser (https://code.google.com/p/javabib/). I'm not sure if it does serialization or allows manipulation. If it won't work for you, try google and use "bibtex java parser". Best bet is to find a library that has already done the work of parsing, allows you to manipulate the file, and then re-serialize it to a .bib file. – Erik Nedwidek Sep 11 '14 at 18:31
  • `javabib` is abandoned project, try using https://code.google.com/p/java-bibtex/. Here: https://code.google.com/p/java-bibtex/source/browse/trunk/src/example/java/org/jbibtex/CopyExample.java you can find complete working example of parsing `bib` file – Maciej Dobrowolski Sep 11 '14 at 18:34
  • Thanks for your answer but my teacher wants me to read it manually – Ali123 Sep 11 '14 at 19:10
  • i think that if i am able to read this format , everything else will be much easier – Ali123 Sep 11 '14 at 19:12

1 Answers1

3

We currently discuss different options at JabRef.

These are the current options:

Community
  • 1
  • 1
koppor
  • 19,079
  • 15
  • 119
  • 161
  • I know that this topic is old. but my teacher wanted me to create an algorithm to read this kind of "complicated" and "unstable" input. i created a simple algorithm myself but it wasn't the best. some of my colleges used regular expression and others used ASCII conversion ... i will try to post the optimal solution here if i find the documents thanks for your response. – Ali123 Jan 29 '16 at 06:45
  • Please create a GitHub repository with test cases and [a license](http://choosealicense.com/). A test suite giving you ideas is available at https://github.com/JabRef/jabref/blob/master/src/test/java/net/sf/jabref/importer/fileformat/BibtexParserTest.java. – koppor Jan 29 '16 at 09:20