edu.uchsc.ccp.knowtator.textsource
Class TextSourceCollection

java.lang.Object
  extended by edu.uchsc.ccp.knowtator.textsource.TextSourceCollection
Direct Known Subclasses:
FileLinesTextSourceCollection, FileTextSourceCollection

public abstract class TextSourceCollection
extends Object

Authors: Philip V. Ogren Created: October, 2004 Description: Every extension of this class should have a corresponding extension of TextSource. Both extensions should be built together in parallel.


Field Summary
static String CLS_NAME
          Corresponds to the Protege class name of the text sources that are retrieved by this collection.
static String DISPLAY_NAME
          This is the name that is displayed when users are asked what type of text source collection they would like to access.
 
Constructor Summary
TextSourceCollection()
           
 
Method Summary
static void createCls(KnowledgeBase kb)
          This method ensures that the Protege cls definition corresponding to the text sources in this collection does exist.
abstract  TextSource find(Component parent)
           
abstract  TextSource get(int index)
           
abstract  TextSource get(String textSourceName)
           
abstract  int getIndex(TextSource textSource)
           
abstract  String getName()
           
abstract  TextSourceIterator iterator()
          provides an easy way for a script to iterate through all TextSources in a collection.
static TextSourceCollection open(Project project)
          This method should return the text source collection most recently opened by the provided project.
static TextSourceCollection open(Project project, Component parent)
           
abstract  void save(Project project)
          This method saves information about this text source collection to the Protege project.
abstract  TextSource select(Component parent)
           
abstract  int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLS_NAME

public static String CLS_NAME
Corresponds to the Protege class name of the text sources that are retrieved by this collection.


DISPLAY_NAME

public static String DISPLAY_NAME
This is the name that is displayed when users are asked what type of text source collection they would like to access.

Constructor Detail

TextSourceCollection

public TextSourceCollection()
Method Detail

iterator

public abstract TextSourceIterator iterator()
provides an easy way for a script to iterate through all TextSources in a collection.


getName

public abstract String getName()
Returns:
The name of the text source collection. Might correspond to the name of the directory, database or file that the text source collection accesses to get text sources.

size

public abstract int size()

get

public abstract TextSource get(int index)
                        throws TextSourceAccessException
Throws:
TextSourceAccessException

get

public abstract TextSource get(String textSourceName)
                        throws TextSourceAccessException
Returns:
the text source that has the given name. A text source collection should have no name collisions.
Throws:
TextSourceAccessException

getIndex

public abstract int getIndex(TextSource textSource)
Returns:
-1 if text source does not exist.

select

public abstract TextSource select(Component parent)
Returns:
a TextSource selected by a human user through a user interface. Implementations of this method might provide a dialog with a list of available text sources.

find

public abstract TextSource find(Component parent)
Returns:
a TextSource selected by a human user through a user interface. Implementations of this method might provide a dialog with a text field that requires the user to enter the name of a text source or some text that s/he is looking for.

save

public abstract void save(Project project)
This method saves information about this text source collection to the Protege project. The information saved should be sufficient to reinstantiate this text source collection the next time Protege is started.


open

public static TextSourceCollection open(Project project)
This method should return the text source collection most recently opened by the provided project. This method is called when Knowtator is initiated. This method eliminates the need for the user to open the same text source collection every time s/he opens Knowtator.

Returns:
null if recent text source collection cannot be opened.

open

public static TextSourceCollection open(Project project,
                                        Component parent)
Returns:
a text source collection chosen by a human user through a user interface. Implementations of this method might provide a FileChooser, a dialog with database connection settings, etc.

createCls

public static void createCls(KnowledgeBase kb)
This method ensures that the Protege cls definition corresponding to the text sources in this collection does exist. If not, it creates the appropriate cls. Implementors of this class should first check the kb to make sure that the class does not already exist.