String[] ConfigurationParameter for External Resource

30 views
Skip to first unread message

Martin Toepfer

unread,
Feb 12, 2013, 12:12:27 PM2/12/13
to uimafi...@googlegroups.com
Hi,

I have a class that extends Resource_ImplBase and has a configuration
parameter:

@ConfigurationParameter(name = PARAM_ANNOTYPENAMES)
private String[] annotationTypeNames

When I try to create a description for it:

String[] ftypes = new String[] {
"org.apache.uima.textmarker.type.html.B",
"org.apache.uima.textmarker.type.html.U",
"org.apache.uima.textmarker.type.html.I" };
ExternalResourceDescription attX = ExternalResourceFactory
.createExternalResourceDescription(AnnotationBasedFCAAttributeExtractor.class,
AnnotationBasedFCAAttributeExtractor.PARAM_ANNOTYPENAMES, ftypes);

I get

Exception in thread "main" java.lang.ClassCastException:
[Ljava.lang.String; cannot be cast to java.lang.String
at
org.uimafit.factory.ExternalResourceFactory.createExternalResourceDescription(ExternalResourceFactory.java:140)
at
org.uimafit.factory.ExternalResourceFactory.createExternalResourceDescription(ExternalResourceFactory.java:103)
at
de.uniwue.medstat.control.Runner4FcaAERunner.main(Runner4FcaAERunner.java:73)

Am I doing something wrong?

Thanks in advance!

Cheers,
Martin

--
MSc. Martin Toepfer Raum: B008
Universitᅵt Wᅵrzburg Tel.: +49-(0)931-31-81856
Am Hubland Fax.: -
97074 Wᅵrzburg mail: martin....@uni-wuerzburg.de

http://www.is.informatik.uni-wuerzburg.de/mitarbeiter/toepfer/

Richard Eckart de Castilho

unread,
Feb 12, 2013, 2:47:32 PM2/12/13
to uimafi...@googlegroups.com
Hi Martin,

for external resources that are derived from "Resource", we currently use a "CustomResourceSpecifier" which supports only Strings. You could try using a shared resource that implements "SharedResourceObject". For those we use a "ConfigurableDataResourceSpecifier" which (I think) supports the usual types. Needs to be tested.

It is possible that alternative implementations of the respective uimaFIT methods are possible which would support the usual types also on normal resources implementing "Resource", but that would require a bit of research. Feel free to report this as an issue/feature request on the Apache Jira.

Cheers,

-- Richard

Richard Eckart de Castilho

unread,
Feb 12, 2013, 3:32:58 PM2/12/13
to uimafi...@googlegroups.com
I just did a quick test:

1) as far as I can tell, UIMA provides no alternative to using a CustomResourceSpecifier for "Resource"s

2) other types can in fact be passed to "SharedResourceObject" implementations. If you just ignore the "load" method and pass no URL or some dummy URL in createExternalResourceDescription() you might get along with that.

I believe to make 1) work, the UIMA core framework needs to be changed.

-- Richard

Martin Toepfer

unread,
Feb 13, 2013, 2:34:44 AM2/13/13
to uimafi...@googlegroups.com
Thanks Richard, using "SharedResourceObject" together with "ExternalResourceAware" works perfectly.

I just did a quick test:

1) as far as I can tell, UIMA provides no alternative to using a CustomResourceSpecifier for "Resource"s

2) other types can in fact be passed to "SharedResourceObject" implementations. If you just ignore the "load" method and pass no URL or some dummy URL in createExternalResourceDescription() you might get along with that.

I believe to make 1) work, the UIMA core framework needs to be changed.

-- Richard

Am 12.02.2013 um 20:47 schrieb Richard Eckart de Castilho <richard.eck...@gmail.com>:

> Hi Martin,

> for external resources that are derived from "Resource", we currently use a "CustomResourceSpecifier" which supports only Strings. You could try using a shared resource that implements "SharedResourceObject". For those we use a "ConfigurableDataResourceSpecifier" which (I think) supports the usual types. Needs to be tested.

> It is possible that alternative implementations of the respective uimaFIT methods are possible which would support the usual types also on normal resources implementing "Resource", but that would require a bit of research. Feel free to report this as an issue/feature request on the Apache Jira.

> Cheers,

> -- Richard

> Am 12.02.2013 um 18:12 schrieb Martin Toepfer <martin.toep...@uni-wuerzburg.de>:

>> Hi,

>> I have a class that extends Resource_ImplBase and has a configuration parameter:

>> @ConfigurationParameter(name = PARAM_ANNOTYPENAMES)
>> private String[] annotationTypeNames

>> When I try to create a description for it:

>>      String[] ftypes = new String[] {
>>      "org.apache.uima.textmarker.type.html.B",
>>      "org.apache.uima.textmarker.type.html.U",
>>      "org.apache.uima.textmarker.type.html.I" };
>>     ExternalResourceDescription attX = ExternalResourceFactory
>> .createExternalResourceDescription(AnnotationBasedFCAAttributeExtractor.class,
>> AnnotationBasedFCAAttributeExtractor.PARAM_ANNOTYPENAMES, ftypes);

>> I get

>> Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.lang.String
>>   at org.uimafit.factory.ExternalResourceFactory.
>> org.uimafit.factory.ExternalResourceFactory.createExternalResourceDescription(ExternalResourceFactory.java:140)
>>   at org.uimafit.factory.ExternalResourceFactory.createExternalResourceDescription(ExternalResourceFactory.java:103)
>>   at de.uniwue.medstat.control.Runner4FcaAERunner.main(Runner4FcaAERunner.java:73)

>> Am I doing something wrong?

>> Thanks in advance!

>> Cheers,
>> Martin


--
MSc. Martin Toepfer      Raum: B008
Universität Würzburg     Tel.: +49-(0)931-31-81856
Am Hubland               Fax.: -
97074 Würzburg           mail: martin....@uni-wuerzburg.de

http://www.is.informatik.uni-wuerzburg.de/mitarbeiter/toepfer/
Reply all
Reply to author
Forward
0 new messages