Class TdbClassificationScheme

All Implemented Interfaces:
com.tietoenator.trip.jxp.internal.utils.DOMSink, TdbControlObjectProvider, Iterable<TdbCategory>

public class TdbClassificationScheme extends TdbMessageProvider implements com.tietoenator.trip.jxp.internal.utils.DOMSink, TdbControlObjectProvider, Iterable<TdbCategory>
Container and manipulation logic for a classification scheme container database
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor, creates a blank container
    Constructor, creates an object for the container referenced by the provided TdbControlObject
  • Method Summary

    Modifier and Type
    Method
    Description
    add(String name, String comment)
    Add a new category to the scheme.
    void
    classify(String data, List<TdbCategory> categories)
    Test classification with the container.
    void
    Create a new container
    void
    create(String name)
    Create a new container.
    void
    create(String name, int subsystem)
    Create a new container, using the specified subsystem.
    void
    create(String name, int subsystem, int max_items)
    Create a new container, using the specified subsystem.
    void
    Remove the current container from the server in its entirety.
    void
    delete(String name)
    Remove a container from the server in its entirety.
    void
    Finalize container training, whatever that means for the underlying subsystem.
    void
    get()
    Retrieve the properties of the current container, including the list of all categories defined within it.
    void
    get(String name)
    Retrieve the properties of a container, including the list of all categories defined within it.
    Retrieve the name of the algorithm, or classification subsystem, used to create the scheme
    getCategory(int id)
    Retrieve the category with the provided unique ID, if found.
    Retrieve the category with the provided name, if found.
    Retrieve the Control object reference with which this instance was constructed
    Retrieve any description associated with the scheme
    Retrieve the last date / time that the scheme was indexed
    Retrieve the last date / time that the scheme was updated
    Retrieve the location of the files that comprise the underlying storage of the scheme
    int
    Retrieve the maximum number of items that will be considered as training data for each category within the scheme
    Retrieve the name of the classification scheme
    int
    Retrieve the ID of the classification subsystem with which this scheme is associated
    void
    infer(String database, String fieldname)
    Infer classes and training data from a previous classified database.
    void
    infer(String database, String fieldname, int threshold)
    Infer classes and training data from a previous classified database.
    boolean
    Check if the scheme has been finalized if the subsystem in use by the scheme requires finalization; value is undefined if the subsystem does not require finalization.
    boolean
    Check if the calling user is the owner of the scheme
    Retrieve an iterator over the categories defined within the scheme
    void
    put()
    Store any saved attributes of the container, e.g.
    void
    Remove an existing category from the scheme
    remove(String name)
    Remove an existing category from the scheme
    void
    rename(String newname)
    Rename the current container.
    boolean
    Check whether this scheme requires special finalization in addition to the normal indexing process
    void
    setDescription(String description)
    Establish a description to be associated with the scheme
    void
    Establish the location (typically a logical name) where the files that comprise the underlying storage of the scheme should be placed
    void
    setMaxItems(int max)
    Establish the maximum number of items that will be considered as training data for each category within the scheme
    void
    Established the name of the classification scheme
    void
    Establish the ID of the classification subsystem with which this scheme is associated
    boolean
    Check whether this scheme supports hierarchical classification

    Methods inherited from class com.tietoenator.trip.jxp.TdbMessageProvider

    codeList, getLastCode, getLastMessage, hasMessages, messageList, resetMessages

    Methods inherited from class com.tietoenator.trip.jxp.session.TdbSessionObject

    cancel, getSession, isCancelable, setCancelable

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Constructor Details

    • TdbClassificationScheme

      public TdbClassificationScheme(TdbSession session, TdbControlObject ob) throws TdbException
      Constructor, creates an object for the container referenced by the provided TdbControlObject
      Parameters:
      session - Active session
      ob - Control object containing information about the container
      Throws:
      TdbException
    • TdbClassificationScheme

      public TdbClassificationScheme(TdbSession session) throws TdbException
      Constructor, creates a blank container
      Parameters:
      session - Active session
      Throws:
      TdbException
  • Method Details

    • getName

      public String getName()
      Retrieve the name of the classification scheme
      Returns:
      Classification scheme name
    • setName

      public void setName(String name)
      Established the name of the classification scheme
      Parameters:
      name - The name of the classification scheme
    • isOwner

      public boolean isOwner()
      Check if the calling user is the owner of the scheme
      Returns:
      true if the calling user is the owner of the scheme
    • getDescription

      public String getDescription()
      Retrieve any description associated with the scheme
      Returns:
      Scheme description, if any
    • setDescription

      public void setDescription(String description)
      Establish a description to be associated with the scheme
      Parameters:
      description - The scheme description
    • getSubsystemID

      public int getSubsystemID()
      Retrieve the ID of the classification subsystem with which this scheme is associated
      Returns:
      Subsystem unique ID
      See Also:
    • setSubsystemID

      public void setSubsystemID(int id)
      Establish the ID of the classification subsystem with which this scheme is associated
      Parameters:
      id - Subsystem unique ID
      See Also:
    • getControlObject

      public TdbControlObject getControlObject()
      Retrieve the Control object reference with which this instance was constructed
      Specified by:
      getControlObject in interface TdbControlObjectProvider
      Returns:
      Control object reference
    • iterator

      public Iterator<TdbCategory> iterator()
      Retrieve an iterator over the categories defined within the scheme
      Specified by:
      iterator in interface Iterable<TdbCategory>
      Returns:
      iterator for use with the "for-each" pattern
    • supportsHierarchy

      public boolean supportsHierarchy()
      Check whether this scheme supports hierarchical classification
      Returns:
      true / false
    • requiresFinalization

      public boolean requiresFinalization()
      Check whether this scheme requires special finalization in addition to the normal indexing process
      Returns:
      true / false
    • getLastUpdate

      public String getLastUpdate()
      Retrieve the last date / time that the scheme was updated
      Returns:
      Last update timestamp
    • getLastIndex

      public String getLastIndex()
      Retrieve the last date / time that the scheme was indexed
      Returns:
      Last index timestamp
    • getLocation

      public String getLocation()
      Retrieve the location of the files that comprise the underlying storage of the scheme
      Returns:
      File location
    • setLocation

      public void setLocation(String loc)
      Establish the location (typically a logical name) where the files that comprise the underlying storage of the scheme should be placed
      Parameters:
      loc - File location
    • isFinalized

      public boolean isFinalized()
      Check if the scheme has been finalized if the subsystem in use by the scheme requires finalization; value is undefined if the subsystem does not require finalization.
      Returns:
      true / false
    • getAlgorithmName

      public String getAlgorithmName()
      Retrieve the name of the algorithm, or classification subsystem, used to create the scheme
      Returns:
      Subsystem name
      See Also:
    • getMaxItems

      public int getMaxItems()
      Retrieve the maximum number of items that will be considered as training data for each category within the scheme
      Returns:
      Max items per category
    • setMaxItems

      public void setMaxItems(int max)
      Establish the maximum number of items that will be considered as training data for each category within the scheme
      Parameters:
      max - Maximum number of items per category
    • create

      public void create(String name, int subsystem, int max_items) throws TdbException
      Create a new container, using the specified subsystem. Invoking this method causes network I/O.
      Parameters:
      name - The name of the new container
      subsystem - The ID of the subsystem
      max_items - The maximum number of items that will be accepted when training the container
      Throws:
      TdbException
    • create

      public void create(String name, int subsystem) throws TdbException
      Create a new container, using the specified subsystem. Invoking this method causes network I/O.
      Parameters:
      name - The name of the new container
      subsystem - The ID of the subsystem
      Throws:
      TdbException
    • create

      public void create(String name) throws TdbException
      Create a new container. Invoking this method causes network I/O.
      Parameters:
      name - The name of the new container
      Throws:
      TdbException
    • create

      public void create() throws TdbException
      Create a new container
      Throws:
      TdbException
    • add

      public TdbCategory add(String name, String comment) throws TdbException
      Add a new category to the scheme.
      Parameters:
      name - Name of the new category
      comment - Optional comment to assign to the category
      Returns:
      The new category instance
      Throws:
      TdbException
    • getCategory

      public TdbCategory getCategory(String name)
      Retrieve the category with the provided name, if found. This method is only usable after the get() method has been used successfully.
      Parameters:
      name - The name of the category to retrieve
      Returns:
      The category instance, or null if not found
    • getCategory

      public TdbCategory getCategory(int id) throws TdbException
      Retrieve the category with the provided unique ID, if found. This method is only usable after the get() method has been used successfully.
      Parameters:
      id - Unique ID of the category to retrieve
      Returns:
      The category instance, or null if not found
      Throws:
      TdbException
    • remove

      public TdbCategory remove(String name) throws TdbException
      Remove an existing category from the scheme
      Parameters:
      name - Name of category to remove
      Returns:
      The category instance that was removed, if found
      Throws:
      TdbException
    • remove

      public void remove(TdbCategory cat) throws TdbException
      Remove an existing category from the scheme
      Parameters:
      cat - Category to remove
      Throws:
      TdbException
    • get

      public void get(String name) throws TdbException
      Retrieve the properties of a container, including the list of all categories defined within it. Invoking this method causes network I/O.
      Parameters:
      name - The name of container for which to retrieve properties
      Throws:
      TdbException
    • get

      public void get() throws TdbException
      Retrieve the properties of the current container, including the list of all categories defined within it.
      Throws:
      TdbException
    • put

      public void put() throws TdbException
      Store any saved attributes of the container, e.g. new location, new comment. Invoking this method causes network I/O.
      Throws:
      TdbException
    • delete

      public void delete(String name) throws TdbException
      Remove a container from the server in its entirety. Invoking this method causes network I/O.
      Parameters:
      name - The name of the container to remove
      Throws:
      TdbException
    • delete

      public void delete() throws TdbException
      Remove the current container from the server in its entirety. Invoking this method causes network I/O.
      Throws:
      TdbException
    • rename

      public void rename(String newname) throws TdbException
      Rename the current container. Invoking this method causes network I/O.
      Parameters:
      newname - The new name that the container is to assume
      Throws:
      TdbException
    • finalizeContainer

      public void finalizeContainer() throws TdbException
      Finalize container training, whatever that means for the underlying subsystem. Invoking this method causes network I/O.
      Throws:
      TdbException
    • classify

      public void classify(String data, List<TdbCategory> categories) throws TdbException
      Test classification with the container. Invoking this method causes network I/O.
      Parameters:
      data - Data to test again the container
      categories - (output) The categories to which the data has been assigned
      Throws:
      TdbException
    • infer

      public void infer(String database, String fieldname, int threshold) throws TdbException
      Infer classes and training data from a previous classified database. Invoking this method causes network I/O.
      Parameters:
      database - Name of TRIP database from which to read training data
      fieldname - Name of field within database that contains the category name
      threshold - Maximum number of items per category to read from the database
      Throws:
      TdbException
    • infer

      public void infer(String database, String fieldname) throws TdbException
      Infer classes and training data from a previous classified database. Invoking this method causes network I/O.
      Parameters:
      database - Name of TRIP database from which to read training data
      fieldname - Name of field within database that contains the category name
      Throws:
      TdbException