org.semwebcentral.sweetrules.infrastructure
Class AbstractSweetCompositeTranslator

java.lang.Object
  extended byorg.semwebcentral.sweetrules.infrastructure.AbstractSweetTranslator
      extended byorg.semwebcentral.sweetrules.infrastructure.AbstractSweetCompositeTranslator
All Implemented Interfaces:
java.lang.Cloneable, ISweetCompositeTranslator, ISweetTranslator
Direct Known Subclasses:
SweetCompositeTranslator

public abstract class AbstractSweetCompositeTranslator
extends AbstractSweetTranslator
implements ISweetCompositeTranslator

This is an abstract class for composing translators. It serves two purposes: 1) Provides an implementation of translate () which invokes a series of translators, composes the output and returns the data in target KR. The default implementation of translate is done in this class

Author:
Shashidhara K Ganjugunte, Dr. Benjamin Grosof, Dr. Said Tabet, Chitravanu Neogy, Sumit Bhansali

Field Summary
private  ISweetTranslator[] translatorArray
          The composed translator array populated (through the constructor) by TranslatorRepository
 
Fields inherited from class org.semwebcentral.sweetrules.infrastructure.AbstractSweetTranslator
logger, sourceKBDescriptor, targetKBDescriptor, translatorDescriptor
 
Constructor Summary
AbstractSweetCompositeTranslator(ISweetKRDescriptor source, ISweetKRDescriptor target, ISweetKBDescriptor sourceKBDescriptor, ISweetKBDescriptor targetKBDescriptor, ISweetInvocationDescriptor options, ISweetTranslator[] composedTranslators)
          Constructor of the SweetCompositeTranslator class, invoked by the TranslatorRepository
 
Method Summary
 java.lang.Object clone()
          The clone method to clone the translator
 ISweetTranslator[] getComposedTranslators()
          API to facilitate viewing of the composed translators
 void print()
          Print API for the composite translator
 void setOptionOnAllComposedTranslators(ISweetInvocationDescriptor invocationDescriptor)
          Sets the option on all composed translators
 java.lang.String translate()
          Performs translation from the specified source format to the target format by cascading
 
Methods inherited from class org.semwebcentral.sweetrules.infrastructure.AbstractSweetTranslator
getSourceData, getTranslatorDescriptor, loadAllNamespacesAndEntities, setSourceData, setSourceKBDescriptor, setTargetKBDescriptor, setTranslatorDescriptor, trace, writeToTargetKB
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.semwebcentral.sweetrules.infrastructure.ISweetTranslator
getSourceData, getTranslatorDescriptor, setSourceData, setSourceKBDescriptor, setTargetKBDescriptor, setTranslatorDescriptor
 

Field Detail

translatorArray

private ISweetTranslator[] translatorArray
The composed translator array populated (through the constructor) by TranslatorRepository

Constructor Detail

AbstractSweetCompositeTranslator

public AbstractSweetCompositeTranslator(ISweetKRDescriptor source,
                                        ISweetKRDescriptor target,
                                        ISweetKBDescriptor sourceKBDescriptor,
                                        ISweetKBDescriptor targetKBDescriptor,
                                        ISweetInvocationDescriptor options,
                                        ISweetTranslator[] composedTranslators)
                                 throws SweetTranslatorException
Constructor of the SweetCompositeTranslator class, invoked by the TranslatorRepository

Parameters:
source - KR Format of the source data
target - Expected KR Format of the translated data
sourceKBDescriptor - The source knowledgebase descriptor
targetKBDescriptor - The target KB descriptor
options - The options header
composedTranslators - The composed translators, if the composition has been computed If the composition is not computed or unknown it can be null.
Method Detail

getComposedTranslators

public ISweetTranslator[] getComposedTranslators()
API to facilitate viewing of the composed translators

Specified by:
getComposedTranslators in interface ISweetCompositeTranslator
Returns:
The composed translator array

translate

public java.lang.String translate()
                           throws SweetTranslatorException
Performs translation from the specified source format to the target format by cascading

Specified by:
translate in interface ISweetTranslator
Returns:
The translated string in the target format
Throws:
TranslatorException
SweetTranslatorException

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
The clone method to clone the translator

Specified by:
clone in interface ISweetTranslator
Overrides:
clone in class AbstractSweetTranslator
Returns:
The cloned translator
Throws:
java.lang.CloneNotSupportedException - if an error occurs

print

public void print()
Print API for the composite translator

Specified by:
print in interface ISweetTranslator
Overrides:
print in class AbstractSweetTranslator

setOptionOnAllComposedTranslators

public void setOptionOnAllComposedTranslators(ISweetInvocationDescriptor invocationDescriptor)
                                       throws SweetTranslatorException
Sets the option on all composed translators

Specified by:
setOptionOnAllComposedTranslators in interface ISweetCompositeTranslator
Parameters:
invocationDescriptor - The new option set
Throws:
SweetTranslatorException - if an error occurs