Am 08.08.2013 um 20:33 schrieb Marshall Schor <[email protected]>:

> On 8/8/2013 12:06 PM, Richard Eckart de Castilho wrote:
>> The methods returned Iterable in earlier versions of uimaFIT, but the 
>> ability to
>> get the number of annotations of the selected type or to check if it was 
>> (non-)empty
>> was sufficiently common that it has been changed to Collection. 
> It's possible to have the method return a class which implements Iterable, and
> has the additional functions, of course; it would not need to implement 
> Collections.
> 
> The implementation of "size" would be potentially slow - since that's not 
> kept;
> it would require iterating through the entire thing and accumulating in a
> counter.  So that might be a "surprise" for users of this interface.

Would it be feasible to make it fast(er) or at least make it fast in simple 
scenarios, e.g. when no conditions are used?

At least isEmpty() should be doable reasonable fast.

>> Also, having it as a Collection allows
>> easily copying of the data into another collection, e.g.
>> 
>> List<Token> tokens = new ArrayList<Token>(select(jcas, Token.class));
> True.  This could also be done with a custom class.  e.g.
> List<Token> tokens = select_v2(jcas, Token.class).toList();

Sounds reasonable. 

This is the kind of discussion that I hoped uimaFIT would spur.

So would you use such functionality in uimaFIT and help cooking it
out for experience and adding such functions to the core later, or
are you keen on adding the stuff to the core asap, so that you can
use it?

UIMA core imho should take a slightly different angle than uimaFIT
on such functionality. E.g. such select() methods should be directly
on the CAS/JCas/FSArray/FSIndexRepsitory etc. interfaces instead of
having static methods.

Cheers,

-- Richard

Reply via email to