uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eddie Epstein <eaepst...@gmail.com>
Subject Re: Restrictions on sofa data array
Date Wed, 28 Apr 2010 11:51:15 GMT
It did occur to me after that the string array may not be supported, but
this could be considered a lack of imagination in the original implementation
rather than any fundamental design limitation :)

The changes to allow use of a string array for Sofa data would not be much.
Additional work probably needed for delta-CAS serialization used with remote
UIMA AS service replies.

Regards,
Eddie

On Wed, Apr 28, 2010 at 3:00 AM, Klaus Rothenhäusler <rothenha@gmail.com> wrote:
> Eddie Epstein <eaepstein@...> writes:
>
>>
>> On Tue, Apr 27, 2010 at 10:59 AM, Thilo Goetz <twgoetz@...> wrote:
>> > My understanding is that he wants the tokens as primitives,
>> > not the characters.  Annotation offsets could then be token
>> > offsets, not character offsets.  That's perfectly reasonable
>> > for some tasks.  We usually create annotations with the start
>> > offset being the start of some token, and the end offset the
>> > end of some token.  Then it's hard to find the tokens that
>> > are "covered" by the annotation, which is why we have
>> > subiterators, which are not super efficient.  And so on.
>> > I like the idea, but I have no idea how compatible it is with
>> > UIMA's idea of views and sofas.
>>
>> A StringArrayFS can be used as Sofa data.
>
> Are you sure? The documentation explicitly denies that
> (http://uima.apache.org/downloads/releaseDocs/2.3.0-incubating/
> docs/html/tutorials_and_users_guides/
> tutorials_and_users_guides.html#ugr.tug.aas.setting_accessing_sofa_data):
>
> [...]
> aCas.setSofaDataArray(feature_structure_primitive_array,
>                      mime_type_string);
> [...]
> Feature Structure primitive arrays are all the UIMA Array types except
> arrays of Feature Structures, Strings, and Booleans. Typically, these
> are arrays of bytes, but can be other types, such as floats, longs,
> etc.
> [...]
>
> And as far as I can see in the implementation for
> setLocalSofaData(FeatureStructure aFS) in SofaFSImpl.java this
> restriction is endorsed through following lines (77-92):
> [...]
> Type type = aFS.getType();
> if (!type.isArray()) {
>   CASRuntimeException e = new CASRuntimeException(...);
>   throw e;
> }
> if (   !type.getName().equals(CAS.TYPE_NAME_BYTE_ARRAY)
>    && !type.getName().equals(CAS.TYPE_NAME_DOUBLE_ARRAY)
>    && !type.getName().equals(CAS.TYPE_NAME_FLOAT_ARRAY)
>    && !type.getName().equals(CAS.TYPE_NAME_INTEGER_ARRAY)
>    && !type.getName().equals(CAS.TYPE_NAME_LONG_ARRAY)
>    && !type.getName().equals(CAS.TYPE_NAME_SHORT_ARRAY)) {
>   CASRuntimeException e = new CASRuntimeException(
>     CASRuntimeException.INAPPROP_TYPE,
>     new String[] {
>     "Byte/Float/Integer/Short/String/Long/Double Array",
>     type.getName() });
>   throw e;
> }
> [...]
>
> Even though the exception message suggests differently.
>
> Am I missing something?
>
> Regards
> --Klaus
>
>

Mime
View raw message