uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Eckart de Castilho <richard.eck...@gmail.com>
Subject Re: Using UIMA within an existing application
Date Mon, 25 Mar 2013 23:09:08 GMT

I'm trying to give some general hints. Using these with CPEs, though,
may not work out. For embedding, you might want to have a look at
(the internals of) uimaFIT. 

Am 25.03.2013 um 09:12 schrieb James Baker <james.d.baker@gmail.com>:

> I'm writing an extension to an existing application. The idea is that the
> user will select a CPE descriptor and do some configuration, then the
> application will run the CPE through UIMA and load the results into the
> application.
> I've got a lot of the parts of the code working individually, but I'm
> having a few issues:
> 1) The CPE may include annotators that aren't on the classpath. I can find
> the bin directory that contains the class files (based on the location of
> each annotators descriptor file), and create a URLClassLoader that
> references that directory (and hence finds the annotators) - but I can't
> figure out how to get UIMA to use that classloader.
> Any ideas how I'd do this, or is there a better way of loading in
> annotators that aren't on the classpath? (And no, it isn't feasible to add
> the directories to the classpath before hand)

The place to look at is the ResourceManager. Either you can set the classloader
there or you can implement your own ResourceManager that provides a suitable
classloader. It likely requires manually instantiating components through the
methods provided by the UIMAFramework factory class.

> 2) In order to do the configuration (primarily mapping the UIMA outputs
> from UIMA to my application), I need to know the type system the CPE will
> produce so the user can do the mapping. I can't find a way of getting the
> type system before running the pipeline though.
> Is this achievable through UIMA, or am I going to have to parse the XML
> files myself to build the type system?

You can load the XMLs using the UIMAFramework.getParser (or something like this)
and then work on the parsed descriptor objects. From there it should be fairly
straight to resolve and access the type system descriptors. Then there is a
utility method somewhere to merge them to get the full type system. 

> 3) A much simpler question (I hope). Once I've run the process() method on
> the CPE, how do I get the output? Do I have to have a Consumer in the
> pipeline that will somehow pass the CAS objects to my application, or can I
> get at them directly?

If you instantiate the components yourself, then you can create a CAS using e.g.
using CasCreationUtils (UIMA) or JCasFactory (from uimaFIT), fill it with your data
and then pass it to the process() methods of your components. In the end
you have all the data in the CAS and can extract it from there. That should 
be convenient enough for an embedded pipeline.


-- Richard
View raw message