Uploaded image for project: 'UIMA'
  1. UIMA
  2. UIMA-6370

Programmatically creating FSArray subtypes not possible?

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Core Java Framework
    • None

    Description

      When UIMAv3 parses an XMI file and encounters a feature value which has a typed FSArray (e.g. FSArray with element type ...Token), then it deserializes this by default as an array subtype. This means the UIMA Type object bound to the generated FSArray instance is not simply the type for FSArray (where getName() returns "FSArray") but rather a special type which returns e.g. Token[] from getName().

      However, when creating FSArray instances in regular code, this is typically done using new FSArray(...). In this case, a plain FSArray is created which identifies itself as FSArray via getType().getName().

      One effect of this is that any approach of comparing annotations which uses internally calls Type.getName() may find that an array obtained from the XMI file is different from an array that was freshly created by our components - because the XMI one might identify itself to be a Token[] and the freshly created one might identify itself as FSArray - even though they are otherwise equivalent (same content, same functionality, etc.).

      As a temporary workaround, the creation of FSArray subtypes can be globally disabled by setting the system property uima.disable_subtype_fsarray_creation (CASImpl.DISABLE_SUBTYPE_FSARRAY_CREATION).

      I haven't found a way to actually create these subtypes in the UIMA API. I can see it being done during deserialization, but I have no idea how to do it when programmatically creating feature structures.

      Attachments

        Activity

          People

            Unassigned Unassigned
            rec Richard Eckart de Castilho
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: