You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by David García <da...@barcelonamedia.org> on 2010/12/16 13:02:42 UTC

UIMA AS Client

Hi,

I am modifying RunRemoteAsyncAE.java. What I'd like to do is to make an 
annotation in the Cas.
In the case of an empty Cas:

  CAS cas = uimaEEEngine.getCAS();

I want to send a default text:

  cas.setDocumentText("Some text to send to AS service.");

and create an annotation:

  MyAnnotation ma = new MyAnnotation(cas.getJCas());

But I get  "JCas type "MyAnnotation" used in Java code,  but was not 
declared in the XML type descriptor"


The Java implementation of the annotation is found, as it is defined, 
but as it isn't a UIMA Analisys Engine, it hasn't access to the type 
system of the pipeline.
How should I solve this issue?


Regards,
David

Re: UIMA AS Client

Posted by Burn Lewis <bu...@gmail.com>.
Weeird ... I added much the same to runRemoteAsyncAE
      Iterator it = cas.getTypeSystem().getTypeIterator();
      while(it.hasNext()) {
      System.out.println(">>> Type: " + ((Type)it.next()).getName());
      }
and as well as the uima types got types from my service, e.g.:
   >>> Type: org.gale.Sentence

Did you see your types in the metadata returned in the log?  Did the status
callbacks show that initialization was successful?

~Burn

Re: UIMA AS Client

Posted by David Garcia Narbona <da...@barcelonamedia.org>.
Hi,

we have tested our UIMA AS client with the RoomNumberAnnotator from UIMA 
AS examples and, in this particular case, the UIMA AS client retrieves 
the proper typeSystem.
When it has to do with our UIMA AS pipeline, the UIMA AS client only 
retrieves the default UIMA type system, not the one from the AS service.

Our UIMA AS service has been tested through CVD and it seems right.

We have pasted the code of our client here: http://pastebin.com/zrSeMZe8


Regards,
David

El 20/12/2010 18:32, Jaroslaw Cwiklik escribió:
> Can you deploy RoomNumberAnnotator from UIMA AS examples and connect your
> client to it to see if you get service types. You should see
> type: org.apache.uima.tutorial.RoomNumber.
>
> The example is in
> UIMA_HOME/examples/deploy/as/Deploy_RoomNumberAnnotator.xml. Queue
> name: RoomNumberAnnotatorQueue
>
> -Jerry C
>
> On Mon, Dec 20, 2010 at 4:49 AM, Jens Grivolla
> <j+...@grivolla.net>
>> wrote:
>> On 12/19/2010 09:36 PM, Burn Lewis wrote:
>>
>>> To see what typesystem is returned by your service you can turn up the
>>> logging when invoking runRemoteAsyncAE.
>>> and you'll see the service's typesystem as part of the metadata returned
>>> to
>>> the client.
>>>
>> Ok, we do obtain an XML with<analysisEngineMetaData>  that contains the
>> full type system.  It also shows up correctly in the CVD.
>>
>> However, when trying to get the type system from a Java client, we only get
>> the default UIMA type system, not the one from the AS service.
>>
>> We initialize a UimaAsynchronousEngine and then call .getCAS() on it to
>> obtain an empty CAS and .getTypeSystem() on that CAS.  Getting all types via
>> .getTypeIterator() shows only the base UIMA types.  Our understanding was
>> that the CAS obtained from the UimaAsynchronousEngine would have the AS
>> service's type system.
>>
>> Thanks,
>> Jens (and David - we work together in case you were getting confused with
>> the names)
>>
>>

Re: UIMA AS Client

Posted by Jaroslaw Cwiklik <ui...@gmail.com>.
Can you deploy RoomNumberAnnotator from UIMA AS examples and connect your
client to it to see if you get service types. You should see
type: org.apache.uima.tutorial.RoomNumber.

The example is in
UIMA_HOME/examples/deploy/as/Deploy_RoomNumberAnnotator.xml. Queue
name: RoomNumberAnnotatorQueue

-Jerry C

On Mon, Dec 20, 2010 at 4:49 AM, Jens Grivolla
<j+...@grivolla.net>
> wrote:

> On 12/19/2010 09:36 PM, Burn Lewis wrote:
>
>> To see what typesystem is returned by your service you can turn up the
>> logging when invoking runRemoteAsyncAE.
>> and you'll see the service's typesystem as part of the metadata returned
>> to
>> the client.
>>
>
> Ok, we do obtain an XML with <analysisEngineMetaData> that contains the
> full type system.  It also shows up correctly in the CVD.
>
> However, when trying to get the type system from a Java client, we only get
> the default UIMA type system, not the one from the AS service.
>
> We initialize a UimaAsynchronousEngine and then call .getCAS() on it to
> obtain an empty CAS and .getTypeSystem() on that CAS.  Getting all types via
> .getTypeIterator() shows only the base UIMA types.  Our understanding was
> that the CAS obtained from the UimaAsynchronousEngine would have the AS
> service's type system.
>
> Thanks,
> Jens (and David - we work together in case you were getting confused with
> the names)
>
>

Re: UIMA AS Client

