Hello,

the UIMA lists are linked lists and - to my knowledge - offer no convenient 
API. As an illustration of how to use them, consider the following method which 
takes a Collection of strings and turns it into an UIMA StringList. This method 
is part of the uimaFIT FSCollectionFactory class.

http://code.google.com/p/uimafit/source/browse/trunk/uimaFIT/src/main/java/org/uimafit/util/FSCollectionFactory.java
 

        public static StringList createStringList(JCas aJCas, 
Collection<String> aCollection)
        {
                if (aCollection.size() == 0) {
                        return new EmptyStringList(aJCas);
                }

                NonEmptyStringList head = new NonEmptyStringList(aJCas);
                NonEmptyStringList list = head;
                Iterator<String> i = aCollection.iterator();
                while (i.hasNext()) {
                        head.setHead(i.next());
                        if (i.hasNext()) {
                                head.setTail(new NonEmptyStringList(aJCas));
                                head = (NonEmptyStringList) head.getTail();
                        }
                        else {
                                head.setTail(new EmptyStringList(aJCas));
                        }
                }

                return list;
        }

Cheers,

-- Richard

Am 28.09.2011 um 11:34 schrieb abhishek:

> Hi,
> I have created one Feature in Types. The feature rangeType is FSList&nbsp;and 
> &nbsp;element Type is another Annotator class(ParagraphAnnotation which 
> extends org.apache.uima.jcas.tcas.Annotation&nbsp;).
> &nbsp;
> Now, I am not able to find out a way to set the value of this feature.
> &nbsp;
> Example:
> &nbsp;
> List&lt;MyClass&gt;sample= new Arraylist&lt;MyClass&gt;();
> MyClass c = new MyClass();
> sample.add(c);
> &nbsp;
> &nbsp;
> &nbsp;
> Is there a way to replicate similar situation mentioned above in UIMA FSList 
> code.
> &nbsp;
> &nbsp;
> Kindly help

-- 
------------------------------------------------------------------- 
Richard Eckart de Castilho
Technical Lead
Ubiquitous Knowledge Processing Lab 
FB 20 Computer Science Department      
Technische Universität Darmstadt 
Hochschulstr. 10, D-64289 Darmstadt, Germany 
phone [+49] (0)6151 16-7477, fax -5455, room S2/02/B117
[email protected] 
www.ukp.tu-darmstadt.de 
Web Research at TU Darmstadt (WeRC) www.werc.tu-darmstadt.de
------------------------------------------------------------------- 




Reply via email to