@CreoleResource(name="Conditional Corpus Pipeline", comment="A serial controller for conditionally run PR pipelines over corpora.", helpURL="http://gate.ac.uk/userguide/sec:developer:cond") public class ConditionalSerialAnalyserController extends ConditionalSerialController implements CorpusController, LanguageAnalyser, ControllerAwarePR
LanguageAnalysers.
It has a Corpus and its execute method runs all the analysers in
turn over each of the documents in the corpus.
This is a copy of the SerialAnalyserController, the only difference
being that it inherits from ConditionalSerialController rather than
from SerialController which makes it a conditional serial
analyser controller.
NOTE: if at the time when execute() is invoked, the document is not null, it is assumed that this controller is invoked from another controller and only this document is processed while the corpus (which must still be non-null) is ignored. Also, if the document is not null, the CorpusAwarePRs are not notified at the beginning, end, or abnormal termination of the pipeline.
If the document is null, all documents in the corpus are processed in sequence and CorpusAwarePRs are notified before the processing of the documents and after all documents have been processed or an abnormal termination occurred.
AbstractController.InternalStatusListener, AbstractController.IntervalProgressListener| Modifier and Type | Field and Description |
|---|---|
protected Corpus |
corpus |
protected Document |
document
The document being processed.
|
protected boolean |
runningAsSubPipeline |
strategiesListlog, prList, prof, prTimeMap, sListener, timeMapbenchmarkFeatures, benchmarkID, controllerCallbacksEnabled, interruptednamefeatures| Constructor and Description |
|---|
ConditionalSerialAnalyserController() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
ProcessingResource pr)
Overidden from
SerialController to only allow
LanguageAnalysers as components. |
void |
add(ProcessingResource pr)
Overidden from
SerialController to only allow
LanguageAnalysers as components. |
protected void |
checkLanguageAnalyser(ProcessingResource pr)
Throw an exception if the given processing resource is not
a LanguageAnalyser.
|
void |
controllerExecutionAborted(Controller c,
Throwable t)
Called by a controller containing this PR when the controller's
execution has been aborted by an exception thrown by one of the
contained PR's
execute methods, or by the controller
itself. |
void |
controllerExecutionFinished(Controller c)
Called by a controller containing this PR when the controller's
execution has completed successfully.
|
void |
controllerExecutionStarted(Controller c)
Called by a controller containing this PR when the controller
begins executing.
|
void |
execute()
Execute this controller.
|
protected void |
executeImpl()
Run the Processing Resources in sequence.
|
Corpus |
getCorpus()
Returns the
Corpus used by this
controller. |
Document |
getDocument()
Get the document property for this analyser.
|
List<ProcessingResource> |
getOffendingPocessingResources()
Checks whether all the contained PRs have all the required runtime
parameters set.
|
void |
invokeControllerExecutionAborted(Throwable thrown)
Invoke the controllerExecutionAborted method on this controller and all nested PRs and controllers.
|
void |
invokeControllerExecutionFinished()
Invoke the controllerExecutionFinished method on this controller and all nested PRs and controllers.
|
void |
invokeControllerExecutionStarted()
Invoke the controllerExecutionStarted method on this controller and all nested PRs and controllers.
|
void |
resourceUnloaded(CreoleEvent e)
Overridden to also clean up the corpus value.
|
void |
setCorpus(Corpus corpus)
Sets the
Corpus which contains the data on which
the controller is going to run. |
protected void |
setDocToPrs(Document doc)
Sets the current document to the memeber PRs
|
void |
setDocument(Document document)
Set the document property for this analyser.
|
cleanup, duplicate, getRunningStrategies, remove, remove, runComponent, setRunningStrategies, setRunningStrategycheckParameters, datastoreClosed, datastoreCreated, datastoreOpened, getPRs, getPrTimeMap, resetPrTimeMap, resourceLoaded, resourceRenamed, set, setPRsaddControllerListener, addProgressListener, addStatusListener, fireProcessFinished, fireProgressChanged, fireResourceAdded, fireResourceRemoved, fireStatusChanged, getBenchmarkId, getControllerAwarePRs, init, interrupt, isInterrupted, reInit, removeControllerListener, removeProgressListener, removeStatusListener, setBenchmarkId, setControllerCallbacksEnabledcheckParameterValues, flushBeanInfoCache, forgetBeanInfo, getBeanInfo, getInitParameterValues, getInitParameterValues, getName, getParameterValue, getParameterValue, getParameterValues, removeResourceListeners, setName, setParameterValue, setParameterValue, setParameterValues, setParameterValues, setResourceListeners, toStringgetFeatures, setFeaturesclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetPRs, setPRsreInitcleanup, getParameterValue, init, setParameterValue, setParameterValuesgetFeatures, setFeaturesgetName, setNameinterrupt, isInterruptedprotected boolean runningAsSubPipeline
protected Corpus corpus
protected Document document
LanguageAnalyser
interface, so this value is only used when the controller is used as a
member of another controller.public Document getDocument()
LanguageAnalysergetDocument in interface LanguageAnalyser@Optional @RunTime @CreoleParameter public void setDocument(Document document)
LanguageAnalysersetDocument in interface LanguageAnalyserdocument - the document to setpublic Corpus getCorpus()
CorpusControllerCorpus used by this
controller.getCorpus in interface CorpusControllergetCorpus in interface LanguageAnalyserpublic void setCorpus(Corpus corpus)
CorpusControllerCorpus which contains the data on which
the controller is going to run.setCorpus in interface CorpusControllersetCorpus in interface LanguageAnalyserpublic void execute()
throws ExecutionException
AbstractControllerControllerAwarePRs of the start and end of execution, and
delegates to the AbstractController.executeImpl() method to do the real work.
Subclasses should override AbstractController.executeImpl() rather than this method.execute in interface Controllerexecute in interface Executableexecute in class AbstractControllerExecutionExceptionprotected void executeImpl()
throws ExecutionException
executeImpl in class SerialControllerExecutionExceptionpublic void add(ProcessingResource pr)
SerialController to only allow
LanguageAnalysers as components.add in class ConditionalSerialControllerpr - the PR to be added.public void add(int index,
ProcessingResource pr)
SerialController to only allow
LanguageAnalysers as components.add in class ConditionalSerialControllerindex - the position for the PRpr - the PR to be set.protected void checkLanguageAnalyser(ProcessingResource pr)
protected void setDocToPrs(Document doc)
public List<ProcessingResource> getOffendingPocessingResources() throws ResourceInstantiationException
getOffendingPocessingResources in class AbstractControllerList of ProcessingResources that have required
parameters with null values if they exist null otherwise.ResourceInstantiationException - if problems occur while
inspecting the parameters for one of the resources. These will normally be
introspection problems and are usually caused by the lack of a parameter
or of the read accessor for a parameter.public void resourceUnloaded(CreoleEvent e)
resourceUnloaded in interface CreoleListenerresourceUnloaded in class SerialControllerpublic void controllerExecutionStarted(Controller c) throws ExecutionException
ControllerAwarePRexecuted on this run.controllerExecutionStarted in interface ControllerAwarePRc - the Controller that is executing.ExecutionException - if an error occurs that requires the
controller to abort its execution.public void controllerExecutionFinished(Controller c) throws ExecutionException
ControllerAwarePRexecute method of any of this controller's PRs in
this run.controllerExecutionFinished in interface ControllerAwarePRc - the Controller that is executing.ExecutionException - if an error occurs that requires the
controller to abort its execution.public void controllerExecutionAborted(Controller c, Throwable t) throws ExecutionException
ControllerAwarePRexecute methods, or by the controller
itself. When this method is called, it is guaranteed that there
will be no more calls to the execute method of any
of this controller's PRs in this run.controllerExecutionAborted in interface ControllerAwarePRc - the Controller that is executing.t - the Throwable that caused the controller to
abort. This will be either an ExecutionException,
a RuntimeException or an Error.ExecutionException - if an error occurs in this method that
requires the controller to abort its execution. This
method should not rethrow t, as the
controller will do this after informing any other
ControllerAware PRs it contains.public void invokeControllerExecutionStarted()
throws ExecutionException
invokeControllerExecutionStarted in class AbstractControllerExecutionExceptionpublic void invokeControllerExecutionFinished()
throws ExecutionException
invokeControllerExecutionFinished in class AbstractControllerExecutionExceptionpublic void invokeControllerExecutionAborted(Throwable thrown) throws ExecutionException
invokeControllerExecutionAborted in class AbstractControllerthrown - The Throwable to pass on to the controller callback method.ExecutionExceptionCopyright © 2024 GATE. All rights reserved.