[
https://issues.apache.org/jira/browse/UIMA-6153?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16981806#comment-16981806
]
Marshall Schor commented on UIMA-6153:
--------------------------------------
I'm having trouble setting up a test case for this, which doesn't initialize
the JCas, in plain UIMA (not using uimaFIT).
The code I'm trying is:
{code:java}
TypeSystemDescription typeSystemDescription =
UIMAFramework.getXMLParser().parseTypeSystemDescription(new
XMLInputSource(typeSystemFile1));
// this file defines x.y.z.SentenceNoJCas, with super: Annotation, and the
project has no JCas cover class for that type.
CASimpl cas = (CASImpl) CasCreationUtils.createCas(typeSystemDescription, new
TypePriorities_impl(), null);
Type type = cas.getTypeSystem().getType("x.y.z.SentenceNoJCas");
cas.indexRepository(addFS(cas.createAnnotation(type, 0, 4));
boolean b = cas.select(type).covering(1, 2).findFirst().isPresent();
System.out.println("should be true: " + b);
{code}
It compiles and runs. What do I need to change to get this to fail?
> 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)