Class TdbClassificationScheme
- java.lang.Object
-
- com.tietoenator.trip.jxp.session.TdbSessionObject
-
- com.tietoenator.trip.jxp.TdbMessageProvider
-
- com.tietoenator.trip.jxp.classification.TdbClassificationScheme
-
- All Implemented Interfaces:
com.tietoenator.trip.jxp.internal.utils.DOMSink
,TdbControlObjectProvider
,java.lang.Iterable<TdbCategory>
public class TdbClassificationScheme extends TdbMessageProvider implements com.tietoenator.trip.jxp.internal.utils.DOMSink, TdbControlObjectProvider, java.lang.Iterable<TdbCategory>
Container and manipulation logic for a classification scheme container database
-
-
Constructor Summary
Constructors Constructor Description TdbClassificationScheme(TdbSession session)
Constructor, creates a blank containerTdbClassificationScheme(TdbSession session, TdbControlObject ob)
Constructor, creates an object for the container referenced by the provided TdbControlObject
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TdbCategory
add(java.lang.String name, java.lang.String comment)
Add a new category to the scheme.void
classify(java.lang.String data, java.util.List<TdbCategory> categories)
Test classification with the container.void
create()
Create a new containervoid
create(java.lang.String name)
Create a new container.void
create(java.lang.String name, int subsystem)
Create a new container, using the specified subsystem.void
create(java.lang.String name, int subsystem, int max_items)
Create a new container, using the specified subsystem.void
delete()
Remove the current container from the server in its entirety.void
delete(java.lang.String name)
Remove a container from the server in its entirety.void
finalizeContainer()
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(java.lang.String name)
Retrieve the properties of a container, including the list of all categories defined within it.java.lang.String
getAlgorithmName()
Retrieve the name of the algorithm, or classification subsystem, used to create the schemeTdbCategory
getCategory(int id)
Retrieve the category with the provided unique ID, if found.TdbCategory
getCategory(java.lang.String name)
Retrieve the category with the provided name, if found.TdbControlObject
getControlObject()
Retrieve the Control object reference with which this instance was constructedjava.lang.String
getDescription()
Retrieve any description associated with the schemejava.lang.String
getLastIndex()
Retrieve the last date / time that the scheme was indexedjava.lang.String
getLastUpdate()
Retrieve the last date / time that the scheme was updatedjava.lang.String
getLocation()
Retrieve the location of the files that comprise the underlying storage of the schemeint
getMaxItems()
Retrieve the maximum number of items that will be considered as training data for each category within the schemejava.lang.String
getName()
Retrieve the name of the classification schemeint
getSubsystemID()
Retrieve the ID of the classification subsystem with which this scheme is associatedvoid
infer(java.lang.String database, java.lang.String fieldname)
Infer classes and training data from a previous classified database.void
infer(java.lang.String database, java.lang.String fieldname, int threshold)
Infer classes and training data from a previous classified database.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.boolean
isOwner()
Check if the calling user is the owner of the schemejava.util.Iterator<TdbCategory>
iterator()
Retrieve an iterator over the categories defined within the schemevoid
put()
Store any saved attributes of the container, e.g. new location, new comment.void
remove(TdbCategory cat)
Remove an existing category from the schemeTdbCategory
remove(java.lang.String name)
Remove an existing category from the schemevoid
rename(java.lang.String newname)
Rename the current container.boolean
requiresFinalization()
Check whether this scheme requires special finalization in addition to the normal indexing processvoid
setDescription(java.lang.String description)
Establish a description to be associated with the schemevoid
setLocation(java.lang.String loc)
Establish the location (typically a logical name) where the files that comprise the underlying storage of the scheme should be placedvoid
setMaxItems(int max)
Establish the maximum number of items that will be considered as training data for each category within the schemevoid
setName(java.lang.String name)
Established the name of the classification schemevoid
setSubsystemID(int id)
Establish the ID of the classification subsystem with which this scheme is associatedboolean
supportsHierarchy()
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
-
-
-
-
Constructor Detail
-
TdbClassificationScheme
public TdbClassificationScheme(TdbSession session, TdbControlObject ob) throws TdbException
Constructor, creates an object for the container referenced by the provided TdbControlObject- Parameters:
session
- Active sessionob
- 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 Detail
-
getName
public java.lang.String getName()
Retrieve the name of the classification scheme- Returns:
- Classification scheme name
-
setName
public void setName(java.lang.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 java.lang.String getDescription()
Retrieve any description associated with the scheme- Returns:
- Scheme description, if any
-
setDescription
public void setDescription(java.lang.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:
TdbSession.getSubsystemName(int)
,TdbSession.getSubsystemID(String)
,TdbSession.subsystemNames()
-
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:
TdbSession.getSubsystemName(int)
,TdbSession.getSubsystemID(String)
,TdbSession.subsystemNames()
-
getControlObject
public TdbControlObject getControlObject()
Retrieve the Control object reference with which this instance was constructed- Specified by:
getControlObject
in interfaceTdbControlObjectProvider
- Returns:
- Control object reference
-
iterator
public java.util.Iterator<TdbCategory> iterator()
Retrieve an iterator over the categories defined within the scheme- Specified by:
iterator
in interfacejava.lang.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 java.lang.String getLastUpdate()
Retrieve the last date / time that the scheme was updated- Returns:
- Last update timestamp
-
getLastIndex
public java.lang.String getLastIndex()
Retrieve the last date / time that the scheme was indexed- Returns:
- Last index timestamp
-
getLocation
public java.lang.String getLocation()
Retrieve the location of the files that comprise the underlying storage of the scheme- Returns:
- File location
-
setLocation
public void setLocation(java.lang.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 java.lang.String getAlgorithmName()
Retrieve the name of the algorithm, or classification subsystem, used to create the scheme- Returns:
- Subsystem name
- See Also:
TdbSession.subsystemNames()
,TdbSession.getSubsystemID(String)
,TdbSession.getSubsystemName(int)
-
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(java.lang.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 containersubsystem
- The ID of the subsystemmax_items
- The maximum number of items that will be accepted when training the container- Throws:
TdbException
-
create
public void create(java.lang.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 containersubsystem
- The ID of the subsystem- Throws:
TdbException
-
create
public void create(java.lang.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(java.lang.String name, java.lang.String comment) throws TdbException
Add a new category to the scheme.- Parameters:
name
- Name of the new categorycomment
- Optional comment to assign to the category- Returns:
- The new category instance
- Throws:
TdbException
-
getCategory
public TdbCategory getCategory(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.String data, java.util.List<TdbCategory> categories) throws TdbException
Test classification with the container. Invoking this method causes network I/O.- Parameters:
data
- Data to test again the containercategories
- (output) The categories to which the data has been assigned- Throws:
TdbException
-
infer
public void infer(java.lang.String database, java.lang.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 datafieldname
- Name of field within database that contains the category namethreshold
- Maximum number of items per category to read from the database- Throws:
TdbException
-
infer
public void infer(java.lang.String database, java.lang.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 datafieldname
- Name of field within database that contains the category name- Throws:
TdbException
-
-