uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Lally" <ala...@alum.rpi.edu>
Subject Re: typeSystemInit() method in CasAnnotator_ImplBase but not JCasAnnotator_ImplBase
Date Wed, 27 Jun 2007 13:48:29 GMT
On 6/26/07, Philip Ogren <philip@ogren.info> wrote:
> Thilo had pointed me towards the method typeSystemInit() in a recent
> posting as a way of getting type system information in an annotator.  Is
> there a reason that this method exists in CasAnnotator_ImplBase but not
> JCasAnnotator_ImplBase?  Or is this an omission?  My intuition is that
> might have been left out on purpose because when using the JCas you
> typically would have a fixed type system that is determined at compile
> time. Still, it seems useful to be able to override typeSystemInit()
> even if it is only called once.  I didn't really think carefully about
> which Annotator_ImplBase I should use.  Are there far reaching
> consequences I should consider - or is it really just about convenience
> at the API level?

Yes, I think this was left out because JCas-annotators don't need to
acquire Type and Feature handles in the same way that CAS-annotators
do.  Maybe that was a mistake.

The logic in CasAnnotator_ImplBase to determine if the type system
changed is pretty simple - in each call to process(CAS) it just calls
the following method to checksif CAS.getTypeSystem() is == to the type
system of the CAS it got last:

   * Checks it the type system of the given CAS is different from the
last type system this
   * component was operating on. If it is different, calls the
typeSystemInit method on the
   * component.
  private void checkTypeSystemChange(CAS aCAS) throws
AnalysisEngineProcessException {
    TypeSystem typeSystem = aCAS.getTypeSystem();
    if (typeSystem != mLastTypeSystem) {
      mLastTypeSystem = typeSystem;

So a workaround is to just copy this logic to your annotator.


View raw message