You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Roberto Franchini <ro...@gmail.com> on 2007/11/14 13:09:57 UTC

Building AggrgateAnalysisEngine programmatically

Hi to all,
I need to build an aggregate angine in a programmatic way, but I
didn't find anything in the docs or api.

I'm using a CPM, where i deploy some processors, consumers and a
collection reader.
Now I want to process a single string and try this:
...
			cpm.init(true, new Properties());
AnalysisEngine analysisEngine = this.cpm.getAnalysisEngine();
...
but i got an ArrayIndexOutOfBoundException.

Taking a look at the CPMImpl, i saw this code:

  public AnalysisEngine getAnalysisEngine() {
    if (super.getCasProcessors()[0] != null) {
      try {
        if (super.getCasProcessors()[0] instanceof AnalysisEngine) {
          return (AnalysisEngine) super.getCasProcessors()[0];
        }
      } catch (ClassCastException cE) {
        cE.printStackTrace();
        return null;
      }
    }
    return null;
  }

the AIOBE is on the super.getCasProcessors()[0] statement.

So, at least, I will get the first processor deployed, not a whole
analysys engine composed of all casprocessor :(

I'm thinking to switch to a CPE instead of CPM, but i think it will be the same.

regards,
Roberto

-- 
Roberto Franchini
CELI s.r.l.  (http://www.celi.it) - C.so Moncalieri 21 - 10131 Torino - ITALY
Tel +39-011-6600814 - Fax +39-011-6600687
jabber:ro.franchini@gmail.com skype:ro.franchini

Re: Building AggrgateAnalysisEngine programmatically

Posted by Roberto Franchini <ro...@gmail.com>.
On Nov 20, 2007 6:24 PM, Roberto Franchini <ro...@gmail.com> wrote:
> On Nov 20, 2007 5:30 PM, Michael Baessler <mb...@michael-baessler.de> wrote:
> > Roberto Franchini wrote:
> > > On Nov 14, 2007 1:09 PM, Roberto Franchini <ro...@gmail.com> wrote:
> > >
> [cut]> >
> > Maybe I don't understand your initial question. But If you just want to
> > create an aggregate AE using the UIMA APIs you can look at
> > this test case
> >
> > http://svn.apache.org/repos/asf/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/pear/util/PearRuntimeTest.java
> > The method runPearRuntimeTestcase(String pear1, String pear2) creates an
> > aggregate AE using the UIMA API.
> >
> > -- Michael
> >
>
> GREAT! It's seems what I need! I'll try and give you a feedback.
> Thanks a lot!
>

The feedback: it works!
-- 
Roberto Franchini
CELI s.r.l.  (http://www.celi.it) - C.so Moncalieri 21 - 10131 Torino - ITALY
Tel +39-011-6600814 - Fax +39-011-6600687
jabber:ro.franchini@gmail.com skype:ro.franchini

Re: Building AggrgateAnalysisEngine programmatically

Posted by Roberto Franchini <ro...@gmail.com>.
On Nov 20, 2007 5:30 PM, Michael Baessler <mb...@michael-baessler.de> wrote:
> Roberto Franchini wrote:
> > On Nov 14, 2007 1:09 PM, Roberto Franchini <ro...@gmail.com> wrote:
> >
[cut]> >
> Maybe I don't understand your initial question. But If you just want to
> create an aggregate AE using the UIMA APIs you can look at
> this test case
>
> http://svn.apache.org/repos/asf/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/pear/util/PearRuntimeTest.java
> The method runPearRuntimeTestcase(String pear1, String pear2) creates an
> aggregate AE using the UIMA API.
>
> -- Michael
>

GREAT! It's seems what I need! I'll try and give you a feedback.
Thanks a lot!
Roberto



-- 
Roberto Franchini
CELI s.r.l.  (http://www.celi.it) - C.so Moncalieri 21 - 10131 Torino - ITALY
Tel +39-011-6600814 - Fax +39-011-6600687
jabber:ro.franchini@gmail.com skype:ro.franchini

Re: Building AggrgateAnalysisEngine programmatically

Posted by Michael Baessler <mb...@michael-baessler.de>.
Roberto Franchini wrote:
> On Nov 14, 2007 1:09 PM, Roberto Franchini <ro...@gmail.com> wrote:
>   
>> Hi to all,
>> I need to build an aggregate angine in a programmatic way, but I
>> didn't find anything in the docs or api.
>>     
> [cut]
>
> Nobody can help me? I didn't find a solution :(
> Well, I found it: produce an xml  descriptor of an aggregate analysis
> and use it :)
> Thanks anyway!
> Roberto
>
>   
Maybe I don't understand your initial question. But If you just want to 
create an aggregate AE using the UIMA APIs you can look at
this test case
    
http://svn.apache.org/repos/asf/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/pear/util/PearRuntimeTest.java
The method runPearRuntimeTestcase(String pear1, String pear2) creates an 
aggregate AE using the UIMA API.

-- Michael

Re: Building AggrgateAnalysisEngine programmatically

Posted by Roberto Franchini <ro...@gmail.com>.
On Nov 14, 2007 1:09 PM, Roberto Franchini <ro...@gmail.com> wrote:
> Hi to all,
> I need to build an aggregate angine in a programmatic way, but I
> didn't find anything in the docs or api.
[cut]

Nobody can help me? I didn't find a solution :(
Well, I found it: produce an xml  descriptor of an aggregate analysis
and use it :)
Thanks anyway!
Roberto

-- 
Roberto Franchini
CELI s.r.l.  (http://www.celi.it) - C.so Moncalieri 21 - 10131 Torino - ITALY
Tel +39-011-6600814 - Fax +39-011-6600687
jabber:ro.franchini@gmail.com skype:ro.franchini