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: nconsistent API for engine and resource creation?
Date Tue, 20 Oct 2015 18:22:44 GMT
Hi,

UIMA supports different types of resource specifiers that can be used
for external resources. Some of them support the same types of
parameters as regular UIMA components, other support only String parameters.

If you look a bit up from line 177, you'll see another part of an if
statement which does not the cast - which is for resources created through
a ConfigurableDataResourceSpecifier.

At the time I wrote this, I didn't find a way to convince UIMA to accept
non-String parameters on other kinds of resources... unless I guess I 
would have had to make changes to the factoryConfig.xml file and actually
implement a new kind of specifier.

See also https://issues.apache.org/jira/browse/UIMA-2978

Maybe you have an idea how to solve this ;)

Best,

-- Richard

> On 20.10.2015, at 19:01, José Tomás Atria <jtatria@gmail.com> wrote:
> 
> I had posted the message below to the old uimafit-users list and didn't
> notice it was no onger being used. See message below.
> 
> =====
> 
> Hello,
> 
> i just noticed that the method for creation of analysis engines and
> external resources is different.
> 
> For AE's, this works:
> 
> AnalysisEngineFactory.createEngineDescription(
>   SomeEngine.class,SomeEngine.PARAM_BOOLEAN, true
> )
> 
> But for external resources, the same syntax fails with a ClassCastException
> 
> ExternalResourceFactory.createExternalResourceDescription(
>    SomeResource.class, SomeResource.PARAM_BOOLEAN, true
> )
> 
> Looking at the code, I see that
> ExternalResourceFactory.createExternalResourceDescription(String,Class<?
> extends Resource>,Object...), which is called by the method above, actually
> casts parameter values to String on line 177.
> 
> Why is this so? Wouldn't it be preferable to have a consistent interface
> for all component types?
> 
> Thanks!
> jta


Mime
View raw message