uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eddie Epstein" <eaepst...@gmail.com>
Subject Re: Accessing upstream annotations in downstream C++ AE
Date Fri, 04 Apr 2008 11:57:45 GMT
In Java there are two interfaces to the CAS: the JCas interface and the
"generic" CAS interface. Some Java example code using the generic interface
are in $UIMA_HOME/examples/src/org/apache/uima/examples/cas/.

UIMACPP implements the generic interface, which requires manual resolution
of Type and Feature definitions before accessing them. This resolution is
normally done in the annotator's typeSystemInit() method.

>From typeSystemInit of the C++ version of the meeting annotator,

    //input types
    roomNumberT =
    dateT =  crTypeSystem.getType("org.apache.uima.tutorial.DateAnnot");
    timeT =  crTypeSystem.getType("org.apache.uima.tutorial.TimeAnnot");

The Type object would then be used for things like
    ANIndex roomNumberIndex = tcas.getAnnotationIndex(roomNumberT);

Custom features are handled in a similar way. For more information about the
generic API, see

Hope this helps,

PS Like Java, the method cas.getView( "MyView") will throw an exception if
the specified view does not exist in cas.

On Fri, Apr 4, 2008 at 1:42 AM, Johansson, Justin (Contractor) <
Justin.Johansson@dsto.defence.gov.au> wrote:

> I have an upstream Java AE putting annotations in the CAS of type, say,
> com.my.Foo.
> In a downstream C++ annotator, one can get such annotations as instances
> of AnnotationFS in C++ but not the as the specific type Foo.
> My C++ process() code is along these lines ...
>    CAS* pMyView = cas.getView( "MyView");
>    if ( pMyView)
>        {
>        ANIndex fooIndex = pAudioView->getAnnotationIndex( m_fooType);
>        if ( !fooIndex.isValid())
>        {
>            m_pAnnotatorContext->getLogger().logError( "Error getting
> Foo index");
>            return (TyErrorId) UIMA_ERR_RESMGR_INVALID_RESOURCE;
>        }
>        AnnotationFS foo = fooIndex.iterator().get();
>        if ( !foo.isValid())
>        {
>            m_pAnnotatorContext->getLogger().logError( "Error getting
> Foo FS");
>            return (TyErrorId) UIMA_ERR_RESMGR_INVALID_RESOURCE;
>        }
>        // Problem: How to get Foo specific fields out of foo when it's
> just an AnnotationFS?
>        }
> Observing that there is nothing like a JCasGen for producing C++ header
> files for types, then there must be some other way of accessing the
> annotations in C++.  Looking through the examples though gives me no
> joy.
> Could the list please enlighten me on this aspect of UIMA C++.
> Thanks
> Justin
> IMPORTANT: This email remains the property of the Australian Defence
> Organisation and is subject to the jurisdiction of section 70 of the CRIMES
> ACT 1914.  If you have received this email in error, you are requested to
> contact the sender and delete the email.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message