most likely this is a problem in building the parameter setting.
I did one of these using the Eclipse editor for UIMA XML files, and looked at
what it generated as the setting:
<configurationParameterSettings>
<nameValuePair>
<name>astringarray</name>
<value>
<array>
<string>x1</string>
<string>x2</string>
</array>
</value>
</nameValuePair>
</configurationParameterSettings>
Have you tried creating NameValuePair_impl instances, with arrays as the 2nd
argument (i.e., the "value")?
for instance:
... new NameValuePair_impl("AttributeList", new String[] {"value1", "value2",
...}) ...
-Marshall
On 5/21/2013 11:34 PM, harshal patni wrote:
> Hello Himanshu,
> I tried setting the setMultivalues(true). The
> problem is the following -
> I use setType (String). I need to do this coz else it takes it as null. But
> as soon as we setType(String) it throws a cast error saying string cannot
> be cast to a String array. If you look at the source code of conceptMapper
> it tried to cast in code.
>
> Hope that makes sense..
> Any idea how this could be resolved?
> Please also add code snippet to make it easier to understand.
>
> Thanks,
> Harshal
>
>
> On Wed, May 22, 2013 at 1:34 AM, Himanshu Gahlot <
> [email protected]> wrote:
>
>> Use setMultiValued()<
>> http://uima.apache.org/downloads/releaseDocs/2.3.0-incubating/docs/api/org/apache/uima/resource/metadata/ConfigurationParameter.html#setMultiValued%28boolean%29
>>> .
>> So, p1.setMultiValued() should make this config param accept multiple
>> String values.
>>
>> Himanshu
>>
>>
>> On Tue, May 21, 2013 at 1:10 AM, Renaud Richardet
>> <[email protected]>wrote:
>>
>>> Hi Harshal,
>>> Have you tried UimaFit? I think it would be a better option, if you do
>> not
>>> want to use XML descriptors.
>>> Hope that helps, Renaud
>>>
>>>
>>> On Tue, May 21, 2013 at 8:49 AM, harshal patni <[email protected]
>>>> wrote:
>>>> Hello Everyone,
>>>> I am currently writing ConceptMapper in code (not
>>> using
>>>> XML files). Basically I am definitely AnalysisEngineDescriptions and
>>>> TypeSystem Description in java code. I create the following 2
>> parameters
>>>> using "ConfigurationParameter" class.
>>>>
>>>> 1. AttributeList
>>>> 2. FeatureList
>>>>
>>>> The problem is both these should be arrays. But ConfigurationParameter
>>> only
>>>> provide the following types (String, Boolean, Integer, Float). When I
>>> pass
>>>> these values as string it fails and throws a
>> java.lang.ClassCastException
>>>> error. COz it expects an array vs a String. How should I solve this
>>> issue?
>>>> Below is the AnalysisEngineDescription code.
>>>>
>>>>
>> //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>>>> primitiveDesc = new AnalysisEngineDescription_impl();
>>>>
>>>> primitiveDesc.setPrimitive(true);
>>>>
>>>> primitiveDesc.getMetaData().setName("Concept Mapper Offset
>> Tokenizer");
>>>> primitiveDesc.setAnnotatorImplementationName(
>>>> "org.apache.uima.conceptMapper.ConceptMapper");
>>>>
>>>>
>>>>
>>>> ConfigurationParameter p1 = new ConfigurationParameter_impl();
>>>>
>>>> p1.setName("AttributeList");
>>>>
>>>> p1.setDescription("Attribute List");
>>>>
>>>> p1.setType(ConfigurationParameter.TYPE_STRING); // Here is the problem
>>>>
>>>> ConfigurationParameter p2 = new ConfigurationParameter_impl();
>>>>
>>>> p2.setName("FeatureList");
>>>>
>>>> p2.setDescription("Feature List");
>>>>
>>>> p2.setType(ConfigurationParameter.TYPE_STRING);
>>>>
>>>>
>>>>
>>>>
>> primitiveDesc.getMetaData().getConfigurationParameterDeclarations().setConfigurationParameters(
>>>> new ConfigurationParameter[] { p1,p2 });
>>>>
>>>>
>>>>
>>>>
>> primitiveDesc.getMetaData().getConfigurationParameterSettings().setParameterSettings(
>>>> new NameValuePair[] { new NameValuePair_impl("AttributeList",
>>> "canonical"),
>>>> new NameValuePair_impl("FeatureList", "DictCanon") });
>>>>
>>>> TypeSystemDescription typeSystem = new
>>> TypeSystemDescription_impl();
>>>> dicTerm(typeSystem);
>>>>
>>>> conceptMapperTokenizer(typeSystem);
>>>>
>>>> baseTokenizer(typeSystem);
>>>>
>>>>
>> primitiveDesc.getAnalysisEngineMetaData().setTypeSystem(typeSystem);
>>>>
>>>>
>> //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>>>> Also how should I pass the dictionary file in code?
>>>>
>>>>
>>>> Thanks,
>>>>
>>>> Harshal
>>>>
>>>
>>>
>>> --
>>> Renaud Richardet
>>> Blue Brain Project PhD candidate
>>> EPFL Station 15
>>> CH-1015 Lausanne
>>> phone: +41-78-675-9501
>>> http://people.epfl.ch/renaud.richardet
>>>