org.opentox.toxotis.core.component
Class BibTeX

java.lang.Object
  extended by org.opentox.toxotis.core.OTComponent<T>
      extended by org.opentox.toxotis.core.OTOnlineResource<T>
          extended by org.opentox.toxotis.core.OTPublishable<BibTeX>
              extended by org.opentox.toxotis.core.component.BibTeX
All Implemented Interfaces:
Serializable, IHTMLSupport, IOnlineResource, IOTComponent, IStAXWritable

public class BibTeX
extends OTPublishable<BibTeX>
implements IHTMLSupport

Bibliographic reference designed according to the BibTeX specifications. OpenTox resource are pointing to bibliographic entries (articles, conferences etc) using the Knouf ontology. Part of the JavaDoc documentation in this class has been fetched from the manual: BibTeXing The original manual (1988) by the co-author of BibTeX, Oren Patashnik.. You can find more information about BibTeX at en.wikipedia.org/wiki/BibTeX.

Author:
Pantelis Sopasakis, Charalampos Chomenides
See Also:
Knouf Ontology, Serialized Form

Nested Class Summary
static class BibTeX.BibTYPE
          Enumeration for bibliographic types supported by the Knouf ontology.
 
Field Summary
 
Fields inherited from class org.opentox.toxotis.core.OTOnlineResource
XSD_DATATYPE_LINKS
 
Fields inherited from class org.opentox.toxotis.core.OTComponent
meta, RDF_ABOUT, RDF_RDF, RDF_RESOURCE, RDF_TYPE
 
Constructor Summary
BibTeX()
          Empty constructor for BibTeX objects.
BibTeX(VRI uri)
          Create a new BibTeX object with specified URI.
 
Method Summary
 com.hp.hpl.jena.ontology.Individual asIndividual(com.hp.hpl.jena.ontology.OntModel model)
          The OpenTox component as an individual.
 String getAbstract()
          The abstract of the BibTeX object.
 String getAddress()
          Usually the address of the publisher or other type of institution.
 String getAnnotation()
          An annotation.
 String getAuthor()
          The name(s) of the author(s), in the format described in the LaTeX book.
 VRI getBibTexService()
          The bibtex service.
 BibTeX.BibTYPE getBibType()
          The bibliographic type.
 String getBookTitle()
          Title of a book, part of which is being cited.
 String getChapter()
          A chapter (or section or whatever) number.
 String getCopyright()
           
 User getCreatedBy()
          The user that created the BibTeX object.
 String getCrossref()
          The database key of the entry being cross referenced.
 String getEdition()
          The edition of a book—for example, "Second".
 String getEditor()
          Name(s) of editor(s), typed as indicated in the LaTeX book.
 String getIsbn()
          The ISBN of the resource.
 String getIssn()
          The ISSN of the resource.
 String getJournal()
          A journal name.
 String getKey()
          Used for alphabetizing, cross referencing, and creating a label when the "author" information (described in Section 4) is missing.
 String getKeywords()
          A list of keywords separated by any custom delimiter.
 Integer getNumber()
          The number of a journal, magazine, technical report, or of a work in a series.
 String getPages()
          One or more page numbers or range of numbers, such as 42--111 or 7,41,73--97 or 43+ (the ‘+’ in this last example indicates pages following that don’t form a simple range).
 String getPlainText()
          Deprecated.  
 String getSeries()
          The name of a series or set of books.
 String getTitle()
          The work’s title, typed as explained in the LaTeX book.
 String getUrl()
          A URL where more information about the work described by this BibTeX can be found.
 Integer getVolume()
          The volume of a journal or multivolume book.
 Integer getYear()
          The year of publication or, for an unpublished work, the year it was written.
 HTMLContainer inHtml()
          Create an HTML container for the online resource.
