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:32:04 GMT
That's interesting. So essentially it works as

AAE* ( AAE ( AE AE ) )

but not as

AAE* ( AE AE )

*: The outermost is always implicitly added by SimplePipeline.runPipeline(). 

To be honest, I have no idea why only the first case would work but not the second,
in particular since you say you don't to any flow tweaking on the inner AAE even
in the first case.

-- Richard

On 26.08.2015, at 22:10, Martin Wunderlich <martin_wu@gmx.net> wrote:

> Thanks a lot for the quick replies! I am using the SimplePipeline that is based AnalysisEngineDescriptions.
The pipeline was, however, using the createReader() method to set up the CollectionReader,
like this: 
> 
> 		SimplePipeline.runPipeline(
> 			CollectionReaderFactory.createReader(
> 					readerClass,
> 					readerConfigData),
> 			analysisEngine1,
> 			analysisEngine2
> 		);
> 
> I have converted this to using the createReaderDescription method: 
> 
> 		SimplePipeline.runPipeline(
> 				createReaderDescription(
> 						readerClass,
> 						readerConfigData),
> 			analysisEngine1,
> 			analysisEngine2
> 		);
> 
> 
> But the result is still the same: The annotations are missing from the CAS that is input
to the 2nd AAE. 
> 
> Cheers, 
> 
> Martin
> 
> 
>> Am 26.08.2015 um 21:44 schrieb Richard Eckart de Castilho <rec@apache.org>:
>> 
>> 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);
>> 
> 


Mime
View raw message