cas.addFsToIndexes(orgAnnot2);
AnnotationFS testAnnot = cas.createAnnotation(testAnnotType, 0, 20);
cas.addFsToIndexes(testAnnot);
Type nonEmptyFsListType = cas.getTypeSystem().getType(CAS.TYPE_NAME_NON_EMPTY_FS_LIST);
Type emptyFsListType = cas.getTypeSystem().getType(CAS.TYPE_NAME_EMPTY_FS_LIST);
Feature headFeat = nonEmptyFsListType.getFeatureByBaseName("head");
Feature tailFeat = nonEmptyFsListType.getFeatureByBaseName("tail");
FeatureStructure emptyNode = cas.createFS(emptyFsListType);
FeatureStructure secondNode = cas.createFS(nonEmptyFsListType);
secondNode.setFeatureValue(headFeat, orgAnnot2);
secondNode.setFeatureValue(tailFeat, emptyNode);
FeatureStructure firstNode = cas.createFS(nonEmptyFsListType);
firstNode.setFeatureValue(headFeat, orgAnnot1);
firstNode.setFeatureValue(tailFeat, secondNode);
Feature listFeat = testAnnotType.getFeatureByBaseName("listFeat");
testAnnot.setFeatureValue(listFeat, firstNode);
//serialize to XMI
String xmiStr = serialize(cas, null);
// System.out.println(xmiStr);
//deserialize into a CAS that's missing the Organization type
File partialTypeSystemFile = JUnitExtension.getFile("ExampleCas/partialTestTypeSystem.xml");
TypeSystemDescription partialTypeSystem = UIMAFramework.getXMLParser().parseTypeSystemDescription(
new XMLInputSource(partialTypeSystemFile));
testAnnotTypeDesc = partialTypeSystem.addType("org.apache.uima.testTypeSystem.TestAnnotation", "", "uima.tcas.Annotation");
testAnnotTypeDesc.addFeature("listFeat", "", "uima.cas.FSList");
CAS partialTsCas = CasCreationUtils.createCas(partialTypeSystem, null, null);
XmiSerializationSharedData sharedData = new XmiSerializationSharedData();
deserialize(xmiStr, partialTsCas, sharedData, true, -1);
//check out of type system data
Type testAnnotType2 = partialTsCas.getTypeSystem().getType("org.apache.uima.testTypeSystem.TestAnnotation");
FeatureStructure testAnnot2 = partialTsCas.getAnnotationIndex(testAnnotType2).iterator().get();
Feature listFeat2 = testAnnotType2.getFeatureByBaseName("listFeat");
FeatureStructure listFs = testAnnot2.getFeatureValue(listFeat2);
List ootsElems = sharedData.getOutOfTypeSystemElements();
assertEquals(2, ootsElems.size());
OotsElementData oed = sharedData.getOutOfTypeSystemFeatures(listFs.hashCode());
XmlAttribute attr = (XmlAttribute)oed.attributes.get(0);