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 <[email protected]> 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 <[email protected]> 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); > >
