The C++ Enablement for UIMA provides transparent interoperability for UIMA C++ analytics to run with the Java UIMA SDK platform. Supported components include primitive and aggregate Analysis Engines and Cas Consumers.
Please refer to the UIMA SDK User's Guide and Reference for an introduction to the UIMA SDK and as well as instructions on how to create, run and manage UIMA analytics. The important APIs that support development of UIMA C++ analytics are described below.
The Annotator ( uima::Annotator ) class defines the interface that must be implemented by primitive UIMA C++ components. The C++ component descriptor must specify the framework implementation as follows:
An application that runs a UIMA analysis engine must instantiate a uima::AnalysisEngine from a UIMA component descriptor and call its process method using APIs shown below:
Example annotator and application code can be found in the docs/example directory of the UIMACPP distribution.
(void) ResourceManager::createInstance("My UIMA Application"); //singleton AnalysisEngine * pEngine = Framework::createAnalysisEngine(descriptorfn, errorInfo); //engine CAS* cas = pEngine-newCAS(); //create a CAS //use CAS APIs to add data to be analysed TyErrorId utErrorId = pEngine->process(*cas);//call process cas->reset(); //reset CAS before reuse utErrorId = pEngine->destroy(); //free resources
The AnnotatorContext ( uima::AnnotatorContext ) class associated with an AnalysisEngine provides access to the configuration parameters and other metadata about the Analysis Engine.
The CAS ( uima::CAS ) object consists of the data structure and set of APIs to support the representation of the TypeSystem and instances of these types FeatureStructures. The CAS APIs are virtually identical to those in the Java implementation. To support interoperability, the CAS is serialized into the native environment through the JNI.
The Subject of Analysis or Sofa capability is supported by the uima::SofaFS class. Use uima::CAS::createView() to create a view of a Sofa and uima::CAS::getView() to access the view.
The SofaDataStream ( uima::SofaDataStream ) class provides stream access to Sofa data. Use the method uima::SofaFS::getSofaDataStream() to get a handle to a uima::SofaDataStream object. The support for stream access to local sofa data is built into the UIMACPP library. Handlers for other URI schemes must be registered with the framework. The handler for the file URI scheme can be found in the UIMACPP distribution. To develop custom URI schemes, implement the interface defined in sofastreamhandler.hpp and build a DLL. To make the handlers available to the framework, register the handler by setting the UIMACPP_STREAMHANDLERS environment variable as follows:
Windows: set UIMACPP_STREAMHANDLERS=file:SofaStreamHandlerFile myscheme:mylibrary Linux: export UIMACPP_STREAMHANDLERS=file:SofaStreamHandlerFile myscheme:mylibrary