Search code examples
javaeclipseuima

UIMA custom type with custom feature type range


I'm working on a UIMA project with Eclipse. The project is created as a Maven project and thus has the folder src/main/resources which I use for my type definitions (in the subfolder desc).

Further project information:

  • Group Id: com.example
  • Artifact Id: myproject

I'm trying to create a custom annotation type which also has a feature with a custom range using the "Component Descriptor Editor". Instead of choosing a standard range type from the namespace uima.casor uima.tcas I want the feature to be an object of the class CustomRangeType in my package data.

Component Descriptor Editor with error message

This image depicts the Component Descriptor Editor with my inputs and the corresponding error message:

RangeType 'com.example.myproject.data.CustomRangeType' is unknown. If this is intended, please define it first.

I understand the first sentence (the problem is quite obvious). However, I'm puzzled by the second sentence... I have searched how to "define" a custom range, but haven't been successful. Due to this post (https://stackoverflow.com/a/20895340/3867423), I assume that it is in fact possible to define a custom range type. Unfortunately, I don't know how and couldn't find an answer as well.

I would be very thankful if someone could point me in the right direction.


Solution

  • Before you define a feature with a range of a given type, you need to define that type.

    To do this:

    • press the Add type button
    • in type name enter the name of the type you wish to use as the range, e.g. "com.example.myproject.data.CustomRangeType"
    • choose an appropriate supertype or leave the default
    • press OK

    After that, go back to the adding your feature. You should also now be able to find your type by pressing browse and entering CustomRangeType.

    Disclosure: Apache UIMA project member