Richard Eckart de Castilho created UIMA-6370:
------------------------------------------------

             Summary: Programmatically creating FSArray subtypes not possible?
                 Key: UIMA-6370
                 URL: https://issues.apache.org/jira/browse/UIMA-6370
             Project: UIMA
          Issue Type: Bug
          Components: Core Java Framework
            Reporter: Richard Eckart de Castilho


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.



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

Reply via email to