edu.ucsb.adl.bucket99
Interface Vocabulary

All Known Implementing Classes:
DatabaseCodedVocabulary

public interface Vocabulary

A vocabulary of terms. The Python query translator creates a vocabulary for a hierarchical bucket by dynamically loading the vocabulary class and calling the following class method:

public static Vocabulary createVocabulary (
    ExtendedProperties propertyList, String prefix)
Vocabulary startup parameters can be obtained from propertyList. If prefix is P, it is recommended that the names of vocabulary-specific startup parameters be prefixed with "P.".

Implementing classes need not be multithread-safe.

Version:
$Header: /export/home/gjanee/bucket99/edu/ucsb/adl/bucket99/RCS/Vocabulary.java,v 1.2 2004/09/23 17:10:21 gjanee Exp $

$Log: Vocabulary.java,v $ Revision 1.2 2004/09/23 17:10:21 gjanee
Minor documentation change.

Revision 1.1 2000/10/15 02:36:01 gjanee
Initial revision

Author:
Greg Janée
Alexandria Digital Library

Method Summary
 void destroy()
          Frees any resources held by the vocabulary.
 java.lang.String getBucket()
          Returns the bucket the vocabulary is used for.
 java.lang.String getName()
          Returns the vocabulary's name.
 boolean isValidTerm(java.lang.String term)
          Tests if a term is a valid term in the vocabulary.
 java.lang.Object translateTerm(java.lang.String term)
          Translates a term into a form suitable for query translation.
 

Method Detail

getName

public java.lang.String getName()
Returns the vocabulary's name.

Returns:
The vocabulary's name, e.g., "ADL Feature Type Thesaurus".

getBucket

public java.lang.String getBucket()
Returns the bucket the vocabulary is used for.

Returns:
The bucket name, e.g., "types".

isValidTerm

public boolean isValidTerm(java.lang.String term)
                    throws InternalErrorException
Tests if a term is a valid term in the vocabulary.

Parameters:
term - The term.
Returns:
true if the term is valid.
Throws:
InternalErrorException - If an error occurs.

translateTerm

public java.lang.Object translateTerm(java.lang.String term)
                               throws InternalErrorException
Translates a term into a form suitable for query translation. The form is unspecified by this interface; rather, it must be coordinated between the implementing class and the Python translation script.

Parameters:
term - The term.
Returns:
The term in translated form, or null if the term is invalid.
Throws:
InternalErrorException - If an error occurs.

destroy

public void destroy()
Frees any resources held by the vocabulary.