Changes in uimaFIT 2.x

Backwards compatibility

Compatibility with legacy annotation is provided by the #Legacy support module.

Change of Maven groupId and artifactId

The Maven group ID has changed from org.uimafit to org.apache.uima.

The artifact ID of the main uimaFIT artifact has been changed from uimafit to uimafit-core.

Change of package names to org.apache.uima.fit

The base package has been renamed from org.uimafit to org.apache.uima.fit. A global search/replace on Java files with for lines starting with import org.uimafit and replacing that with import org.apache.uima.fit should work.

Version requirements

Depends on UIMA 2.4.2.

@ConfigurationParameter

The default value for the mandatory attribute now is true.

The default name of configuration parameters is now the name of the annotated field only. The classname is no longer prefixed. The method ConfigurationParameterFactory.createConfigurationParameterName() that was used to generate the prefixed name has been removed.

META-INF/org.uimafit folder

Now the META-INF/org.uimafit was renamed to META-INF/org.apache.uima.fit.

JCasUtil

The deprecated JCasUtil.iterate() methods have been removed. JCasUtil.select() should be used instead.

AnalysisEngineFactory

All createAggregateXXX and createPrimitiveXXX methods have been renamed to createEngineXXX. The old names are deprecated.

All createAnalysisEngineXXX methods have been renamed to createEngineXXX. The old names are deprecated.

CollectionReaderFactory

All createDescriptionXXX methods have been renamed to createReaderDescriptionXXX. The old names are deprecated.

All createCollectionReaderXXX methods have been renamed to createReaderXXX. The old names are deprecated.

JCasIterable

JCasIterable now only accepts reader and engine descriptions (no instances) and no longer implements the Iterator interface. Instead, new JCasIterator has been added, which replaces JCasIterable in that respect.

CasDumpWriter

CASDumpWriter has been renamed to CasDumpWriter.

CpePipeline

CpePipeline has been moved to a separate module with the artifact ID uimafit-cpe to reduce the dependencies incurred by the main uimaFIT artifact.

Legacy support module

The compatibility layer should allow you to migrate to uimaFIT 2.0.0 without breaking anything. You should then be able to gradually change the codebase to be compatible with uimaFIT 2.0.0. As far as my tests go, uimaFIT 1.x and 2.0.0 can coexist peacefully on the classpath (and indeed both need to be on the classpath in order to use the legacy support module).

To enable the legacy support, make sure that you have a dependency on uimaFIT 1.x and then just add a dependency on

<dependency>
  <groupId>org.uimafit</groupId>
  <artifactId>uimafit</artifactId>
  <version>1.4.0</version>
</dependency>
<dependency>
  <groupId>org.apache.uima</groupId>
  <artifactId>uimafit-legacy-support</artifactId>
  <version>2.0.0-SNAPSHOT</version>
</dependency>

uimaFIT 2.x automatically detects the presence of the legacy module and uses it - no additional configuration is necessary.

Migration support

The following script contributed by Renaud Richardet can help users of UNIX-like operating systems in the migration of their
uimaFIT 1.4.x code to uimaFIT 2.0.x.

#!/bin/sh

############################################
# MAKE SURE TO BACKUP YOUR FILES FIRST
############################################

# see http://uima.apache.org/d/uimafit-2.0.0/tools.uimafit.book.html#d5e617

#Change of package names:
find . -name '*.java' -print | xargs perl -p -i -e 's/org.uimafit/org.apache.uima.fit/g'
find . -name '*.java' -print | xargs perl -p -i -e 's/org.uimafit.component.xwriter.CASDumpWriter/org.apache.uima.fit.component.CasDumpWriter/g'

#AnalysisEngineFactory
find . -name '*.java' -print | xargs perl -p -i -e 's/createAggregate/createEngine/g'
find . -name '*.java' -print | xargs perl -p -i -e 's/createPrimitive/createEngine/g'
find . -name '*.java' -print | xargs perl -p -i -e 's/createAnalysisEngine/createEngine/g'
# Readers
find . -name '*.java' -print | xargs perl -p -i -e 's/createDescription/createReaderDescription/g'
find . -name '*.java' -print | xargs perl -p -i -e 's/createCollectionReader/createReader/g'
  • No labels