protected  BibTeX loadFromRemote(VRI uri, AuthenticationToken token)
          Loads an OpenTox component from a remote location identified by its uri and parses it into an instance of T.
 Task publishOnline(AuthenticationToken token)
          Publishes the BibTeX object to the bibtex service that corresponds to the URI that is returned by the method getUri().
 Task publishOnline(VRI vri, AuthenticationToken token)
          Publish the component to a proper server identified by the uri of the publishing service provided in this method.
 BibTeX readString(File bibFile)
          Reads from a file and parses a BibTeX document into an instance of BibTeX.
 BibTeX readString(InputStream iStream)
          Create a new BibTeX resource from its String representation.
 BibTeX readString(Reader reader)
          Create a new BibTeX resource from its String representation.
 BibTeX readString(String string)
          Create a new BibTeX resource from its String representation.
 BibTeX setAbstract(String theAbstract)
          Setter method for the abstract.
 BibTeX setAddress(String address)
          Setter method for the address of the publisher or other type of institution.
 BibTeX setAnnotation(String annotation)
          Setter method for the annotation.
 BibTeX setAuthor(String author)
          Setter method for the author(s).
 BibTeX setBibType(BibTeX.BibTYPE bibType)
          Setter for the bibliographic type.
 BibTeX setBookTitle(String bookTitle)
          Setter method for the bookTitle.
 BibTeX setChapter(String chapter)
          Setter method for the chapter of the BibTeX resource.
 BibTeX setCopyright(String copyright)
          Setter method for the copyright notice of the BibTeX resource.
 void setCreatedBy(User createdBy)
          Sets the user who created the current BibTeX object.
 BibTeX setCrossref(String crossref)
          Setter method for the cross-ref of this BibTeX resource.
 BibTeX setEdition(String edition)
          Setter for the edition.
 BibTeX setEditor(String editor)
          Setter for the editor(s).
 BibTeX setIsbn(String isbn)
          Setter method for the ISBN.
 BibTeX setIssn(String issn)
          Setter method for the ISSN.
 BibTeX setJournal(String journal)
          Setter for the journal name.
 BibTeX setKey(String key)
          Setter for the variable key.
 BibTeX setKeywords(String keywords)
          Set a list of keywords separated by any custom delimiter.
 BibTeX setNumber(Integer number)
          Setter method for the number of the current BibTeX object.
 BibTeX setPages(String pages)
          Setter method for the pages of the current BibTeX object.
 BibTeX setSeries(String series)
          Setter method for the series of the BibTeX entry.
 BibTeX setTitle(String title)
          Setter method for the title.
 BibTeX setUrl(String url)
           
 BibTeX setVolume(Integer volume)
          Setter method for the volume of a journal or multivolume book.
 BibTeX setYear(Integer year)
          Set the year of publication.
 String toString()
           
 void writeRdf(XMLStreamWriter writer)
          Due to the large size of some objects like datasets, it is advisable to use this method for serializing large objects to RDF/XML rather than the method OntModel#write(OutputStream).
 
Methods inherited from class org.opentox.toxotis.core.OTPublishable
publish, publish
 
Methods inherited from class org.opentox.toxotis.core.OTOnlineResource
download, download, download, download, downloadImage, loadFromRemote, loadFromRemote
 
Methods inherited from class org.opentox.toxotis.core.OTComponent
addOntologicalClasses, asOntModel, endRdfWriter, equals, getMeta, getOntologicalClasses, getUri, hashCode, initRdfWriter, isEnabled, setEnabled, setMeta, setOntologicalClasses, setUri, writeAnnotationProperty, writeClass, writeDatatypeProperty, writeMetaDataProperties, writeObjectProperty, writeRdf, writeRdf, writeSuperClassRelationships
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opentox.toxotis.core.IOTComponent
addOntologicalClasses, asOntModel, getMeta, getOntologicalClasses, getUri, isEnabled, setEnabled, setMeta, setOntologicalClasses
 

Constructor Detail

BibTeX

public BibTeX()
Empty constructor for BibTeX objects.


BibTeX

public BibTeX(VRI uri)
       throws ToxOtisException
Create a new BibTeX object with specified URI.

Parameters:
uri - URI of the BibTeX.
Throws:
ToxOtisException - If the provided URI is not a valid BibTeX URI.
Method Detail

getCreatedBy

public User getCreatedBy()
The user that created the BibTeX object.

Returns:
Instance of User

setCreatedBy

public void setCreatedBy(User createdBy)
Sets the user who created the current BibTeX object.

Parameters:
createdBy - Instance of User

getAbstract

public String getAbstract()
The abstract of the BibTeX object.

Returns:

setAbstract

public BibTeX setAbstract(String theAbstract)
Setter method for the abstract.

Parameters:
theAbstract - The abstract as a String.
Returns:
The current modifiable instance of BibTeX with the updated abstract.

getAuthor

public String getAuthor()
The name(s) of the author(s), in the format described in the LaTeX book.

Returns:
Name(s) of authors as String.

setAuthor

public BibTeX setAuthor(String author)
Setter method for the author(s).

Parameters:
author - The list of authors or the single author as a String.
Returns:
The current modifiable instance of BibTeX with the updated author.
See Also:
#getAuthor

getBibType

public BibTeX.BibTYPE getBibType()
The bibliographic type.

Returns:
The bibliographic type of the current BibTeX object as an instance of BIB_TYPE .

setBibType

public BibTeX setBibType(BibTeX.BibTYPE bibType)
Setter for the bibliographic type.

Parameters:
bibType - The bibliographic type you need to specify.
Returns:
The current modifiable instance of BibTeX with the updated value of bibtype.
See Also:
getBibType()

getBookTitle

public String getBookTitle()
Title of a book, part of which is being cited. See the LaTeX book for how to type titles. For book entries, use the title field instead.

Returns:
The booktitle as String.

setBookTitle

public BibTeX setBookTitle(String bookTitle)
Setter method for the bookTitle.

Parameters:
bookTitle - The bookTitle as a String.
Returns:
The current modifiable instance of BibTeX with the updated bookTitle.

getChapter

public String getChapter()
A chapter (or section or whatever) number.

Returns:
The chapter title/number as a String.

setChapter

public BibTeX setChapter(String chapter)
Setter method for the chapter of the BibTeX resource.

Parameters:
chapter - The chapter as a String.
Returns:
The current modifiable instance of BibTeX with the updated chapter parameter.

getCopyright

public String getCopyright()

setCopyright

public BibTeX setCopyright(String copyright)
Setter method for the copyright notice of the BibTeX resource.

Parameters:
copyright - The copyright notice as a String.
Returns:
The current modifiable instance of BibTeX with the updated copyright parameter.

getCrossref

public String getCrossref()
The database key of the entry being cross referenced. A URI of some other BibTeX resource should be ideal for a cross-reference.

Returns:
Cross-reference to some other BibTeX resource or piece of work.

setCrossref

public BibTeX setCrossref(String crossref)
Setter method for the cross-ref of this BibTeX resource. A URI of some other BibTeX entity should be ideally provided.

Parameters:
crossref - The chapter as a String.
Returns:
The current modifiable instance of BibTeX with the updated cross-ref.

getEdition

public String getEdition()
The edition of a book—for example, "Second". This should be an ordinal, and should have the first letter capitalized, as shown here; the standard styles convert to lower case when necessary.

Returns:
The edition of the BibTeX object.

setEdition

public BibTeX setEdition(String edition)
Setter for the edition.

Parameters:
edition -
Returns:
The current modifiable BibTeX object updated with the value of edition.
See Also:
getEdition()

getEditor

public String getEditor()
Name(s) of editor(s), typed as indicated in the LaTeX book. If there is also an author field, then the editor field gives the editor of the book or collection in which the reference appears.

Returns:
Editor(s) as String.

setEditor

public BibTeX setEditor(String editor)
Setter for the editor(s).

Parameters:
edition -
Returns:
The current modifiable BibTeX object updated with the value of editor(s).
See Also:
getEditor()

getIsbn

public String getIsbn()
The ISBN of the resource. ISBNs now come in two styles, containing 10 digits or 13 digits, respectively (corresponding to the above "ISBN-10:" and "ISBN-13:" numbers). Please use the 13-digit one if available (if nowhere else, it is written under the barcode: the hyphenation will be 978-, or in the future 979-, then the same as in the 10-digit ISBN, but the last digit is different for ISBN-10 and ISBN-13, as they use different checksum algorithms).

Returns:
The ISBN of the current BibTeX object as a String.

setIsbn

public BibTeX setIsbn(String isbn)
Setter method for the ISBN.

Parameters:
isbn - The ISBN.
Returns:
The current BibTeX instance with updated ISBN.
See Also:
#getIsbn()

getIssn

public String getIssn()
The ISSN of the resource. An International Standard Serial Number (ISSN) is a unique eight-digit number used to identify a print or electronic periodical publication. Periodicals published in both print and electronic form may have two ISSNs, a print ISSN (p-ISSN) and an electronic ISSN (e-ISSN or eISSN). The ISSN system was first drafted as an ISO international standard in 1971 and published as ISO 3297 in 1975. The ISO subcommittee TC 46/SC 9 is responsible for the standard.

Returns:
The ISSN of the current BibTeX object as a String.

setIssn

public BibTeX setIssn(String issn)
Setter method for the ISSN.

Parameters:
issn - The ISSN.
Returns:
The current BibTeX instance with updated ISSN.
See Also:
#getIssn()

getJournal

public String getJournal()
A journal name. Abbreviations are provided for many journals; see the Local Guide.

Returns:
The journal name as a String.

setJournal

public BibTeX setJournal(String journal)
Setter for the journal name.

Parameters:
journal - Name of the journal.
Returns:
The current BibTeX instance with updated journal.
See Also:
getJournal()

getKey

public String getKey()
Used for alphabetizing, cross referencing, and creating a label when the "author" information (described in Section 4) is missing. This field should not be confused with the key that appears in the \cite command and at the beginning of the database entry.

Returns:

setKey

public BibTeX setKey(String key)
Setter for the variable key.

Parameters:
key - The key.
Returns:
The current object with updated value of key.
See Also:
getKey()

getKeywords

public String getKeywords()
A list of keywords separated by any custom delimiter.

Returns:
List of keywords as a single string.

setKeywords

public BibTeX setKeywords(String keywords)
Set a list of keywords separated by any custom delimiter.

Parameters:
keywords - Keywords.
Returns:
The current object with updated value of keywords.

getNumber

public Integer getNumber()
The number of a journal, magazine, technical report, or of a work in a series. An issue of a journal or magazine is usually identified by its volume and number; the organization that issues a technical report usually gives it a number; and sometimes books are given numbers in a named series.

Returns:
The number of the current BibTeX object.

setNumber

public BibTeX setNumber(Integer number)
Setter method for the number of the current BibTeX object.

Parameters:
number - The number as Integer.
Returns:
The current modifiable BibTeX object updated number.
See Also:
getNumber()

getPages

public String getPages()
One or more page numbers or range of numbers, such as 42--111 or 7,41,73--97 or 43+ (the ‘+’ in this last example indicates pages following that don’t form a simple range). To make it easier to maintain Scribe- compatible databases, the standard styles convert a single dash (as in 7-33) to the double dash used in TEX to denote number ranges (as in 7--33).

Returns:
Pages as String.

setPages

public BibTeX setPages(String pages)
Setter method for the pages of the current BibTeX object.

Parameters:
pages - Pages as String
Returns:
The current modifiable BibTeX object updated pages.
See Also:
getPages()

getVolume

public Integer getVolume()
The volume of a journal or multivolume book.

Returns:
The volume as Integer.

setVolume

public BibTeX setVolume(Integer volume)
Setter method for the volume of a journal or multivolume book.

Parameters:
volume - The volume as Integer.
Returns:
The current modifiable BibTeX object updated volume.

getYear

public Integer getYear()
The year of publication or, for an unpublished work, the year it was written. Generally it should consist of four numerals, such as 1984. This method returns the year as Integer.

Returns:
The year of publication/inception as Integer.

setYear

public BibTeX setYear(Integer year)
Set the year of publication. The year is provided as an instance of Integer. If the supplied value is null, or not-null but non-positive, then no value is stored in the corresponding field.

Parameters:
year - The year of publication for the BibTeX provided as an Integer object.
Returns:
The current updated BibTeX object.

getAddress

public String getAddress()
Usually the address of the publisher or other type of institution. For major publishing houses, van Leunen recommends omitting the information entirely. For small publishers, on the other hand, you can help the reader by giving the complete address.

Returns:
The address as String.

setAddress

public BibTeX setAddress(String address)
Setter method for the address of the publisher or other type of institution. For major publishing houses, it is preferable to omit the information entirely. For other smaller publishers, you can help the reader by giving the complete address.

Parameters:
address - The address as a simple String.
Returns:
The current modifiable BibTeX object updated address.

getAnnotation

public String getAnnotation()
An annotation. It is not used by the standard bibliography styles, but may be used by others that produce an annotated bibliography.

Returns:
Annotation as String.

setAnnotation

public BibTeX setAnnotation(String annotation)
Setter method for the annotation.

Parameters:
annotation - The annotation as String.
Returns:
The current modifiable BibTeX object updated annotation.
See Also:
getAnnotation()

getSeries

public String getSeries()
The name of a series or set of books. When citing an entire book, the the title field gives its title and an optional series field gives the name of a series or multi-volume set in which the book is published.

Returns:
The series as String.

setSeries

public BibTeX setSeries(String series)
Setter method for the series of the BibTeX entry.

Parameters:
series - Series as String.
Returns:
The current modifiable BibTeX object updated series.

getTitle

public String getTitle()
The work’s title, typed as explained in the LaTeX book.

Returns:
The title as String.

setTitle

public BibTeX setTitle(String title)
Setter method for the title.

Parameters:
title - The title as String.
Returns:
The current modifiable BibTeX object updated title.

getUrl

public String getUrl()
A URL where more information about the work described by this BibTeX can be found. Usually, it is the URL where someone may find the actual resource.

Returns:
URL as String.

setUrl

public BibTeX setUrl(String url)
Parameters:
url - The URL of the BibTeX actual document.
Returns:
The current modifiable BibTeX object updated annotation.

getBibTexService

public VRI getBibTexService()
The bibtex service.

Returns:
The BibTeX service as a URI.

loadFromRemote

protected BibTeX loadFromRemote(VRI uri,
                                AuthenticationToken token)
                         throws ServiceInvocationException
Description copied from class: OTOnlineResource
Loads an OpenTox component from a remote location identified by its uri and parses it into an instance of T. This method is protected and should be implemented by all subclasses of OTOnlineResource. The method is invoked by its public counterpart OTOnlineResource.loadFromRemote(org.opentox.toxotis.util.aa.AuthenticationToken) which accesses the remote location providing an authentication token.

Specified by:
loadFromRemote in class OTOnlineResource<BibTeX>
Parameters:
uri - Identifier of the location from where the component should be downloaded and parsed
token - Token provided
Returns:
Parsed instance of the component.
Throws:
ServiceInvocationException

publishOnline

public Task publishOnline(VRI vri,
                          AuthenticationToken token)
                   throws ServiceInvocationException
Description copied from class: OTPublishable
Publish the component to a proper server identified by the uri of the publishing service provided in this method. The resource will be posted to the server in RDF format (application/rdf+xml).

Specified by:
publishOnline in class OTPublishable<BibTeX>
Parameters:
vri - URI of the service that is responsible for the publication of this kind of resources.
token - Provide an authentication token. If you think that the service does not require auhtentication/authorization, you can leave this field null or you can provide an empty authentication token. If the provided URI already contains an authentication token (as the URL parameter tokenid) it will be replaced by the new token provided to this method.
Returns:
A Task for monitoring the progress of your request. If the service returns the URI of the resource right away and does not return a task, then the object you will receive from this method will now have an identifier, its status will be set to Completed, its progress will be set to 100% and the URI of the created resource will be available applying the method Task.getResultUri() on the returned task. In any case, the service's response will be wrapped in a Task object.
Throws:
ServiceInvocationException

publishOnline

public Task publishOnline(AuthenticationToken token)
                   throws ServiceInvocationException
Publishes the BibTeX object to the bibtex service that corresponds to the URI that is returned by the method getUri().

Specified by:
publishOnline in class OTPublishable<BibTeX>
Parameters:
token - Provide an authentication token. If you think that the service does not require auhtentication/authorization, you can leave this field null or you can provide an empty authentication token.If the provided URI already contains an authentication token (as the URL parameter tokenid) it will be replaced by the new token provided to this method.
Returns:
A Task for monitoring the progress of your request. If the service returns the URI of the resource right away and does not return a task, then the object you will receive from this method will now have an identifier, its status will be set to Task.Status.COMPLETED, its progress will be set to 100% and the URI of the created resource will be available applying the method Task.getResultUri() on the returned task. In any case, the service's response will be wrapped in a Task object.
Throws:
ToxOtisException - In case of invalid credentials, if the POSTed resource is not acceptable by the remote service (returns a status code 400), communication error occur with the remote server or other connection problems or the access to the service was denied (401 or 403).
ServiceInvocationException - In case of invalid credentials, if the POSTed resource is not acceptable by the remote service (returns a status code 400), communication error occur with the remote server or other connection problems or the access to the service was denied (401 or 403).
See Also:
alternative method

writeRdf

public void writeRdf(XMLStreamWriter writer)
              throws XMLStreamException
Description copied from interface: IStAXWritable
Due to the large size of some objects like datasets, it is advisable to use this method for serializing large objects to RDF/XML rather than the method OntModel#write(OutputStream). In the case of Datasets, it has been shown that this method performs much faster (about 7,5 times faster on a dataset of 21 features and 1000 compounds).

Specified by:
writeRdf in interface IStAXWritable
Parameters:
writer - XML Stream Writer used for the serialization of the dataset object.
Throws:
XMLStreamException - In case the serialization is not possible due to syntax errors.

inHtml

public HTMLContainer inHtml()
Description copied from interface: IHTMLSupport
Create an HTML container for the online resource.

Specified by:
inHtml in interface IHTMLSupport
Returns:
HTMLContainer which can be used to create an HTML representation for the component.

getPlainText

@Deprecated
public String getPlainText()
Deprecated. 

Retained for backward compatibility with third party systems. Will be removed in some future distribution. Use toString() instead.

Returns:
Plain text representation of the BibTeX resource.

asIndividual

public com.hp.hpl.jena.ontology.Individual asIndividual(com.hp.hpl.jena.ontology.OntModel model)
Description copied from interface: IOTComponent
The OpenTox component as an individual.

Specified by:
asIndividual in interface IOTComponent
Parameters:
model - The ontological model to which the individual belongs.
Returns:
The OpenTox component as an individual of a data model.

toString

public String toString()
Overrides:
toString in class Object

readString

public BibTeX readString(String string)
                  throws ToxOtisException
Create a new BibTeX resource from its String representation. Parses the String representation of a BibTeX into an instance of BibTeX. Then you can use the methods defined in BibTeX to publish the BibTeX in some BibTeX service or create an RDF representation of it (using the Knouf ontology).

Parameters:
string - String representation of the BibTeX entity. The provided string is not expected to be URL encoded. In case it is, you should consider using a decoder (e.g. java.net.URLDecoder.
Returns:
Updated instance of BibTeX
Throws:
ToxOtisException - In case the provided string representation is not valid.

readString

public BibTeX readString(InputStream iStream)
                  throws ToxOtisException
Create a new BibTeX resource from its String representation. Parses the String representation of a BibTeX into an instance of BibTeX. Then you can use the methods defined in BibTeX to publish the BibTeX in some BibTeX service or create an RDF rerpesentation of it (using the Knouf ontology).

Parameters:
iStream - Input stream from which the string is read. Such an input stream might be pointing to a file or some remote locate (i.e. to a URL). Be warned that this method will not close the provided input stream which has to be closed from the outside.
Returns:
Updated instance of BibTeX
Throws:
ToxOtisException - In case the provided string representation is not valid.

readString

public BibTeX readString(Reader reader)
                  throws ToxOtisException
Create a new BibTeX resource from its String representation. Parses the String representation of a BibTeX into an instance of BibTeX. Then you can use the methods defined in BibTeX to publish the BibTeX in some BibTeX service or create an RDF representation of it (using the Knouf ontology).

Parameters:
reader - Reader used to acquire the String representation of the BibTeX. The method will not close the reader so users have to close is when needed.
Returns:
Updated instance of BibTeX
Throws:
ToxOtisException - In case the provided string representation is not valid.

readString

public BibTeX readString(File bibFile)
                  throws ToxOtisException
Reads from a file and parses a BibTeX document into an instance of BibTeX.

Parameters:
bibFile - A file pointing to a .bib file.
Returns:
The parsed BibTeX object.
Throws:
NullPointerException - If the specified bibfile is null.
ToxOtisException - If the file is not found, the exception is wrapped in a ToxOtisException and thrown as such. Also any other exceptional event is wrapped in a ToxOtisException.


Copyright © 2011-2012 OpenTox. All Rights Reserved.