[ 
https://issues.apache.org/jira/browse/UIMA-6153?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16981895#comment-16981895
 ] 

Marshall Schor edited comment on UIMA-6153 at 11/25/19 9:25 PM:
----------------------------------------------------------------

one idea that might work, but seems messy, is to duplicate both the SelectFSs 
and SelectFSs_impl into SelectFSsAnnot and SelectFSsAnnot_impl, the only 
difference being the top bound of the generic parameter.

Then, whenever a method in SelectFSs implies a restriction to Annotations (e.g. 
"covering", or "at", etc.), have it create a copy of the SelectFSs_impl -> a 
new instance of SelectFSsAnnot_impl, and return that.  So that from then on, 
all the methods will be against the SelectFSsAnnot interface/class.

This would be slightly inefficient (making an extra object, whenever an 
Annotation restriction happened).  And it remains to be seen, if it can even 
work (kind of depends on finding a way to create the instance of 
SelectFSsAnnot_impl and pass in the maybe-bound type - don't know if that's 
even possible.  Do people think it would be worth it?  Is there a better way?


was (Author: schor):
one idea that might work, but seems messy, is to duplicate both the SelectFSs 
and SelectFSs_impl into SelectFSsAnnot and SelectFSsAnnot_impl, the only 
difference being the top bound of the generic parameter.

Then, whenever a method in SelectFSs implies a restriction to Annotations (e.g. 
"covering", or "at", etc.), have it create a copy of the SelectFSs_impl -> a 
new instance of SelectFSsAnnot_impl, and return that.  So that from then on, 
all the methods will be against the SelectFSsAnnot interface/class.

This would be slightly inefficient (making an extra object, whenever an 
Annotation restriction happened).  Do people think it would be worth it?  Is 
there a better way?

> select.covering should bind to AnnotationFS
> -------------------------------------------
>
>                 Key: UIMA-6153
>                 URL: https://issues.apache.org/jira/browse/UIMA-6153
>             Project: UIMA
>          Issue Type: Improvement
>          Components: UIMA
>    Affects Versions: 3.1.1SDK
>            Reporter: Richard Eckart de Castilho
>            Priority: Major
>
> The following code does not compile because select.covering() uses TOP 
> instead of AnnotationFS as the generic type. Consequently, getBegin() and 
> getEnd() are not available on the "s" used in the filter expressions. But 
> since covering() only makes sense for annotations, binding the generic type 
> to TOP doesn't seem to make much sense:
> {{return aCas.select(getType(aCas, Sentence.class)).covering(aBegin1, 
> aBegin1)}}
> {{    .filter(s -> s.getBegin() <= aBegin1 && aBegin1 < s.getEnd())}}
> {{    .filter(s -> s.getBegin() <= aBegin2 && aBegin2 < 
> s.getEnd()).findFirst()}}
> {{    .isPresent();}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to