Hello,
I won't address the type system description part, but about the
collection reader, you could make use of reflection to ease the
maintenance overhead (for example with the guava library. The idea would
be to autodetect if types are present in a given package and use them
accordingly. The following snippet will put in a map the classes that
you can use based on a given package and the fact that they implement
Annotation: https://gist.github.com/m09/9885425
You could then use it like so, in the getItemAnnotationForType method:
String annName = annType.replace("-", "").toLowerCase(Locale.English);
if (annotations.containsKey(annName)) {
return
annotations.get(annName).getDeclaredConstructor(JCas.class).newInstance(jcas);
} else {
new UnknownItemAnnotation(jcas);
}
Best,
Hugo
On 03/31/2014 11:56 AM, Andrew MacKinlay wrote:> Hi,
I have a working CollectionReader implementation which converts from
a particular web service to UIMA annotations, based primarily on
uimaFIT. It works OK, but the problem is that the web service has its
own implicit dynamic type system, particularly for document
annotations, and that is currently not being well-handled (I can put a
'type' string as a textual feature, but UIMA is not set up to query
over these kinds of annotations, as far as I can tell, so it seems
suboptimal).
I have now written code which can generate a TypeSystemDescription at
runtime for the dynamic types based on the web service output. However,
I'm not sure how to most sensibly integrate that with my uimaFIT
architecture. Does anyone have any ideas? I guess I could stop using
uimaFIT altogether - maybe it's not the right solution here, (although
I'm also not entirely sure of the best way to handle this in classic
UIMA).
I'd like to keep using uimaFIT if possible though - many other types,
particularly those relating to overall document metadata, are already
working very nicely and succinctly with uimaFIT.
BTW, the current CollectionReader implementation, which hard-codes
handling of some types, and uses the textual string fallback in other
cases, can be found at
https://bitbucket.org/andymackinlay/uimavlab/src/c178fa9ebf5d5ffcad0249dd165ca44cde8dcefd/src/main/java/com/nicta/uimavlab/ItemListCollectionReader.java?at=default
Thanks,
Andy