On 24.07.2015, at 15:24, Joern Kottmann <[email protected]> wrote:

> Maybe like this:
> cas.setField("confidence", 0.78f);
> Float confidence = cas.getField("confidence", Float.class);

That is a great idea - although I'd personally like to see it at the level of 
FSes ;)

https://issues.apache.org/jira/browse/UIMA-4536

That should greatly simplify interacting with the CAS through the CAS (not 
JCas) API!

Some examples:

// Different ways of setting a value
setFeature(fs, "BooleanArrayValue", true);
setFeature(fs, "BooleanArrayValue", true, false);
setFeature(fs, "BooleanArrayValue", new boolean[] { true, false });
setFeature(fs, "BooleanArrayValue", asList(true, false));

// Different ways of getting a value
assertEquals(true, getFeature(fs, "BooleanArrayValue", List.class).get(0));
assertEquals(false, getFeature(fs, "BooleanArrayValue", List.class).get(1));

assertEquals(true, getFeature(fs, "BooleanArrayValue", boolean[].class)[0]);
assertEquals(false, getFeature(fs, "BooleanArrayValue", boolean[].class)[1]);

I've had some of this in WebAnno already, but having this in uimaFIT (and 
eventually in uimaj-core) in a more comprehensive way makes much more sense.

Cheers,

-- Richard

Reply via email to