Hi Kevin, thanks for your reply and sorry for my late reply again :) Unfortunately I was not able yet to get a working AnalysisEngineDescription from the Pear, which I could use to generate my aggregated AnalysisEngine.
First off, to generate my aggregated AnalysisEngine I intitialized an AnalysisEngine with the descriptor generated from the pear and the descriptor form my analysis engine in a fixed flow setup:
AnalysisEngineDescription aggDesc = new AnalysisEngineDescription_impl();
aggDesc.getDelegateAnalysisEngineSpecifiersWithImports().put("AE1_PEAR", ae1_pear);
aggDesc.getDelegateAnalysisEngineSpecifiersWithImports().put("AE2_MY", ae2_java);
FixedFlow_impl flow = new FixedFlow_impl();
flow.setFixedFlow(new String[] { "AE1_PEAR","AE2_MY"});
aggDesc.getAnalysisEngineMetaData().setFlowConstraints(flow);
I hope this is correct.
Ok to generate the descriptor from the pear I tried two different ways.
First (this is more a workaround) I manually installed the pear into "/tmp/pearInstalls" via the UIMA Pear Installer (org.apache.uima.tools.pear.install.InstallPear) and then called
PackageBrowser pear = new PackageBrowser("/tmp/pearInstalls/com.ibm.dltj.ruleannotator/");
This would return a Pear with the file
/tmp/pearInstalls/com.ibm.dltj.ruleannotator/desc/lw_PosRule.xml
as main component descriptor (pear.getInstallationDescriptor().getMainComponentDesc()). And the pear component pear specifier file path (pear.getComponentPearDescPath())
/tmp/pearInstalls/com.ibm.dltj.ruleannotator/com.ibm.dltj.ruleannotator_pear.xml
When validating the pear AnalysisEngineDescriptor via the
doFullValidation method a ResourceInitializationException is thrown
org.apache.uima.resource.ResourceInitializationException: Annotator class "com.ibm.dltj.uima_annotator.tagger.POSTagger" was not found. (Descriptor: file:/tmp/pearInstalls/com.ibm.dltj.ruleannotator/desc/LWPOSTagger.xml)
I'm not sure if this "POSTagger.xml" would be the correct main component descriptor to set up the AnalysisEngineDescription.
The second way was to directly use the result from the installed pear to generate the AnalysisEngineDescription of the Pear.
PackageBrowser pear = PackageInstaller.installPackage(new File("/tmp/pearInstalls/"), pearPackageFile, false);
XMLInputSource ae1_desc_xml = new XMLInputSource(mainComponentDesc);
AnalysisEngineDescription ae_desc = UIMAFramework.getXMLParser().parseAnalysisEngineDescription(ae1_desc_xml);
XMLInputSource ae1_desc_xml = new XMLInputSource(mainComponentDesc);
AnalysisEngineDescription ae_desc = UIMAFramework.getXMLParser().parseAnalysisEngineDescription(ae1_desc_xml);
This gave the same result.
Some files in my
desc directory are
langware.xml
lw_PosRule.xml
LWPOSTagger.xml
LWShallowParser0.xml
Scanners/0/DB-News-pri.xml
Scanners/0/DB-News-ts.xml
Scanners/0/DB-News-tsin.xml
SPGrammarTypes.xml
SPPriorities.xml
tt_core_typesystem.xml
tt_extension_typesystem.xml
I am also a bit confused why the main component descriptor would be the specific
POS descriptor and not "/tmp/pearInstalls/com.ibm.dltj.ruleannotator/com.ibm.dltj.ruleannotator_pear.xml", which is an pear specifier and cannot be used as AnalysisEngineDescriptor with the XMLInputSource.
Thanks for any help.
Cheers,
Toby