On 6/6/11 12:12 PM, Jörn Kottmann wrote:
Hi all,
the Cas Editor does not support types which have features which
are restricted by allowedValues.
It would be nice if I could get a little help to implement this
correctly.
The CAS defines methods to retrieve the value of a feature, in case it is
a primitive feature the Cas Editor needs a method which retrieves the
primitive feature as a "primitive" java Object (e.g. Integer, Boolean,
String, etc.).
The util method which does this, cannot deal with the case of
allowedValues.
org.apache.uima.caseditor.editor.util.Primitives.getPrimitiv(...)
I believe it should test based on the primitive Type objects instead
of the type name
and check if the input type is equal or a subtype. Based on that it
should be possible
to call the CAS methods to retrieve the value.
I re-factored the Primitives class a little, and now all tests are done
on type objects
and noticed that it is possible to set a feature with a few allowed
values just to anything?
Shouldn't the call FeatureStructure.setStringFeature(...) fail if the
new string value is not
defined in the allowed values set?
Anyway that is not an issue for me since the Cas Editor will restrict it
to set only
allowed values.
Is it possible to determine if a Type restricts the values via allowed
values,
and if so get a list of all allowed values? I would need both to
create a combo
box where a user can select a value out of the allowed values.
I will use the LowLevelTypeSystem for this as proposed by Richard.
Jörn