uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Eckart de Castilho <...@apache.org>
Subject Re: Wrong CAS being passed on in AAE
Date Wed, 26 Aug 2015 20:29:56 GMT
Uh, I've to step one back on this one:

I realize on a second and more thorough read that this part of the
documentation is about types, not about flow and that the
shared context not injected into existing engines (as I had first thought)
but passed during engine creation. 

With the AnalysisEngine-based signatures, uimaFIT gets engine that
have already been created, so unfortuately, this is not applicable.

Also, typically uimaFIT uses type-autodetection such that all CASes
in the system normally have exactly the same type system. Thus,
the type incompatibilities mentioned here usually do not apply.

But really Matt, thanks anyway because I've to admit, I've hardly ever
read the UIMA documentation that there's probably lots of stuff in there
that I could learn (and meanwhile also understand, not like the first time
when I tried reading this years ago).

If you have any other idea what could be the problem, please shoot again!

-- Richard

On 26.08.2015, at 22:07, Matthew DeAngelis <ronin78@gmail.com> wrote:

> Glad that I can contribute! I will figure out how to do that.
> Matt
> On Wed, Aug 26, 2015 at 3:44 PM, Richard Eckart de Castilho <rec@apache.org>
> wrote:
>> Thanks Matt :)
>> The case that you describe applies if Martin is using the
>> AnalysisEngine-based signature:
>> SimplePipeline.runPipeline(reader, AnalysisEngine, AnalysisEngine, ...);
>> When using the AnalysisEngineDescription-based signature, then uimaFIT
>> will internally wrap all the given AEDs in another aggregate AED, so
>> the case should no longer apply.
>> SimplePipeline.runPipeline(reader, AnalysisEngineDescription,
>>  AnalysisEngineDescription, ...);
>> As a general recommendation: stay away from createEngine and createReader
>> unless you have a *really* good reason to use them. Better use
>> createEngineDescription and createReaderDescription everywhere and as
>> long as possible.
>> @Matt: I guess the approach you found could help SimplePipeline to work
>> much better when the AnalysisEngine-based signature is used. I'd
>> appreciate if you could open an issue for that in the Jira.
>> Cheers,
>> -- Richard
>> On 26.08.2015, at 21:33, Matthew DeAngelis <ronin78@gmail.com> wrote:
>>> I'll bet that Richard will be more helpful than I am, but I found the
>> below
>>> in the documentation for CAS Multipliers (7.5.2). It does not sound
>> exactly
>>> like your issue, but it might be related.
>>> Regards,
>>> Matt
>>> 7.5.2. Using a CAS Multiplier with other Analysis Engines
>>> In your application you can take the output CASes from a CAS Multiplier
>> and
>>> pass them to the process method of other Analysis Engines. However there
>>> are some special considerations regarding the Type System of these CASes.
>>> By default, the output CASes of a CAS Multiplier will have a Type System
>>> that contains all of the types and features declared by any component in
>>> the outermost Aggregate Analysis Engine or Collection Processing Engine
>>> that contains the CAS Multiplier. If in your application you create a CAS
>>> Multiplier and another Analysis Engine, where these are not enclosed in
>> an
>>> aggregate, then the output CASes from the CAS Multiplier will not support
>>> any types or features that are declared in the latter Analysis Engine but
>>> not in the CAS Multiplier.
>>> This can be remedied by forcing the CAS Multiplier and Analysis Engine to
>>> share a single UimaContext when they are created, as follows:
>>> //create a "root" UIMA context for your whole application
>>> UimaContextAdmin rootContext =
>>>  UIMAFramework.newUimaContext(UIMAFramework.getLogger(),
>>>     UIMAFramework.newDefaultResourceManager(),
>>>     UIMAFramework.newConfigurationManager());
>>> XMLInputSource input = new XMLInputSource("MyCasMultiplier.xml");
>>> AnalysisEngineDescription desc = UIMAFramework.getXMLParser().
>>>       parseAnalysisEngineDescription(input);
>>> //create a UIMA Context for the new AE we are about to create
>>> //first argument is unique key among all AEs used in the application
>>> UimaContextAdmin childContext = rootContext.createChild(
>>>       "myCasMultiplier", Collections.EMPTY_MAP);
>>> //instantiate CAS Multiplier AE, passing the UIMA Context through the
>>> //additional parameters map
>>> Map additionalParams = new HashMap();
>>> additionalParams.put(Resource.PARAM_UIMA_CONTEXT, childContext);
>>> AnalysisEngine casMultiplierAE = UIMAFramework.produceAnalysisEngine(
>>>       desc,additionalParams);
>>> //repeat for another AE
>>> XMLInputSource input2 = new XMLInputSource("MyAE.xml");
>>> AnalysisEngineDescription desc2 = UIMAFramework.getXMLParser().
>>>       parseAnalysisEngineDescription(input2);
>>> UimaContextAdmin childContext2 = rootContext.createChild(
>>>       "myAE", Collections.EMPTY_MAP);
>>> Map additionalParams2 = new HashMap();
>>> additionalParams2.put(Resource.PARAM_UIMA_CONTEXT, childContext2);
>>> AnalysisEngine myAE = UIMAFramework.produceAnalysisEngine(
>>>       desc2, additionalParams2);

View raw message