uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Eckart de Castilho <...@apache.org>
Subject Re: Acces external resource outside of an AE
Date Wed, 25 Jun 2014 09:23:13 GMT
Hello Hugo,

the resource is not stored in the resource manager under the name that you specify, but under
a "qualified name" that consists of the qualified context name and the resource key to which
the resource is bound.

The proper way to access the resource after the execution would be through the UIMAContext
of the AE, e.g.

    AnalysisEngine ae = createEngine(
            DummyAE3.RES_KEY_1, createExternalResourceDescription(
                    "lala", AnnotatedResource.class,
                    AnnotatedResource.PARAM_VALUE, "1"));

    ... = ae.getUimaContext().getResourceObject(DummyAE3.RES_KEY_1);

The alternative would be to manually construct the qualified name, which then would go like

   ... = ae.getResourceManager().getResource(
            ae.getUimaContextAdmin().getQualifiedContextName() + DummyAE3.RES_KEY_1);

Sure, uimaFIT ( mind capitalization ;) ) does hide a lot of the details - that's the point!

But the names under which resources are stored in the resource manager is determined by the
UIMA core:

The ResourceManager_Impl has multiple internal lookup tables. The one used for getResource()
uses these qualified names and a resource can appear in there multiple times, bound to multiple
qualified names (multiple AEs). There is another lookp table called mInternalResourceRegistrationMap
in which each resource appears only once under the name that you can optionally specify in
the createExternalResourceDescription call (here "lala"). However, that table is very unfortunately
not accessible.


-- Richard

On 25.06.2014, at 09:37, Hugo Mougard <mog@crydee.eu> wrote:

> Dear UIMA list,
> I've read the different tutorials about resources a couple of times but haven't found
a straightforward way to accomplish what I'm trying to do.
> Using UIMAfit, I declare a resource and use it in several AEs, through a SimplePipeline.
Once the processing is done, I'd like to access that resource (it's some kind of HashMap on
steroids). Accessing it in onCollectionProcessComplete is not enough for me here, because
I run several of such pipelines and need the results of all of them to obtain the information
I'm interested in.
> I've tried accessing it with
>    myAe.getResourceManager().getResource("resName");
> where resName is the name I gave it when declaring it with createExternalResourceDescription.
> However this NPEs and I'm not sure how to proceed from there. It seems UIMAfit is hiding
a lot of details of the original UIMA resource management so I may very well just have missed
some very important concept, if so please enlighten me :)
> Cheers,
> Hugo

View raw message