Class BibTeXConverter


  • public class BibTeXConverter
    extends java.lang.Object

    Converts BibTeX items to CSL citation items

    The class maps BibTeX attributes to CSL attributes. The mapping is based on the one used in Docear as presented by Joeran Beel.

    Docear is released under the GPLv2 but its code may also be reused in projects licensed under Apache License 2.0 (see http://www.docear.org/software/licence/, last visited 2013-09-06). The mapping here is released under the Apache License 2.0 by permission of Joaran Beel, Docear.

    Author:
    Joaran Beel, Michel Kraemer
    • Constructor Summary

      Constructors 
      Constructor Description
      BibTeXConverter()
      Default constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.jbibtex.BibTeXDatabase loadDatabase​(java.io.InputStream is)
      Loads a BibTeX database from a stream.
      java.util.Map<java.lang.String,​CSLItemData> toItemData​(org.jbibtex.BibTeXDatabase db)
      Converts the given database to a map of CSL citation items
      CSLItemData toItemData​(org.jbibtex.BibTeXEntry e)
      Converts a BibTeX entry to a citation item
      CSLType toType​(org.jbibtex.Key type)
      Converts a BibTeX type to a CSL type
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BibTeXConverter

        public BibTeXConverter()
        Default constructor
    • Method Detail

      • loadDatabase

        public org.jbibtex.BibTeXDatabase loadDatabase​(java.io.InputStream is)
                                                throws org.jbibtex.ParseException

        Loads a BibTeX database from a stream.

        This method does not close the given stream. The caller is responsible for closing it.

        Parameters:
        is - the input stream to read from
        Returns:
        the BibTeX database
        Throws:
        org.jbibtex.ParseException - if the database is invalid
      • toItemData

        public java.util.Map<java.lang.String,​CSLItemData> toItemData​(org.jbibtex.BibTeXDatabase db)
        Converts the given database to a map of CSL citation items
        Parameters:
        db - the database
        Returns:
        a map consisting of citation keys and citation items
      • toItemData

        public CSLItemData toItemData​(org.jbibtex.BibTeXEntry e)
        Converts a BibTeX entry to a citation item
        Parameters:
        e - the BibTeX entry to convert
        Returns:
        the citation item
      • toType

        public CSLType toType​(org.jbibtex.Key type)
        Converts a BibTeX type to a CSL type
        Parameters:
        type - the type to convert
        Returns:
        the converted type (never null, falls back to CSLType.ARTICLE)