Yes I did! When I do that it throws the following error -
It throws a cast error stating Type String cannot be converted to String
array.

Harshal


On Wed, May 22, 2013 at 8:03 PM, Marshall Schor <[email protected]> wrote:

> did you have the multi-values setting turned on in the parameter
> specification?
>
>
> On 5/22/2013 10:15 AM, harshal patni wrote:
> > Hi Marshall,
> >                 Thank you for your response. Yes I tried setting and
> array
> > as a second argument of NameValuePair_Impl. However it throws an error
> > since the setType() has only 4 options (String, Boolean, Float,
> Integer). I
> > had to set it to string forcibly, coz if I dont UIMA by default sets it
> to
> > NULL which again causes an error.
> >
> > Harshal
> >
> >
> > On Wed, May 22, 2013 at 7:33 PM, Marshall Schor <[email protected]> wrote:
> >
> >> 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
> >>>>>
>
>


-- 

*Harshal Patni** | *Data Architect | Zynx Health ™

10880 Wilshire Boulevard, Suite 300 | Los Angeles, CA, 90024

Mobile : 937-760-6639| [email protected]
<[email protected]><[email protected]>

<http://www.linkedin.com/in/harshalpatni> |
<http://knoesis.wright.edu/researchers/harshal/>

www.zynxhealth.com <http://www.zynx.com/>

“*Most Interesting Vendor” 2010*
- Healthcare Informatics

Reply via email to