Siguenza wrote:
Is it the same with StringArray, FloatArray, StringList...?
No UIMA support for them ?
I was trying to use these defined types but didn't found out how to use them in AE...


Hi. It is not that there is _no_ UIMA support for FSLists; in fact the UIMA API gives you all the functionality you need for these structures. However, it just gives you only the basic capabilities, no complicated operations like adding a new element to the end of a list (as Thilo mentioned); if you want to do something more complicated, you need to code it yourself using the basic capabilities that are included in the API. For example, if you have a Feature Structure named "mySmurf" that you want to add to the end of an existing non-empty FSList called mySmurfs that is in myJcas:


   NonEmptyFSList currentSmurfs = (NonEmptyFSList) mySmurfs;
   while (!(currentSmurfs.getTail() instanceof EmptyFSList))
      currentSmurfs = (NonEmptyFSList) currentSmurfs.getTail();
   NonEmptyFSList newSmurfs = new NonEmptyFSList(myJcas);
   newSmurfs.setHead(mySmurf);
   newSmurfs.setTail(currentSmurfs.getTail());
   currentSmurfs.setTail(newSmurfs);

I haven't tested the snippet above so there may be bugs; however, you can see the basic idea.

For most purposes, it is easier and more efficient to use an FSArray, especially since the UIMA API's for them have more convenient methods (see the Javadocs for details). However, if you don't know in advance how many items your collection will have, an FSArray can be a huge nuisance because when you add an element you have to create a new FSArray that's one larger than the previous one and copy everything in the old one over to the new one. In that case, an FSList may be a better choice.


Reply via email to