uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marshall Schor <...@schor.com>
Subject Re: Retrieving annotator back from analysis engine
Date Thu, 30 Mar 2017 14:07:25 GMT
Hi James,

The UIMA terminology discusses two kinds of entities:

  a) Annotators - take a CAS in, operate on it, update it, etc.  These are the
building blocks of pipelines.

  b) UIMA Applications (e.g., "pipelines") made up of some collection of
Annotators.

In most UIMA applications, there might be 1 pipeline, each having a number of
Annotators. Is this what you have?  Or are you running multiple (perhaps
different) collections of annotators, each having its own pipeline?

The produceAnalysisEngine call takes an object which is a ResourceSpecifier. 
That object is a description of the entire pipeline - what annotators are in it,
configuration parameters, etc.  The output of that is an AnalysisEngine object
that represents the whole pipeline.

There's no reference from that AnalysisEngine object back to the
ResourceSpecifier that was used to direct the construction of the pipeline.

So, I don't think what you want to do can be done.

============

That being said, perhaps the high level design can be adjusted.  I'm wondering
if two things got a bit conflated in the design - the idea of analysis engine
"components" (e.g. Annotators) and the idea of analysis engines themselves (the
pipelines that contain the annotators, configuration data, etc.)?

-Marshall


On 3/29/2017 1:11 PM, James Baker wrote:
> In my UIMA application, I have a number of AnalysisEngines (as you might
> expect). These were created using UIMAFramework.produceAnalysisEngine(...)
> on my annotators, which all extend MyAnnotator (which in turn extends
> JCasAnnotator_ImplBase).
>
> I want to get from the AnalysisEngine back to the original class (cast to
> MyAnnotator) so that I can access some of the additional functions I've
> added to the class. However, I can't seem to work out how to do that. Could
> someone give some pointers?
>
> For clarity, I've included below some code of what I'm trying to acheive
> (I'm aware that the code below doesn't work as I've tried it!)
>
> ----------------------------
>
> AnalysisEngine ae = getAnalysisEngine(); //Get the analysis engine from
> whereever it is, this bit's not important
>
> MyAnnotator ma = (MyAnnotator) ae; //Throws ClassCastException
> ma.callMyFunction(); //This is what I'm really trying to get to
>
> ----------------------------
>
> Thanks,
> James
>


Mime
View raw message