1919import org .jabref .model .entry .FieldName ;
2020import org .jabref .model .entry .Month ;
2121
22- /**
23- * Imports a Biblioscape Tag File. The format is described on
24- * http://www.biblioscape.com/manual_bsp/Biblioscape_Tag_File.htm
25- * Several Biblioscape field types are ignored. Others are only included in the BibTeX
26- * field "comment".
27- */
2822public class RisImporter extends Importer {
2923
3024 private static final Pattern RECOGNIZED_FORMAT_PATTERN = Pattern .compile ("TY - .*" );
@@ -129,21 +123,21 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException {
129123 fields .put (FieldName .TITLE , fields .get (FieldName .TITLE ).replaceAll ("\\ s+" , " " )); // Normalize whitespaces
130124 } else if ("BT" .equals (tag )) {
131125 fields .put (FieldName .BOOKTITLE , value );
132- } else if ("T2" .equals (tag ) && (fields .get (FieldName .JOURNAL ) == null || "" .equals (fields .get (FieldName .JOURNAL )))) {
126+ } else if (( "T2" .equals (tag ) || "J2" . equals ( tag ) || "JA" . equals ( tag ) ) && (fields .get (FieldName .JOURNAL ) == null || "" .equals (fields .get (FieldName .JOURNAL )))) {
133127 //if there is no journal title, then put second title as journal title
134128 fields .put (FieldName .JOURNAL , value );
135- } else if ("JO" .equals (tag )) {
129+ } else if ("JO" .equals (tag ) || "J1" . equals ( tag ) || "JF" . equals ( tag ) ) {
136130 //if this field appears then this should be the journal title
137131 fields .put (FieldName .JOURNAL , value );
138132 } else if ("T3" .equals (tag )) {
139133 fields .put (FieldName .SERIES , value );
140- } else if ("AU" .equals (tag ) || "A1" .equals (tag )) {
134+ } else if ("AU" .equals (tag ) || "A1" .equals (tag ) || "A2" . equals ( tag ) || "A3" . equals ( tag ) || "A4" . equals ( tag ) ) {
141135 if ("" .equals (author )) {
142136 author = value ;
143137 } else {
144138 author += " and " + value ;
145139 }
146- } else if ("A2" . equals ( tag ) || "A3" . equals ( tag ) || "A4 " .equals (tag )) {
140+ } else if ("ED " .equals (tag )) {
147141 if (editor .isEmpty ()) {
148142 editor = value ;
149143 } else {
@@ -161,7 +155,7 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException {
161155 fields .put ("caption" , value );
162156 } else if ("DB" .equals (tag )) {
163157 fields .put ("database" , value );
164- } else if ("IS" .equals (tag )) {
158+ } else if ("IS" .equals (tag ) || "AN" . equals ( tag ) || "C7" . equals ( tag ) || "M1" . equals ( tag ) ) {
165159 fields .put (FieldName .NUMBER , value );
166160 } else if ("SP" .equals (tag )) {
167161 startPage = value ;
@@ -171,7 +165,7 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException {
171165 } else {
172166 fields .put (FieldName .PUBLISHER , value );
173167 }
174- } else if ("AD" .equals (tag ) || "CY" .equals (tag )) {
168+ } else if ("AD" .equals (tag ) || "CY" .equals (tag ) || "PP" . equals ( tag ) ) {
175169 fields .put (FieldName .ADDRESS , value );
176170 } else if ("EP" .equals (tag )) {
177171 endPage = value ;
@@ -191,9 +185,9 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException {
191185 } else {
192186 fields .put (FieldName .ABSTRACT , oldAb + OS .NEWLINE + value );
193187 }
194- } else if ("UR" .equals (tag )) {
188+ } else if ("UR" .equals (tag ) || "L2" . equals ( tag ) || "LK" . equals ( tag ) ) {
195189 fields .put (FieldName .URL , value );
196- } else if (("Y1" .equals (tag ) || "PY" .equals (tag ) || "DA" .equals (tag )) && (value .length () >= 4 )) {
190+ } else if (("Y1" .equals (tag ) || "Y2" . equals ( tag ) || " PY" .equals (tag ) || "DA" .equals (tag )) && (value .length () >= 4 )) {
197191 fields .put (FieldName .YEAR , value .substring (0 , 4 ));
198192 String [] parts = value .split ("/" );
199193 if ((parts .length > 1 ) && !parts [1 ].isEmpty ()) {
@@ -216,12 +210,39 @@ public ParserResult importDatabase(BufferedReader reader) throws IOException {
216210 comment = comment + " " ;
217211 }
218212 comment = comment + value ;
213+ } else if ("M3" .equals (tag ) || "DO" .equals (tag )) {
214+ addDoi (fields , value );
215+ } else if ("C3" .equals (tag )) {
216+ fields .put (FieldName .EVENTTITLE , value );
217+ } else if ("N1" .equals (tag ) || "RN" .equals (tag )) {
218+ fields .put (FieldName .NOTE , value );
219+ } else if ("ST" .equals (tag )) {
220+ fields .put (FieldName .SHORTTITLE , value );
221+ } else if ("C2" .equals (tag )) {
222+ fields .put (FieldName .EPRINT , value );
223+ fields .put (FieldName .EPRINTTYPE , "pubmed" );
224+ } else if ("TA" .equals (tag )) {
225+ fields .put (FieldName .TRANSLATOR , value );
219226 }
220- // Added ID import 2005.12.01, Morten Alver:
221- else if ("ID" .equals (tag )) {
227+ // fields for which there is no direct mapping in the bibtext standard
228+ else if ("AV" .equals (tag )) {
229+ fields .put ("archive_location" , value );
230+ } else if ("CN" .equals (tag ) || "VO" .equals (tag )) {
231+ fields .put ("call-number" , value );
232+ } else if ("DB" .equals (tag )) {
233+ fields .put ("archive" , value );
234+ } else if ("NV" .equals (tag )) {
235+ fields .put ("number-of-volumes" , value );
236+ } else if ("OP" .equals (tag )) {
237+ fields .put ("original-title" , value );
238+ } else if ("RI" .equals (tag )) {
239+ fields .put ("reviewed-title" , value );
240+ } else if ("RP" .equals (tag )) {
241+ fields .put ("status" , value );
242+ } else if ("SE" .equals (tag )) {
243+ fields .put ("section" , value );
244+ } else if ("ID" .equals (tag )) {
222245 fields .put ("refid" , value );
223- } else if ("M3" .equals (tag ) || "DO" .equals (tag )) {
224- addDoi (fields , value );
225246 }
226247 }
227248 // fix authors
@@ -245,11 +266,11 @@ else if ("ID".equals(tag)) {
245266
246267 // create one here
247268 // type is set in the loop above
248- BibEntry b = new BibEntry (type );
249- b .setField (fields );
269+ BibEntry entry = new BibEntry (type );
270+ entry .setField (fields );
250271 // month has a special treatment as we use the separate method "setMonth" of BibEntry instead of directly setting the value
251- month .ifPresent (parsedMonth -> b .setMonth (parsedMonth ));
252- bibitems .add (b );
272+ month .ifPresent (parsedMonth -> entry .setMonth (parsedMonth ));
273+ bibitems .add (entry );
253274
254275 }
255276 return new ParserResult (bibitems );
0 commit comments