uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kline, Larry D" <Larry.Kl...@USONCOLOGY.COM>
Subject RE: Sessions
Date Tue, 08 Jan 2013 22:40:20 GMT
Your suggestion to create a new type and add it to the CAS worked perfectly and was straightforward
to implement.  
Thank you!

Larry

-----Original Message-----
From: Richard Eckart de Castilho [mailto:eckart@ukp.informatik.tu-darmstadt.de] 
Sent: Monday, January 07, 2013 9:29 AM
To: <user@uima.apache.org>
Subject: Re: Sessions

Am 07.01.2013 um 14:57 schrieb "Kline, Larry D" <Larry.Kline@USONCOLOGY.COM>:

> The reason I want to use a session object to store my properties is 
> that the API says these sessions are per client.  My UIMA app is 
> running in a JBoss container that is accessed by a web service call.  
> So multiple clients could be accessing it simultaneously, each one 
> passing slightly different parameters.  In the web service method I do this:
> 
> 	protected AnalysisEngine recognitionAE;
> 	...
> 	
> recognitionAE.getUimaContext().getSession().put(STEMMER_KEY_NAME,
> stemmerAlgorithmKey);
> 
> Then later in my custom flow controller I want to get this property 
> and use it to control the flow.
> 
> I'm not familiar with the external resource support.  Can I do 
> something similar using that?


The external resource mechanism allows you to share an object between UIMA components. You
tell UIMA how to instantiate this object as part of your analysis engine description (or aggregate
AE description). The object is instantiated once per UIMA root context, so should have the
same scope as the session. I have no idea if external resources can be accessed from a FlowController.


Your concept of "client" and that used in the documentation of the session may be slightly
different. I am pretty sure the session documentation refers to a UIMA deployment which is
distributed on a network. Every node (client) in that network, e.g. every UIMA-AS deployment,
has its own session - they are not in any way synchronized across the network.

In your case, to make sure a session (or external resource below) is not shared between clients
accessing your web application, you need to make sure that your recognitionAE instance is
not shared between web clients - or put it otherwise - it is not thread-safe when you store
data in the session.

I'd probably create a new UIMA type which holds such information and add it to the CAS. That
way, the CAS has some metadata on how it was processed and it can be accessed by the FlowController.
This also restores the thread-safety and if your annotator is programmed in a thread-safe
way, you can instantiate it once and share it between all your clients. Since the instantiation
of an analysis engine can be a costly process, you may want to consider that.

Cheers,

-- Richard

--
-------------------------------------------------------------------
Richard Eckart de Castilho
Technical Lead
Ubiquitous Knowledge Processing Lab (UKP-TUD) 
FB 20 Computer Science Department      
Technische Universit├Ąt Darmstadt
Hochschulstr. 10, D-64289 Darmstadt, Germany phone [+49] (0)6151 16-7477, fax -5455, room
S2/02/B117 eckart@ukp.informatik.tu-darmstadt.de
www.ukp.tu-darmstadt.de
Web Research at TU Darmstadt (WeRC) www.werc.tu-darmstadt.de
-------------------------------------------------------------------

</pre>The contents of this electronic mail message and any attachments are confidential,
possibly privileged and intended for the addressee(s) only.<br>Only the addressee(s)
may read, disseminate, retain or otherwise use this message. If received in error, please
immediately inform the sender and then delete this message without disclosing its contents
to anyone.</pre>


Mime
View raw message