Posted by Jens Grivolla <j+...@grivolla.net>.
On 12/19/2010 09:36 PM, Burn Lewis wrote:
> To see what typesystem is returned by your service you can turn up the
> logging when invoking runRemoteAsyncAE.
> and you'll see the service's typesystem as part of the metadata returned to
> the client.

Ok, we do obtain an XML with <analysisEngineMetaData> that contains the 
full type system.  It also shows up correctly in the CVD.

However, when trying to get the type system from a Java client, we only 
get the default UIMA type system, not the one from the AS service.

We initialize a UimaAsynchronousEngine and then call .getCAS() on it to 
obtain an empty CAS and .getTypeSystem() on that CAS.  Getting all types 
via .getTypeIterator() shows only the base UIMA types.  Our 
understanding was that the CAS obtained from the UimaAsynchronousEngine 
would have the AS service's type system.

Thanks,
Jens (and David - we work together in case you were getting confused 
with the names)


Re: UIMA AS Client

Posted by Burn Lewis <bu...@gmail.com>.
To see what typesystem is returned by your service you can turn up the
logging when invoking runRemoteAsyncAE.
In your UIMA_LOGGER_CONFIG_FILE set
 org.apache.uima.adapter.jms.client.level = FINEST
and you'll see the service's typesystem as part of the metadata returned to
the client.

~Burn.

Re: UIMA AS Client

Posted by Eddie Epstein <ea...@gmail.com>.
On Thu, Dec 16, 2010 at 9:02 AM, Jens Grivolla <j+...@grivolla.net> wrote:
> Thanks, is there a way to check what type system the AS service uses?
>
> MyAnnotation is declared in the capabilities section of the aggregate
> descriptor of the service (AS primitive, made from merging a few PEARS).
>  The type system itself (its XML definition) is imported in the separate AE
> descriptors, which works without problems in other settings (e.g. deploying
> the aggregate PEAR through SimpleServer).

UIMA doesn't allow defining types in aggregate descriptors. There
should be an error in the uima.log for the service. If not, there were
bugs in uima-as 2.3.0 that lost the root cause of exceptions in
uima core components. Running that aggregate with cvd should
show the error. CVD also allows one to browse the type system.

Eddie

Re: UIMA AS Client

Posted by Jens Grivolla <j+...@grivolla.net>.
Thanks, is there a way to check what type system the AS service uses?

MyAnnotation is declared in the capabilities section of the aggregate 
descriptor of the service (AS primitive, made from merging a few PEARS). 
  The type system itself (its XML definition) is imported in the 
separate AE descriptors, which works without problems in other settings 
(e.g. deploying the aggregate PEAR through SimpleServer).

Jens


On 12/16/2010 02:44 PM, Eddie Epstein wrote:
> When the UIMA AS Client is initialized the type system for its casPool
> comes from that of the remote service, optionally merged with that of
> the registered collection reader if there is one. MyAnnotation will
> have to be defined in one of those two to be in the CAS definition.
>
> Eddie
>
> On Thu, Dec 16, 2010 at 7:02 AM, David García
> <da...@barcelonamedia.org>  wrote:
>> Hi,
>>
>> I am modifying RunRemoteAsyncAE.java. What I'd like to do is to make an
>> annotation in the Cas.
>> In the case of an empty Cas:
>>
>>   CAS cas = uimaEEEngine.getCAS();
>>
>> I want to send a default text:
>>
>>   cas.setDocumentText("Some text to send to AS service.");
>>
>> and create an annotation:
>>
>>   MyAnnotation ma = new MyAnnotation(cas.getJCas());
>>
>> But I get  "JCas type "MyAnnotation" used in Java code,  but was not
>> declared in the XML type descriptor"
>>
>>
>> The Java implementation of the annotation is found, as it is defined, but as
>> it isn't a UIMA Analisys Engine, it hasn't access to the type system of the
>> pipeline.
>> How should I solve this issue?
>>
>>
>> Regards,
>> David
>>
>



Re: UIMA AS Client

Posted by Eddie Epstein <ea...@gmail.com>.
When the UIMA AS Client is initialized the type system for its casPool
comes from that of the remote service, optionally merged with that of
the registered collection reader if there is one. MyAnnotation will
have to be defined in one of those two to be in the CAS definition.

Eddie

On Thu, Dec 16, 2010 at 7:02 AM, David García
<da...@barcelonamedia.org> wrote:
> Hi,
>
> I am modifying RunRemoteAsyncAE.java. What I'd like to do is to make an
> annotation in the Cas.
> In the case of an empty Cas:
>
>  CAS cas = uimaEEEngine.getCAS();
>
> I want to send a default text:
>
>  cas.setDocumentText("Some text to send to AS service.");
>
> and create an annotation:
>
>  MyAnnotation ma = new MyAnnotation(cas.getJCas());
>
> But I get  "JCas type "MyAnnotation" used in Java code,  but was not
> declared in the XML type descriptor"
>
>
> The Java implementation of the annotation is found, as it is defined, but as
> it isn't a UIMA Analisys Engine, it hasn't access to the type system of the
> pipeline.
> How should I solve this issue?
>
>
> Regards,
> David
>