You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by re...@apache.org on 2016/08/11 13:13:56 UTC

svn commit: r1755976 - in /uima/uimaj/trunk/uimaj-core/src: main/java/org/apache/uima/cas/impl/ main/java/org/apache/uima/util/ test/java/org/apache/uima/util/ test/resources/ExampleCas/

Author: rec
Date: Thu Aug 11 13:13:56 2016
New Revision: 1755976

URL: http://svn.apache.org/viewvc?rev=1755976&view=rev
Log:
[UIMA-4685] Implement lenient loading for COMPRESSED_FILTERED_TSI and add tests for lenient loading of XMI, XCAS, and COMPRESSED_FILTERED_TSI.

Added:
    uima/uimaj/trunk/uimaj-core/src/test/resources/ExampleCas/testTypeSystem_variation.xml   (with props)
Modified:
    uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
    uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/CasIOUtils.java
    uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/util/CasIOUtilsTest.java

Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java?rev=1755976&r1=1755975&r2=1755976&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java Thu Aug 11 13:13:56 2016
@@ -1385,7 +1385,7 @@ public class CASImpl extends AbstractCas
 
     try {
       Header h = CommonSerDes.readHeader(dis);
-      return reinit(h, istream);
+      return reinit(h, istream, null);
     } catch (IOException e) {
       String msg = e.getMessage();
       if (msg == null) {
@@ -1405,13 +1405,15 @@ public class CASImpl extends AbstractCas
    * needed if the blob is from C++ -- C++ blob serialization writes data in
    * native byte order.
    * 
+   * @param h -
    * @param istream -
+   * @param leniently -
    * @return -
    * @throws CASRuntimeException wraps IOException
    */
-  public SerialFormat reinit(Header h, InputStream istream) throws CASRuntimeException {
+  public SerialFormat reinit(Header h, InputStream istream, TypeSystemImpl originalTS) throws CASRuntimeException {
     if (this != this.svd.baseCAS) {
-      return this.svd.baseCAS.reinit(h, istream);
+      return this.svd.baseCAS.reinit(h, istream, originalTS);
     }
    
     final DataInputStream dis = CommonSerDes.maybeWrapToDataInputStream(istream);
@@ -1432,7 +1434,7 @@ public class CASImpl extends AbstractCas
       
       if (h.form6) { 
         try {
-          (new BinaryCasSerDes6(this)).deserializeAfterVersion(dis, delta, AllowPreexistingFS.allow);
+          (new BinaryCasSerDes6(this, originalTS)).deserializeAfterVersion(dis, delta, AllowPreexistingFS.allow);
           return h.typeSystemIncluded ? SerialFormat.COMPRESSED_FILTERED_TSI
                   : SerialFormat.COMPRESSED_FILTERED;
         } catch (ResourceInitializationException e) {

Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/CasIOUtils.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/CasIOUtils.java?rev=1755976&r1=1755975&r2=1755976&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/CasIOUtils.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/CasIOUtils.java Thu Aug 11 13:13:56 2016
@@ -44,6 +44,7 @@ import org.apache.uima.cas.impl.CASSeria
 import org.apache.uima.cas.impl.CommonSerDes;
 import org.apache.uima.cas.impl.CommonSerDes.Header;
 import org.apache.uima.cas.impl.Serialization;
+import org.apache.uima.cas.impl.TypeSystemImpl;
 import org.apache.uima.cas.impl.XCASDeserializer;
 import org.apache.uima.cas.impl.XCASSerializer;
 import org.apache.uima.cas.impl.XmiCasDeserializer;
@@ -296,20 +297,31 @@ public class CasIOUtils {
     DataInputStream deserIn = CommonSerDes.maybeWrapToDataInputStream(casInputStream);
     if (CommonSerDes.isBinaryHeader(deserIn)) {   
       Header h = CommonSerDes.readHeader(deserIn);
+      TypeSystemImpl ts = null;
       if (h.isTypeSystemIncluded()) { // Load TSI from CAS stream
         try {
           ObjectInputStream ois = new ObjectInputStream(deserIn);
           CASMgrSerializer casMgrSerializer = (CASMgrSerializer) ois.readObject();
-          casImpl.setupCasFromCasMgrSerializer(casImpl, casMgrSerializer);  
+          if (!leniently) {
+            casImpl.setupCasFromCasMgrSerializer(casImpl, casMgrSerializer);  
+          } else {
+            ts = casMgrSerializer.getTypeSystem();
+            ts.commit();
+          }
         } catch (ClassNotFoundException e) {
           /**Unrecognized serialized CAS format*/
           throw new CASRuntimeException(CASRuntimeException.UNRECOGNIZED_SERIALIZED_CAS_FORMAT);
         }       
       }
       else if (casMgr != null) { // if TSI not in file, maybe set it from parameter
-        casImpl.setupCasFromCasMgrSerializer(casImpl, casMgr);  
+        if (!leniently) {
+          casImpl.setupCasFromCasMgrSerializer(casImpl, casMgr);  
+        } else {
+          ts = casMgr.getTypeSystem();
+          ts.commit();
+        }
       }
-      return casImpl.reinit(h, casInputStream);
+      return casImpl.reinit(h, casInputStream, ts);
     } else {
       // is a Java Object serialization, with or without a type system
       ObjectInputStream ois = new ObjectInputStream(casInputStream);

Modified: uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/util/CasIOUtilsTest.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/util/CasIOUtilsTest.java?rev=1755976&r1=1755975&r2=1755976&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/util/CasIOUtilsTest.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/util/CasIOUtilsTest.java Thu Aug 11 13:13:56 2016
@@ -18,6 +18,8 @@
  */
 package org.apache.uima.util;
 
+import static java.util.Arrays.asList;
+
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
@@ -25,11 +27,17 @@ import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.ObjectOutput;
 import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
 
 import org.apache.uima.UIMAFramework;
 import org.apache.uima.cas.CAS;
 import org.apache.uima.cas.CASRuntimeException;
+import org.apache.uima.cas.FSIterator;
+import org.apache.uima.cas.FeatureStructure;
 import org.apache.uima.cas.SerialFormat;
+import org.apache.uima.cas.impl.CASMgrSerializer;
 import org.apache.uima.resource.metadata.FsIndexDescription;
 import org.apache.uima.resource.metadata.TypeSystemDescription;
 import org.apache.uima.resource.metadata.impl.TypePriorities_impl;
@@ -41,93 +49,177 @@ import junit.framework.TestCase;
 public class CasIOUtilsTest extends TestCase{
 
   private static final int SIMPLE_CAS_DEFAULT_INDEX_SIZE = 7;
+  private static final int SIMPLE_CAS_DEFAULT_INDEX_SIZE_LENIENT = 5;
+  private static final int SIMPLE_CAS_ALL_INDEXED_SIZE = 8;
+  private static final int SIMPLE_CAS_ALL_INDEXED_SIZE_LENIENT = 6;
   
   private CAS cas;
+  private CAS cas2;
 
   public CasIOUtilsTest(String arg0) {
     super(arg0);
   }
   
   protected void setUp() throws Exception {
-    File typeSystemFile = JUnitExtension.getFile("ExampleCas/testTypeSystem.xml");
     File indexesFile = JUnitExtension.getFile("ExampleCas/testIndexes.xml");
+    FsIndexDescription[] indexes = UIMAFramework.getXMLParser()
+            .parseFsIndexCollection(new XMLInputSource(indexesFile)).getFsIndexes();
 
+    File typeSystemFile = JUnitExtension.getFile("ExampleCas/testTypeSystem.xml");
     TypeSystemDescription typeSystem = UIMAFramework.getXMLParser().parseTypeSystemDescription(
             new XMLInputSource(typeSystemFile));
-    FsIndexDescription[] indexes = UIMAFramework.getXMLParser().parseFsIndexCollection(new XMLInputSource(indexesFile))
-            .getFsIndexes();
+    
     cas = CasCreationUtils.createCas(typeSystem, new TypePriorities_impl(), indexes);
-    FileInputStream casInputStream = new FileInputStream(JUnitExtension.getFile("ExampleCas/simpleCas.xmi"));
-    CasIOUtils.load(casInputStream, cas);
-    if(casInputStream != null) {
-      casInputStream.close();
+    
+    try (FileInputStream casInputStream = new FileInputStream(
+            JUnitExtension.getFile("ExampleCas/simpleCas.xmi"))) {
+      CasIOUtils.load(casInputStream, cas);
     }
+
+    File typeSystemFile2 = JUnitExtension.getFile("ExampleCas/testTypeSystem_variation.xml");
+    TypeSystemDescription typeSystem2 = UIMAFramework.getXMLParser().parseTypeSystemDescription(
+            new XMLInputSource(typeSystemFile2));
+    cas2 = CasCreationUtils.createCas(typeSystem2, new TypePriorities_impl(), indexes);
   }
   
-  public void testXMI() throws Exception {
+  public void testXMI() throws Exception
+  {
+    testXMI(false);
+  }
+
+  public void testXMILenient() throws Exception
+  {
+    testXMI(true);
+  }
+
+  public void testXMI(boolean leniently) throws Exception {
     File casFile = new File("target/temp-test-output/simpleCas.xmi");
     casFile.getParentFile().mkdirs();
     FileOutputStream docOS = new FileOutputStream(casFile);
     CasIOUtils.save(cas, docOS, SerialFormat.XMI);
     docOS.close();
-    cas.reset();
-    FileInputStream casInputStream = new FileInputStream(casFile);
-    CasIOUtils.load(casInputStream, cas);
-    casInputStream.close();
-    Assert.assertEquals(SIMPLE_CAS_DEFAULT_INDEX_SIZE, cas.getAnnotationIndex().size());
-    cas.reset();
-    CasIOUtils.load(casFile.toURI().toURL(), cas);
-    Assert.assertEquals(SIMPLE_CAS_DEFAULT_INDEX_SIZE, cas.getAnnotationIndex().size());
+    
+    // Use a CAS initialized with the "correct" type system or with a different type system?
+    CAS casToUse = leniently ? cas2 : cas;
+
+    casToUse.reset();
+    try (FileInputStream casInputStream = new FileInputStream(casFile)) {
+      CasIOUtils.load(casInputStream, (CASMgrSerializer) null, casToUse, leniently);
+    }
+    assertCorrectlyLoaded(casToUse, leniently);
+    
+    casToUse.reset();
+    CasIOUtils.load(casFile.toURI().toURL(), null, casToUse, leniently);
+    assertCorrectlyLoaded(casToUse, leniently);
   }
   
-  public void testXCAS() throws Exception {
+  public void testXCAS() throws Exception
+  {
+    testXMI(false);
+  }
+
+  public void testXCASLenient() throws Exception
+  {
+    testXMI(true);
+  }
+
+  public void testXCAS(boolean leniently) throws Exception {
     File casFile = new File("target/temp-test-output/simpleCas.xcas");
     casFile.getParentFile().mkdirs();
-    FileOutputStream docOS = new FileOutputStream(casFile);
-    CasIOUtils.save(cas, docOS, SerialFormat.XCAS);
-    docOS.close();
-    cas.reset();
-    CasIOUtils.load(casFile.toURI().toURL(), cas);
-    Assert.assertEquals(SIMPLE_CAS_DEFAULT_INDEX_SIZE, cas.getAnnotationIndex().size());
+    try (FileOutputStream docOS = new FileOutputStream(casFile)) {
+      CasIOUtils.save(cas, docOS, SerialFormat.XCAS);
+    }
+    
+    // Use a CAS initialized with the "correct" type system or with a different type system?
+    CAS casToUse = leniently ? cas2 : cas;
+    
+    casToUse.reset();
+    CasIOUtils.load(casFile.toURI().toURL(), null, casToUse, leniently);
+    assertCorrectlyLoaded(casToUse, leniently);
   }
 
   public void testS() throws Exception {
-    testFormat(SerialFormat.SERIALIZED, "bins");
+    testFormat(SerialFormat.SERIALIZED, "bins", false);
   }
   
   public void testSp() throws Exception {
-    testFormat(SerialFormat.SERIALIZED_TSI, "binsp");
+    testFormat(SerialFormat.SERIALIZED_TSI, "binsp", false);
   }
   
-  
   public void testS6p() throws Exception {
-    testFormat(SerialFormat.COMPRESSED_FILTERED_TSI, "bins6p");
+    testFormat(SerialFormat.COMPRESSED_FILTERED_TSI, "bins6p", false);
   }
-  
+
+  public void testS6pLenient() throws Exception {
+    testFormat(SerialFormat.COMPRESSED_FILTERED_TSI, "bins6", true);
+  }
+
   public void testS0() throws Exception {
-    testFormat(SerialFormat.BINARY, "bins0");
+    testFormat(SerialFormat.BINARY, "bins0", false);
   }
   
   public void testS4() throws Exception {
-    testFormat(SerialFormat.COMPRESSED, "bins4");
+    testFormat(SerialFormat.COMPRESSED, "bins4", false);
   }
   
   public void testS6() throws Exception {
-    testFormat(SerialFormat.COMPRESSED_FILTERED, "bins6");
+    testFormat(SerialFormat.COMPRESSED_FILTERED, "bins6", false);
   }
-    
-  private void testFormat(SerialFormat format, String fileEnding) throws Exception {
+
+  private void testFormat(SerialFormat format, String fileEnding, boolean leniently) throws Exception {
     File casFile = new File("target/temp-test-output/simpleCas."+ fileEnding);
     casFile.getParentFile().mkdirs();
     FileOutputStream docOS = new FileOutputStream(casFile);
     CasIOUtils.save(cas, docOS, format);
     docOS.close();
-    cas.reset();
+    
+    // Use a CAS initialized with the "correct" type system or with a different type system?
+    CAS casToUse = leniently ? cas2 : cas;
+    casToUse.reset();
+    
     FileInputStream casInputStream = new FileInputStream(casFile);
-    SerialFormat loadedFormat = CasIOUtils.load(casInputStream, cas);
+    SerialFormat loadedFormat = CasIOUtils.load(casInputStream, (CASMgrSerializer) null, casToUse, leniently);
     casInputStream.close();
     Assert.assertEquals(format, loadedFormat);
-    Assert.assertEquals(SIMPLE_CAS_DEFAULT_INDEX_SIZE, cas.getAnnotationIndex().size());
+    assertCorrectlyLoaded(casToUse, leniently);
+  }
+  
+  private static void assertCorrectlyLoaded(CAS cas, boolean leniently) throws Exception {
+    // Check if all the annotations are there (mind the file contains FSes that are NOT annotations!)
+    Assert.assertEquals(
+            leniently ? SIMPLE_CAS_DEFAULT_INDEX_SIZE_LENIENT : SIMPLE_CAS_DEFAULT_INDEX_SIZE,
+            cas.getAnnotationIndex().size());
+    
+    // Count ALL FSes now, including the ones that are not annotations!
+    List<String> expectedTypes = new ArrayList<>(asList(
+            "org.apache.uima.testTypeSystem.Entity", 
+            "org.apache.uima.testTypeSystem.Organization", 
+            "org.apache.uima.testTypeSystem.Owner", 
+            "org.apache.uima.testTypeSystem.Person", 
+            "uima.tcas.DocumentAnnotation"));
+    
+    if (leniently) {
+      // This type was renamed to "org.apache.uima.testTypeSystem.OwnerRenamed"
+      expectedTypes.remove("org.apache.uima.testTypeSystem.Owner");
+    }
+    
+    List<String> fsTypes = new ArrayList<>();
+    FSIterator<FeatureStructure> fsi = cas.getIndexRepository()
+            .getAllIndexedFS(cas.getTypeSystem().getTopType());
+    int fsCount = 0;
+    while (fsi.hasNext()) {
+      String typeName = fsi.next().getType().getName();
+      if (!fsTypes.contains(typeName)) {
+        fsTypes.add(typeName);
+      }
+      fsCount++;
+    }
+    Collections.sort(fsTypes);
+    
+    Assert.assertEquals(
+            leniently ? SIMPLE_CAS_ALL_INDEXED_SIZE_LENIENT : SIMPLE_CAS_ALL_INDEXED_SIZE, fsCount);
+    
+    Assert.assertEquals(expectedTypes, fsTypes);
   }
   
   public void testWrongInputStream() throws Exception {

Added: uima/uimaj/trunk/uimaj-core/src/test/resources/ExampleCas/testTypeSystem_variation.xml
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/test/resources/ExampleCas/testTypeSystem_variation.xml?rev=1755976&view=auto
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/test/resources/ExampleCas/testTypeSystem_variation.xml (added)
+++ uima/uimaj/trunk/uimaj-core/src/test/resources/ExampleCas/testTypeSystem_variation.xml Thu Aug 11 13:13:56 2016
@@ -0,0 +1,566 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<typeSystemDescription xmlns="http://uima.apache.org/resourceSpecifier">
+  <name/>
+  <description>Same as testTypeSystem.xml except that org.apache.uima.testTypeSystem.Owner is here called org.apache.uima.testTypeSystem.OwnerRenamed. This is used to test lenient loading.</description>
+  <version/>
+  <vendor/>
+  <types>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.EntityAnnotation</name>
+      <description/>
+      <supertypeName>uima.tcas.Annotation</supertypeName>
+      <features>
+        <featureDescription>
+          <name>links</name>
+          <description/>
+          <rangeTypeName>uima.cas.FSList</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>componentId</name>
+          <description/>
+          <rangeTypeName>uima.cas.String</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>mentionType</name>
+          <description/>
+          <rangeTypeName>uima.cas.String</rangeTypeName>
+        </featureDescription>
+      </features>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.RelationAnnotation</name>
+      <description/>
+      <supertypeName>uima.tcas.Annotation</supertypeName>
+      <features>
+        <featureDescription>
+          <name>links</name>
+          <description/>
+          <rangeTypeName>uima.cas.FSList</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>componentId</name>
+          <description/>
+          <rangeTypeName>uima.cas.String</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>predicate</name>
+          <description/>
+          <rangeTypeName>uima.tcas.Annotation</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>relationArgs</name>
+          <description/>
+          <rangeTypeName>org.apache.uima.testTypeSystem.RelationArgs</rangeTypeName>
+        </featureDescription>
+      </features>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.RelationArgs</name>
+      <description/>
+      <supertypeName>uima.cas.TOP</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.BinaryRelationArgs</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.RelationArgs</supertypeName>
+      <features>
+        <featureDescription>
+          <name>domainValue</name>
+          <description/>
+          <rangeTypeName>uima.tcas.Annotation</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>rangeValue</name>
+          <description/>
+          <rangeTypeName>uima.tcas.Annotation</rangeTypeName>
+        </featureDescription>
+      </features>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.GenericRelationArgs</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.RelationArgs</supertypeName>
+      <features>
+        <featureDescription>
+          <name>args</name>
+          <description/>
+          <rangeTypeName>uima.cas.FSList</rangeTypeName>
+        </featureDescription>
+      </features>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Referent</name>
+      <description/>
+      <supertypeName>uima.cas.TOP</supertypeName>
+      <features>
+        <featureDescription>
+          <name>links</name>
+          <description/>
+          <rangeTypeName>uima.cas.FSList</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>componentId</name>
+          <description/>
+          <rangeTypeName>uima.cas.String</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>classes</name>
+          <description/>
+          <rangeTypeName>uima.cas.StringArray</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>canonicalForm</name>
+          <description/>
+          <rangeTypeName>uima.cas.String</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>variantForms</name>
+          <description/>
+          <rangeTypeName>uima.cas.StringList</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>id</name>
+          <description/>
+          <rangeTypeName>uima.cas.String</rangeTypeName>
+        </featureDescription>
+      </features>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Entity</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.Referent</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Relation</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.Referent</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Link</name>
+      <description/>
+      <supertypeName>uima.cas.TOP</supertypeName>
+      <features>
+        <featureDescription>
+          <name>componentId</name>
+          <description/>
+          <rangeTypeName>uima.cas.String</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>from</name>
+          <description/>
+          <rangeTypeName>uima.cas.TOP</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>to</name>
+          <description/>
+          <rangeTypeName>uima.cas.TOP</rangeTypeName>
+        </featureDescription>
+      </features>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.HasOccurrence</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.Link</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Argument</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.Link</supertypeName>
+      <features>
+        <featureDescription>
+          <name>role</name>
+          <description/>
+          <rangeTypeName>uima.cas.String</rangeTypeName>
+        </featureDescription>
+      </features>
+    </typeDescription>    
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.TopEntity</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.EntityAnnotation</supertypeName>
+      <features>
+        <featureDescription>
+          <name>confidence</name>
+          <description/>
+          <rangeTypeName>uima.cas.Float</rangeTypeName>
+        </featureDescription>
+      </features>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Person</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.TopEntity</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.GeographicEntity</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.TopEntity</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Location</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.GeographicEntity</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.RegionInternational</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.Location</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Facility</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.Location</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.GPE</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.GeographicEntity</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Continent</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.GPE</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Nation</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.GPE</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.NationalAdministrativeDivision</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.GPE</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.UsState</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.NationalAdministrativeDivision</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.City</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.GPE</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Organization</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.TopEntity</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.EducationalOrganization</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.Organization</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.College</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.EducationalOrganization</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Weapon</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.TopEntity</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Timex</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.TopEntity</supertypeName>
+      <features>
+        <featureDescription>
+          <name>tid</name>
+          <description/>
+          <rangeTypeName>uima.cas.String</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>value</name>
+          <description/>
+          <rangeTypeName>uima.cas.String</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>functionInDocument</name>
+          <description/>
+          <rangeTypeName>uima.cas.String</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>temporalFunction</name>
+          <description/>
+          <rangeTypeName>uima.cas.String</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>anchorTimeId</name>
+          <description/>
+          <rangeTypeName>uima.cas.String</rangeTypeName>
+        </featureDescription>
+      </features>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Duration</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.Timex</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.HistoricalDuration</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.Duration</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Time</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.Timex</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Date</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.Timex</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.TimeOfYear</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.Date</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Year</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.Date</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Clothing</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.TopEntity</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Number</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.TopEntity</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.WholeNumber</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.Number</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.SmallWholeNumber</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.WholeNumber</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.LargeWholeNumber</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.WholeNumber</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Measurement</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.TopEntity</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Money</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.Measurement</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.BodyPart</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.TopEntity</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.PhoneNumber</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.TopEntity</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Tool</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.TopEntity</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.MiscellaneousEntity</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.TopEntity</supertypeName>
+    </typeDescription>    
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.URL</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.TopEntity</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.TopRelation</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.RelationAnnotation</supertypeName>
+      <features>
+        <featureDescription>
+          <name>confidence</name>
+          <description/>
+          <rangeTypeName>uima.cas.Float</rangeTypeName>
+        </featureDescription>
+      </features>
+    </typeDescription>    
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Physical</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.TopRelation</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.PartOf</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.Physical</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.SubPlace</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.PartOf</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.OrganizationalRelationship</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.TopRelation</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Staff</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.OrganizationalRelationship</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.ManagerOf</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.Staff</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Subsidiary</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.OrganizationalRelationship</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.AgentArtifact</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.TopRelation</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.OwnerRenamed</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.AgentArtifact</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.GpeAffiliation</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.TopRelation</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.BasedIn</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.GpeAffiliation</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.HoldsDuring</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.TopRelation</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.LexicalAnnotation</name>
+      <description/>
+      <supertypeName>uima.tcas.Annotation</supertypeName>
+      <features>
+        <featureDescription>
+          <name>componentId</name>
+          <description/>
+          <rangeTypeName>uima.cas.String</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>confidence</name>
+          <description/>
+          <rangeTypeName>uima.cas.Float</rangeTypeName>
+        </featureDescription>
+      </features>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Thing</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.LexicalAnnotation</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.CharacteristicAnnotation</name>
+      <description/>
+      <supertypeName>uima.tcas.Annotation</supertypeName>
+      <features>
+        <featureDescription>
+          <name>componentId</name>
+          <description/>
+          <rangeTypeName>uima.cas.String</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>confidence</name>
+          <description/>
+          <rangeTypeName>uima.cas.Float</rangeTypeName>
+        </featureDescription>
+      </features>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Occupation</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.CharacteristicAnnotation</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.NondefiningRole</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.CharacteristicAnnotation</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.EventCharacteristic</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.CharacteristicAnnotation</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Method</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.EventCharacteristic</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.Symptom</name>
+      <description/>
+      <supertypeName>org.apache.uima.testTypeSystem.CharacteristicAnnotation</supertypeName>
+    </typeDescription>    
+    <typeDescription>
+      <name>sofa.test.CrossAnnotation</name>
+      <description/>
+      <supertypeName>uima.tcas.Annotation</supertypeName>
+      <features>
+        <featureDescription>
+          <name>otherAnnotation</name>
+          <description/>
+          <rangeTypeName>uima.tcas.Annotation</rangeTypeName>
+        </featureDescription>
+      </features>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.testTypeSystem.AnnotationArrayTest</name>
+      <description/>
+      <supertypeName>uima.tcas.Annotation</supertypeName>
+      <features>
+        <featureDescription>
+          <name>arrayOfAnnotations</name>
+          <description/>
+          <rangeTypeName>uima.cas.FSArray</rangeTypeName>
+          <elementType>uima.tcas.Annotation</elementType>
+        </featureDescription>
+      </features>
+    </typeDescription>   
+  </types>
+</typeSystemDescription>

Propchange: uima/uimaj/trunk/uimaj-core/src/test/resources/ExampleCas/testTypeSystem_variation.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: uima/uimaj/trunk/uimaj-core/src/test/resources/ExampleCas/testTypeSystem_variation.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml