org.biojava.bibliography
Interface BibRefSupport


public interface BibRefSupport

This interface defines supporting utilities for working with bibliographic repositories.

The fundamental part of this interface deals with the controlled vocabularies. However, the BibRefSupport interface is here just a gateway to other Java interfaces defined in a separate package org.biojava.utils.candy.

The controlled vocabularies are used in order to find names of all available attributes of the given bibliographic repository, to find all possible values of some attributes, and to specify availability of the ordering and searching criteria. Here belong methods getVocabularyFinder, getSupportedValues, and getSupportedCriteria.

The other raison d'etre for the BibRefSupport interface is to have a place where some common constants can be put in. The constants specify common vocabulary names (examples are RESOURCE_TYPES or JOURNAL_TITLES, explicitly defined bibliographic resource types (for example, TYPE_BOOK or TYPE_ARTICLE), and few other things.

And finally, there are some methods allowing to improve an efficient access to the supporting resources by calling explicitly connect and disconnect.

It was an intention to separate completely methods dealing with bibliographic repositories (as defined in interface BibRefQuery) and methods helping with other things (as defined here). This box of bricks approach helps to use different communication protocols for bibliographic and supporting repositories. For example, the performance can be sometimes improved when the client loads separately all controlled vocabularies and use them locally while the access to the bibliographic repository is still remote.

The implementation is advised to used the following constructor

    public NameOfAnImplementation (String[] args, Hashtable props) {...}
where both args and props contain implementation specific parameters and properties. However, some properties are more probable to be used - the suggested names for them are defined also in this interface (e.g. INIT_PROP_LOG).

The use of this constructor makes easier to load dynamically different supporting implementations.

Version:
$Id: BibRefSupport.java,v 1.2 2002/02/14 16:27:54 mrp Exp $
Author:
Martin Senger

Field Summary
static java.lang.String ATTR_FORMAT
          A vocabulary name, or a part of a vocabulary name.
static java.lang.String ATTR_PROPERTIES
           A part of a vocabulary name.
static java.lang.String ATTR_SCOPE
          A vocabulary name, or a part of a vocabulary name.
static java.lang.String ENTRY_PROPERTIES
          A vocabulary name.
static java.lang.String GENERIC_PROVIDER
          A name of a provider type.
static java.lang.String INIT_PROP_LOG
           A property name ("log").
static java.lang.String INIT_PROP_SUPPORT
           A property name ("bibrefsupport").
static java.lang.String JOURNAL_ABBREV
          A vocabulary name.
static java.lang.String JOURNAL_TITLES
          A vocabulary name.
static java.lang.String LANGUAGES
          A vocabulary name.
static java.lang.String PROVIDER_ORGANISATION
          A name of a provider type.
static java.lang.String PROVIDER_PERSON
          A name of a provider type.
static java.lang.String PROVIDER_SERVICE
          A name of a provider type.
static java.lang.String REPOSITORY_SUBSETS
          A vocabulary name.
static java.lang.String RESOURCE_TYPES
          A vocabulary name.
static java.lang.String ROLE_ATTR_QUERYABLE
           A role of an attribute.
static java.lang.String ROLE_ATTR_RETRIEVABLE
           A role of an attribute.
static java.lang.String SUBJECT_HEADINGS
          A vocabulary name.
static java.lang.String TYPE_ARTICLE
          A name of a bibliographic resource type.
static java.lang.String TYPE_BOOK
          A name of a bibliographic resource type.
static java.lang.String TYPE_BOOK_ARTICLE
          A name of a bibliographic resource type.
static java.lang.String TYPE_JOURNAL_ARTICLE
          A name of a bibliographic resource type.
static java.lang.String TYPE_PATENT
          A name of a bibliographic resource type.
static java.lang.String TYPE_PROCEEDING
          A name of a bibliographic resource type.
static java.lang.String TYPE_TECH_REPORT
          A name of a bibliographic resource type.
static java.lang.String TYPE_THESIS
          A name of a bibliographic resource type.
static java.lang.String TYPE_WEB_RESOURCE
          A name of a bibliographic resource type.
 
Method Summary
 void connect()
           It creates a connection to an object providing the supporting utilities, or/and it makes all necessary initialization steps needed for further communication.
 void disconnect()
          It closes connection with a utility object.
 BiblioCriterion[] getSupportedCriteria()
           It returns all supported searching and sorting criteria for the whole bibliographic repository.
 BiblioCriterion[] getSupportedCriteria(java.lang.String repositorySubset)
           It returns all supported searching and sorting criteria in the given repository subset.
 CandyVocabulary getSupportedValues(java.lang.String resourceType, java.lang.String attrName)
           It returns a controlled vocabulary containing all possible values of the attribute given in attrName in the context given in resourceType.
 CandyFinder getVocabularyFinder()
           It returns an object representing a central place where all controlled vocabularies can be received from and shared by all users.
 boolean isReady()
          It checks if a utility object is available.
 BibRefQuery union(BibRefQuery[] collections, java.util.Hashtable properties)
           It merges all given collections together.
 

Field Detail

RESOURCE_TYPES

public static final java.lang.String RESOURCE_TYPES
A vocabulary name. The vocabulary contains stringified names of all citation types stored in the repository. The names of types that are explicitly defined by this interface should be equal to the constant strings for types (such as TYPE_BOOK).

See Also:
Constant Field Values

REPOSITORY_SUBSETS

public static final java.lang.String REPOSITORY_SUBSETS
A vocabulary name. Some bibliographic repositories consist of several databases. Their list can be provided by this vocabulary.

See Also:
Constant Field Values

SUBJECT_HEADINGS

public static final java.lang.String SUBJECT_HEADINGS
A vocabulary name. The vocabulary contains available subject headings.

See Also:
Constant Field Values

LANGUAGES

public static final java.lang.String LANGUAGES
A vocabulary name. The vocabulary contains available languages used in BibRef.language and BiblioDescription.language.

See Also:
Constant Field Values

JOURNAL_TITLES

public static final java.lang.String JOURNAL_TITLES
A vocabulary name. The vocabulary contains journal titles as used in BiblioJournal.name.

See Also:
Constant Field Values

JOURNAL_ABBREV

public static final java.lang.String JOURNAL_ABBREV
A vocabulary name. The vocabulary contains journal abbreviations as used in BiblioJournal.abbreviation.

See Also:
Constant Field Values

ENTRY_PROPERTIES

public static final java.lang.String ENTRY_PROPERTIES
A vocabulary name. The vocabulary contains names of properties that characterize a citation as a repository/database record.

See Also:
Constant Field Values

TYPE_BOOK

public static final java.lang.String TYPE_BOOK
A name of a bibliographic resource type.

See Also:
Constant Field Values

TYPE_ARTICLE

public static final java.lang.String TYPE_ARTICLE
A name of a bibliographic resource type.

See Also:
Constant Field Values

TYPE_BOOK_ARTICLE

public static final java.lang.String TYPE_BOOK_ARTICLE
A name of a bibliographic resource type.

See Also:
Constant Field Values

TYPE_JOURNAL_ARTICLE

public static final java.lang.String TYPE_JOURNAL_ARTICLE
A name of a bibliographic resource type.

See Also:
Constant Field Values

TYPE_PATENT

public static final java.lang.String TYPE_PATENT
A name of a bibliographic resource type.

See Also:
Constant Field Values

TYPE_THESIS

public static final java.lang.String TYPE_THESIS
A name of a bibliographic resource type.

See Also:
Constant Field Values

TYPE_PROCEEDING

public static final java.lang.String TYPE_PROCEEDING
A name of a bibliographic resource type.

See Also:
Constant Field Values

TYPE_TECH_REPORT

public static final java.lang.String TYPE_TECH_REPORT
A name of a bibliographic resource type.

See Also:
Constant Field Values

TYPE_WEB_RESOURCE

public static final java.lang.String TYPE_WEB_RESOURCE
A name of a bibliographic resource type.

See Also:
Constant Field Values

PROVIDER_PERSON

public static final java.lang.String PROVIDER_PERSON
A name of a provider type.

See Also:
Constant Field Values

PROVIDER_ORGANISATION

public static final java.lang.String PROVIDER_ORGANISATION
A name of a provider type.

See Also:
Constant Field Values

PROVIDER_SERVICE

public static final java.lang.String PROVIDER_SERVICE
A name of a provider type.

See Also:
Constant Field Values

GENERIC_PROVIDER

public static final java.lang.String GENERIC_PROVIDER
A name of a provider type.

See Also:
Constant Field Values

ATTR_PROPERTIES

public static final java.lang.String ATTR_PROPERTIES

A part of a vocabulary name. It is usually coupled together with a bibliographic resource type to give a full vocabulary name. For example: JournalArticle/ATTR_PROPERTIES.

The vocabulary contains property names for the given resource type as defined in BibRef.properties.

See Also:
Constant Field Values

ATTR_SCOPE

public static final java.lang.String ATTR_SCOPE
A vocabulary name, or a part of a vocabulary name. The vocabulary contains all allowed keys in BiblioScope.properties.

See Also:
Constant Field Values

ATTR_FORMAT

public static final java.lang.String ATTR_FORMAT
A vocabulary name, or a part of a vocabulary name. The vocabulary contains all allowed keys in BibRef.format.

See Also:
Constant Field Values

ROLE_ATTR_QUERYABLE

public static final java.lang.String ROLE_ATTR_QUERYABLE

A role of an attribute.

The introspection mechanism (provided by using controlled vocabularies) allows to find what attributes are available in the repository. The attributes which can be used in query methods should be identified by putting this constant into their vocabulary entry (somewhere in the description field).

See Also:
Constant Field Values

ROLE_ATTR_RETRIEVABLE

public static final java.lang.String ROLE_ATTR_RETRIEVABLE

A role of an attribute.

The introspection mechanism (provided by using controlled vocabularies) allows to find what attributes are available in the repository. The attributes which can be used in retrieval methods should be identified by putting this constant into their vocabulary entry (somewhere in the description field).

See Also:
Constant Field Values

INIT_PROP_LOG

public static final java.lang.String INIT_PROP_LOG

A property name ("log").

Used for passing an instance dealing with logging.

See Also:
Constant Field Values

INIT_PROP_SUPPORT

public static final java.lang.String INIT_PROP_SUPPORT

A property name ("bibrefsupport").

Used for passing an instance of a class implementing this interface. It is recommended to pass this property, for example, in the constructor of an implementation of the BibRefQuery interace}.

See Also:
Constant Field Values
Method Detail

connect

public void connect()
             throws NestedException

It creates a connection to an object providing the supporting utilities, or/and it makes all necessary initialization steps needed for further communication.

However, there should be no need to call this method explicitly, the other methods should do it automatically before they need to use any supporting utility.

Throws:
NestedException - if the connection/initialization cannot be established

isReady

public boolean isReady()
It checks if a utility object is available. The semantic of availabledepends on the implementation.


disconnect

public void disconnect()
It closes connection with a utility object. Implementations may choose to use this method for freeing resources.


getVocabularyFinder

public CandyFinder getVocabularyFinder()
                                throws NestedException

It returns an object representing a central place where all controlled vocabularies can be received from and shared by all users.

The controlled vocabularies are used for finding names of all available attributes of the given bibliographic repository, for finding all possible values of some attributes, and for specifying availability of the ordering and searching criteria.

Returns:
an instance implementing CandyFinder interface
Throws:
NestedException - if the vocabulary finder cannot be found

getSupportedValues

public CandyVocabulary getSupportedValues(java.lang.String resourceType,
                                          java.lang.String attrName)
                                   throws NestedException

It returns a controlled vocabulary containing all possible values of the attribute given in attrName in the context given in resourceType. It is up to the implementation to define the context.

Specifically, for attrName equals to ATTR_PROPERTIES it returns a vocabulary containing attribute names available for the given citation type.

Parameters:
resourceType - is usually a name of a citation type (e.g. "Book", "JournalArticle"), see TYPE_BOOK, etc., but can define other contexts as well (e.g. "Person" as defined by constant PROVIDER_PERSON)
attrName - a name of an attribute whose values should be available from the returned vocabulary
Returns:
a controlled vocabulary
Throws:
NestedException - if there is no such vocabulary available, or something else wrong happened

getSupportedCriteria

public BiblioCriterion[] getSupportedCriteria()
                                       throws NestedException

It returns all supported searching and sorting criteria for the whole bibliographic repository.

Returns:
available criteria
Throws:
NestedException - if something bad happened
See Also:
getSupportedCriteria for a repository subset

getSupportedCriteria

public BiblioCriterion[] getSupportedCriteria(java.lang.String repositorySubset)
                                       throws NestedException

It returns all supported searching and sorting criteria in the given repository subset.

Parameters:
repositorySubset - a name of a repository subset as used in BiblioEntryStatus.repositorySubset, and as (possibly) defined in the controlled vocabulary REPOSITORY_SUBSETS
Returns:
available criteria
Throws:
NestedException - if there is no such repository subset, or something else wrong happened
See Also:
getSupportedCriteria regardless of repository subsets

union

public BibRefQuery union(BibRefQuery[] collections,
                         java.util.Hashtable properties)
                  throws NestedException

It merges all given collections together. The result should eliminate redundancy - which usually means removing the same citations.

The merging process can be influenced by specifying some properties (but they are not defined by this interface, they depend on the implementation).

Note that the merging is independent on the repository, or repositories where the collections come from. The main raison d'etre is actually to allow to merge collections from different repositories. But it opens the question what to do with the resulting collection (how to query it, for example, if it is a "virtual" collection). So it can be quite difficult to implement this method :-(.

Parameters:
collections - to be merged together
properties - define features how to do merging
Returns:
a merged collection
Throws:
NestedException - if merging failed (which may also happen when any of the collection is too large)