You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by William Colen <co...@apache.org> on 2017/08/05 12:31:02 UTC

UIMA Fit and fsIndexCollection

Hi,

I am having an issue with UIMA Fit and fsIndexCollection. I
configured META-INF/org.uimafit/fsindexes.txt to load the following
fsIndexCollection:

<?xml version="1.0" encoding="UTF-8"?>

<fsIndexCollection xmlns="http://uima.apache.org/resourceSpecifier">
  <fsIndexes>
    <fsIndexDescription>
      <label>MyFsIndexDescription</label>
      <typeName>myproject.uima.ts.ShiftedAnnotation</typeName>
      <kind>sorted</kind>
      <keys>
        <fsIndexKey>
          <featureName>begin</featureName>
          <comparator>standard</comparator>
        </fsIndexKey>
        <fsIndexKey>
          <featureName>end</featureName>
          <comparator>reverse</comparator>
        </fsIndexKey>
        <fsIndexKey>
          <featureName>index</featureName>
          <comparator>standard</comparator>
        </fsIndexKey>
      </keys>
    </fsIndexDescription>
  </fsIndexes>
</fsIndexCollection>

Debugging the code I can see that the file is loaded
by createFsIndexCollection() during initialization of the AEs.

But when I retrieve the annotation using JCasUtil.indexCovered(...) and the
"index" and I never get the result ordered by index if begin and end are
equal.

Any idea why?

Thank you,
William

Re: UIMA Fit and fsIndexCollection

Posted by Richard Eckart de Castilho <re...@apache.org>.
Hi William,

the uimaFIT JCasUtil/CasUtil methods only use the built-in 
default index for the Annotation type. If you want to use 
a custom index, you have to retrieve that index from the CAS's
index repository and operate on it directly.

Cheers,

-- Richard

> On 05.08.2017, at 14:31, William Colen <co...@apache.org> wrote:
> 
> Hi,
> 
> I am having an issue with UIMA Fit and fsIndexCollection. I
> configured META-INF/org.uimafit/fsindexes.txt to load the following
> fsIndexCollection:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> 
> <fsIndexCollection xmlns="http://uima.apache.org/resourceSpecifier">
>  <fsIndexes>
>    <fsIndexDescription>
>      <label>MyFsIndexDescription</label>
>      <typeName>myproject.uima.ts.ShiftedAnnotation</typeName>
>      <kind>sorted</kind>
>      <keys>
>        <fsIndexKey>
>          <featureName>begin</featureName>
>          <comparator>standard</comparator>
>        </fsIndexKey>
>        <fsIndexKey>
>          <featureName>end</featureName>
>          <comparator>reverse</comparator>
>        </fsIndexKey>
>        <fsIndexKey>
>          <featureName>index</featureName>
>          <comparator>standard</comparator>
>        </fsIndexKey>
>      </keys>
>    </fsIndexDescription>
>  </fsIndexes>
> </fsIndexCollection>
> 
> Debugging the code I can see that the file is loaded
> by createFsIndexCollection() during initialization of the AEs.
> 
> But when I retrieve the annotation using JCasUtil.indexCovered(...) and the
> "index" and I never get the result ordered by index if begin and end are
> equal.
> 
> Any idea why?
> 
> Thank you,
> William