You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Matthias Mühlhausen <Ma...@uni-jena.de> on 2008/07/16 14:33:01 UTC
setting of an Object as a configuration parameter
Hello,
I have a question concerning the setting of an Object as a configuration
parameter for an AnalysisEngine:
We are processing a corpus with several threads of the same UIMA
pipeline. There is a very large Java object or "resource" that is used
by an AnalysisEngine of this pipeline. it's a Dictionary object that
needs between 4 and 12GB memory. We would like to create only one object
and use this in all pipelines, because of the memory footprint. I
thought it could be possible to create it once and then set it as a
configuration parameter for all the components. This does not work,
because an AnalysisEngine does not accept to set an Object as a
configuration parameter.
So I thought about two solutions yet:
1. we use this component not as a AnalysisEngine but as a POJO and set
the Object by a simple setter.
2. using JNDI and resolve the object by a name - but I have no
experience with JNDI, so I would like to have somebody's opinion about
this approach.
regards
Matthias
--
Matthias Mühlhausen
Jena University Language and Information Engineering (JULIE) Lab
Phone: +49-3641-944305
Fax: +49-3641-944321
email: matthias.muehlhausen@uni-jena.de
URL: http://www.julielab.de
Re: setting of an Object as a configuration parameter
Posted by Thilo Goetz <tw...@gmx.de>.
Matthias,
I see. I don't think that concept is directly supported
in UIMA. One possibility would be to fake it by making
the load() method a no-op. Maybe not nice, but on the
safe side. Or create a singleton object, but be careful
to make creation thread safe.
JNDI seems like overkill for this problem, unless you're
running in a J2EE server anyway (and even then...).
--Thilo
Matthias Mühlhausen wrote:
> Thank you Thilo,
>
> the example is really useful for understanding the concept. But what can
> I do if I don't want to use a file where the serialized object is stored
> (in he HMMTagger example: file:english/BrownModel.dat) but instead just
> keep the object in memory without writing it to a file?
> I saw that the method 'load' that has to be implemented, uses a
> DataResource object to get an InputStream to deserialize the object. So
> I guess the ResourceManager or the UIMAFramework somehow manages it to
> get the filename from the descriptor...
>
> regards
> Matthias
>
> Thilo Goetz schrieb:
>> Matthias,
>>
>> that's what external resources are for. You declare them
>> in a descriptor, and they get loaded once by the framework.
>> See
>> http://incubator.apache.org/uima/downloads/releaseDocs/2.2.2-incubating/docs/html/tutorials_and_users_guides/tutorials_and_users_guides.html#ugr.tug.aae.accessing_external_resource_files
>>
>>
>> A real life example of such an external resource is the
>> HMM model file of the sandbox Tagger. Check the HmmTagger.xml
>> descriptor, IModelResource.java and ModelResource.java.
>>
>> --Thilo
>>
>> Matthias Mühlhausen wrote:
>>> Hello,
>>>
>>> I have a question concerning the setting of an Object as a
>>> configuration parameter for an AnalysisEngine:
>>>
>>> We are processing a corpus with several threads of the same UIMA
>>> pipeline. There is a very large Java object or "resource" that is
>>> used by an AnalysisEngine of this pipeline. it's a Dictionary object
>>> that needs between 4 and 12GB memory. We would like to create only
>>> one object and use this in all pipelines, because of the memory
>>> footprint. I thought it could be possible to create it once and then
>>> set it as a configuration parameter for all the components. This does
>>> not work, because an AnalysisEngine does not accept to set an Object
>>> as a configuration parameter.
>>> So I thought about two solutions yet:
>>>
>>> 1. we use this component not as a AnalysisEngine but as a POJO and
>>> set the Object by a simple setter.
>>>
>>> 2. using JNDI and resolve the object by a name - but I have no
>>> experience with JNDI, so I would like to have somebody's opinion
>>> about this approach.
>>>
>>>
>>> regards
>>> Matthias
>>>
>
>
Re: setting of an Object as a configuration parameter
Posted by Matthias Mühlhausen <Ma...@uni-jena.de>.
Thank you Thilo,
the example is really useful for understanding the concept. But what can
I do if I don't want to use a file where the serialized object is stored
(in he HMMTagger example: file:english/BrownModel.dat) but instead just
keep the object in memory without writing it to a file?
I saw that the method 'load' that has to be implemented, uses a
DataResource object to get an InputStream to deserialize the object. So
I guess the ResourceManager or the UIMAFramework somehow manages it to
get the filename from the descriptor...
regards
Matthias
Thilo Goetz schrieb:
> Matthias,
>
> that's what external resources are for. You declare them
> in a descriptor, and they get loaded once by the framework.
> See
> http://incubator.apache.org/uima/downloads/releaseDocs/2.2.2-incubating/docs/html/tutorials_and_users_guides/tutorials_and_users_guides.html#ugr.tug.aae.accessing_external_resource_files
>
>
> A real life example of such an external resource is the
> HMM model file of the sandbox Tagger. Check the HmmTagger.xml
> descriptor, IModelResource.java and ModelResource.java.
>
> --Thilo
>
> Matthias Mühlhausen wrote:
>> Hello,
>>
>> I have a question concerning the setting of an Object as a
>> configuration parameter for an AnalysisEngine:
>>
>> We are processing a corpus with several threads of the same UIMA
>> pipeline. There is a very large Java object or "resource" that is
>> used by an AnalysisEngine of this pipeline. it's a Dictionary object
>> that needs between 4 and 12GB memory. We would like to create only
>> one object and use this in all pipelines, because of the memory
>> footprint. I thought it could be possible to create it once and then
>> set it as a configuration parameter for all the components. This does
>> not work, because an AnalysisEngine does not accept to set an Object
>> as a configuration parameter.
>> So I thought about two solutions yet:
>>
>> 1. we use this component not as a AnalysisEngine but as a POJO and
>> set the Object by a simple setter.
>>
>> 2. using JNDI and resolve the object by a name - but I have no
>> experience with JNDI, so I would like to have somebody's opinion
>> about this approach.
>>
>>
>> regards
>> Matthias
>>
--
Matthias Mühlhausen
Jena University Language and Information Engineering (JULIE) Lab
Phone: +49-3641-944305
Fax: +49-3641-944321
email: matthias.muehlhausen@uni-jena.de
URL: http://www.julielab.de
Re: setting of an Object as a configuration parameter
Posted by Thilo Goetz <tw...@gmx.de>.
Matthias,
that's what external resources are for. You declare them
in a descriptor, and they get loaded once by the framework.
See
http://incubator.apache.org/uima/downloads/releaseDocs/2.2.2-incubating/docs/html/tutorials_and_users_guides/tutorials_and_users_guides.html#ugr.tug.aae.accessing_external_resource_files
A real life example of such an external resource is the
HMM model file of the sandbox Tagger. Check the HmmTagger.xml
descriptor, IModelResource.java and ModelResource.java.
--Thilo
Matthias Mühlhausen wrote:
> Hello,
>
> I have a question concerning the setting of an Object as a configuration
> parameter for an AnalysisEngine:
>
> We are processing a corpus with several threads of the same UIMA
> pipeline. There is a very large Java object or "resource" that is used
> by an AnalysisEngine of this pipeline. it's a Dictionary object that
> needs between 4 and 12GB memory. We would like to create only one object
> and use this in all pipelines, because of the memory footprint. I
> thought it could be possible to create it once and then set it as a
> configuration parameter for all the components. This does not work,
> because an AnalysisEngine does not accept to set an Object as a
> configuration parameter.
> So I thought about two solutions yet:
>
> 1. we use this component not as a AnalysisEngine but as a POJO and set
> the Object by a simple setter.
>
> 2. using JNDI and resolve the object by a name - but I have no
> experience with JNDI, so I would like to have somebody's opinion about
> this approach.
>
>
> regards
> Matthias
>