Java Code Examples for org.apache.uima.cas.FeatureStructure#setStringValue()

The following examples show how to use org.apache.uima.cas.FeatureStructure#setStringValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CASArtifact.java    From biomedicus with Apache License 2.0 6 votes vote down vote up
CASArtifact(
    @Nullable LabelAdapters labelAdapters,
    CAS cas,
    String artifactID
) {
  this.labelAdapters = labelAdapters;
  this.cas = cas;

  TypeSystem typeSystem = cas.getTypeSystem();
  metadataType = typeSystem.getType("ArtifactMetadata");
  keyFeature = metadataType.getFeatureByBaseName("key");
  valueFeature = metadataType.getFeatureByBaseName("value");

  metadataCas = cas.createView("metadata");
  metadataCas.setDocumentText("");

  Type idType = typeSystem.getType("ArtifactID");
  Feature idFeat = idType.getFeatureByBaseName("artifactID");
  this.artifactID = artifactID;
  FeatureStructure documentIdFs = metadataCas.createFS(idType);
  documentIdFs.setStringValue(idFeat, artifactID);
  metadataCas.addFsToIndexes(documentIdFs);
  metadataIndex = metadataCas.getIndexRepository().getIndex("metadata", metadataType);

  casMetadata = new CASMetadata();
}
 
Example 2
Source File: StringSubtypeTest.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
public void testCas() {
   CAS cas = this.jcas.getCas();
   TypeSystem ts = cas.getTypeSystem();
   Type annotType = ts.getType(annotationTypeName);
   FeatureStructure fs = cas.createFS(annotType);
   Feature stringSetFeat = ts.getFeatureByFullName(annotationTypeName
+ TypeSystem.FEATURE_SEPARATOR + stringSetFeatureName);
   fs.setStringValue(stringSetFeat, definedValue1);
   fs.setStringValue(stringSetFeat, definedValue2);
   fs.setStringValue(stringSetFeat, definedValue3);
   // next should be ok https://issues.apache.org/jira/browse/UIMA-1839
   fs.setStringValue(stringSetFeat, null);
   boolean exCaught = false;
   try {
     fs.setStringValue(stringSetFeat, undefinedValue);
   } catch (CASRuntimeException e) {
     exCaught = true;
   }
   assertTrue(exCaught);
 }
 
Example 3
Source File: CASArtifact.java    From biomedicus with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public String put(String key, String value) {
  FeatureStructure check = metadataCas.createFS(metadataType);
  check.setStringValue(keyFeature, key);
  FeatureStructure fs = metadataIndex.find(check);
  String existing = null;
  if (fs != null) {
    existing = fs.getStringValue(valueFeature);
    metadataCas.removeFsFromIndexes(fs);
  } else {
    fs = check;
  }
  fs.setStringValue(valueFeature, value);
  metadataCas.addFsToIndexes(fs);
  return existing;
}
 
Example 4
Source File: IteratorTest.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
private void tstWord(FSIndex<FeatureStructure> index) {
  FSIterator<FeatureStructure> it = index.iterator();
  assertEquals(20, it.size());  // test size
  it.moveToLast();

  FeatureStructure fs = this.cas.createFS(wType);
  fs.setStringValue(wordFeat, "word1");

  // TEST moveTo() and get()
  it.moveTo(fs);

  assertSame(fs.getType(), it.get().getType());

  Type t1 = fs.getType();
  Type t2 = wordSetIndex.find(fs).getType();
  assertSame(t1, t2);

}
 
Example 5
Source File: FSUtil.java    From uima-uimafit with Apache License 2.0 6 votes vote down vote up
public static void setFeature(FeatureStructure aFS, String aFeature, String... aValue) {
  Feature feat = getMandatoryFeature(aFS, aFeature);
  if (feat.getRange().isPrimitive()) {
    requireSingleValue(feat, aValue);
    aFS.setStringValue(feat, aValue[0]);
  }
  else if (aValue == null) {
    aFS.setFeatureValue(feat, null);
  }
  else if (feat.getRange().isArray()) {
    aFS.setFeatureValue(feat, createStringArrayFS(aFS.getCAS(), aValue));
  }
  else {
    aFS.setFeatureValue(feat, createStringList(aFS.getCAS(), aValue));
  }
}
 
Example 6
Source File: CASArtifact.java    From biomedicus with Apache License 2.0 5 votes vote down vote up
CASArtifact(
    @Nullable LabelAdapters labelAdapters,
    Artifact artifact,
    CAS cas
) {
  this.labelAdapters = labelAdapters;
  this.cas = cas;

  TypeSystem typeSystem = cas.getTypeSystem();
  metadataType = typeSystem.getType("ArtifactMetadata");
  keyFeature = metadataType.getFeatureByBaseName("key");
  valueFeature = metadataType.getFeatureByBaseName("value");

  metadataCas = cas.createView("metadata");
  metadataCas.setDocumentText("");

  Type idType = typeSystem.getType("ArtifactID");
  Feature idFeat = idType.getFeatureByBaseName("artifactID");
  this.artifactID = artifact.getArtifactID();
  FeatureStructure documentIdFs = metadataCas.createFS(idType);
  documentIdFs.setStringValue(idFeat, artifactID);
  metadataCas.addFsToIndexes(documentIdFs);
  metadataIndex = metadataCas.getIndexRepository().getIndex("metadata", metadataType);

  casMetadata = new CASMetadata();
  casMetadata.putAll(artifact.getMetadata());

  copyDocuments(artifact);
}
 
Example 7
Source File: IteratorTest.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
private void setupWords() {
  wType = this.cas.getTypeSystem().getType("org.apache.uima.cas.test.types.Word");

  wordFeat = wType.getFeatureByBaseName("word");

  for (int i = 0; i < 20; i++) {
    FeatureStructure fs = this.cas.createFS(wType);
    fs.setStringValue(wordFeat, "word" + i);
    this.cas.getIndexRepository().addFS(fs);
  }

  wordSetIndex = this.cas.getIndexRepository().getIndex("Word Set Index");
  ssWordSetIndex = wordSetIndex.withSnapshotIterators();

}
 
Example 8
Source File: SerDesTest4.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
private FeatureStructure makeAkof(Random r) {
  FeatureStructure fs = createFS(cas, akof);
  if (includeUid) fs.setIntValue(akofUid, aint.getAndAdd(1));
  fs.setBooleanValue(akofBoolean, r.nextBoolean());
  fs.setByteValue(akofByte, (byte) r.nextInt());
  fs.setShortValue(akofShort, (short) r.nextInt());
  fs.setIntValue(akofInt, r.nextInt());
  fs.setFloatValue(akofFloat, r.nextFloat());
  fs.setLongValue(akofLong, r.nextLong());
  fs.setDoubleValue(akofDouble, r.nextDouble());
  fs.setStringValue(akofString, randomString(r));
  fs.setFeatureValue(akofFs, fs);

  fs.setFeatureValue(akofAint, randomIntA(r));
  fs.setFeatureValue(akofAfs, createArrayFS(cas, 1));
  fs.setFeatureValue(akofAfloat, randomFloatA(r));
  fs.setFeatureValue(akofAdouble, randomDoubleA(r));
  fs.setFeatureValue(akofAlong, randomLongA(r));
  fs.setFeatureValue(akofAshort, randomShortA(r));
  fs.setFeatureValue(akofAbyte, randomByteA(r));
  fs.setFeatureValue(akofAboolean, createBooleanArrayFS(cas, 2));
  fs.setFeatureValue(akofAstring, randomStringA(r));

  if (isKeep) {
    ((TOP)fs).addToIndexes();
  }
  return fs;
}
 
Example 9
Source File: FSCollectionFactory.java    From uima-uimafit with Apache License 2.0 5 votes vote down vote up
public static <T extends FeatureStructure> T createStringList(CAS aCas, Collection<String> aValues) {
  if (aValues == null) {
    return null;
  }
  
  TypeSystem ts = aCas.getTypeSystem();

  Type emptyType = ts.getType(CAS.TYPE_NAME_EMPTY_STRING_LIST);

  if (aValues.size() == 0) {
    return aCas.createFS(emptyType);
  }
  
  Type nonEmptyType = ts.getType(CAS.TYPE_NAME_NON_EMPTY_STRING_LIST);
  Feature headFeature = nonEmptyType.getFeatureByBaseName(CAS.FEATURE_BASE_NAME_HEAD);
  Feature tailFeature = nonEmptyType.getFeatureByBaseName(CAS.FEATURE_BASE_NAME_TAIL);

  FeatureStructure head = aCas.createFS(nonEmptyType);
  FeatureStructure list = head;
  Iterator<String> i = aValues.iterator();
  while (i.hasNext()) {
    head.setStringValue(headFeature, i.next());
    if (i.hasNext()) {
      FeatureStructure tail = aCas.createFS(nonEmptyType);
      head.setFeatureValue(tailFeature, tail);
      head = tail;
    } else {
      head.setFeatureValue(tailFeature, aCas.createFS(emptyType));
    }
  }

  return (T) list;
}
 
Example 10
Source File: AgreementTestUtils.java    From webanno with Apache License 2.0 5 votes vote down vote up
public static FeatureStructure makeLinkFS(JCas aCas, String aSlotLabel, int aTargetBegin,
        int aTargetEnd)
{
    Token token1 = new Token(aCas, aTargetBegin, aTargetEnd);
    token1.addToIndexes();

    Type linkType = aCas.getTypeSystem().getType(LINK_TYPE);
    FeatureStructure linkA1 = aCas.getCas().createFS(linkType);
    linkA1.setStringValue(linkType.getFeatureByBaseName("role"), aSlotLabel);
    linkA1.setFeatureValue(linkType.getFeatureByBaseName("target"), token1);
    aCas.getCas().addFsToIndexes(linkA1);

    return linkA1;
}
 
Example 11
Source File: DiffTestUtils.java    From webanno with Apache License 2.0 5 votes vote down vote up
public static FeatureStructure makeLinkFS(JCas aCas, String aSlotLabel, int aTargetBegin,
        int aTargetEnd)
{
    Token token1 = new Token(aCas, aTargetBegin, aTargetEnd);
    token1.addToIndexes();

    Type linkType = aCas.getTypeSystem().getType(LINK_TYPE);
    FeatureStructure linkA1 = aCas.getCas().createFS(linkType);
    linkA1.setStringValue(linkType.getFeatureByBaseName("role"), aSlotLabel);
    linkA1.setFeatureValue(linkType.getFeatureByBaseName("target"), token1);
    aCas.getCas().addFsToIndexes(linkA1);

    return linkA1;
}
 
Example 12
Source File: CurationTestUtils.java    From webanno with Apache License 2.0 5 votes vote down vote up
public static FeatureStructure makeLinkFS(JCas aCas, String aSlotLabel, int aTargetBegin,
        int aTargetEnd)
{
    Token token1 = new Token(aCas, aTargetBegin, aTargetEnd);
    token1.addToIndexes();

    Type linkType = aCas.getTypeSystem().getType(LINK_TYPE);
    FeatureStructure linkA1 = aCas.getCas().createFS(linkType);
    linkA1.setStringValue(linkType.getFeatureByBaseName("role"), aSlotLabel);
    linkA1.setFeatureValue(linkType.getFeatureByBaseName("target"), token1);
    aCas.getCas().addFsToIndexes(linkA1);

    return linkA1;
}
 
Example 13
Source File: WebAnnoCasUtil.java    From webanno with Apache License 2.0 5 votes vote down vote up
private static void setLinkFeature(FeatureStructure aFS, AnnotationFeature aFeature,
        List<LinkWithRoleModel> aValue, Feature feature)
{
    Type linkType = aFS.getCAS().getTypeSystem().getType(aFeature.getLinkTypeName());
    Feature roleFeat = linkType.getFeatureByBaseName(aFeature
            .getLinkTypeRoleFeatureName());
    Feature targetFeat = linkType.getFeatureByBaseName(aFeature
            .getLinkTypeTargetFeatureName());

    // Create all the links
    // FIXME: actually we could re-use existing link link feature structures
    List<FeatureStructure> linkFSes = new ArrayList<>();

    if (aValue != null) {
        // remove duplicate links
        Set<LinkWithRoleModel> links = new HashSet<>(aValue);
        for (LinkWithRoleModel e : links) {
            // Skip links that have been added in the UI but where the target has not
            // yet been
            // set
            if (e.targetAddr == -1) {
                continue;
            }

            FeatureStructure link = aFS.getCAS().createFS(linkType);
            link.setStringValue(roleFeat, e.role);
            link.setFeatureValue(targetFeat, selectFsByAddr(aFS.getCAS(), e.targetAddr));
            linkFSes.add(link);
        }
    }
    setLinkFeatureValue(aFS, feature, linkFSes);

}
 
Example 14
Source File: WebAnnoTsv3WriterTestBase.java    From webanno with Apache License 2.0 5 votes vote down vote up
private static FeatureStructure makeLinkFS(JCas aJCas, String aType, String aSlotLabel,
        AnnotationFS aTarget)
{
    Type linkType = aJCas.getTypeSystem().getType(aType);
    FeatureStructure linkA1 = aJCas.getCas().createFS(linkType);
    linkA1.setStringValue(linkType.getFeatureByBaseName("role"), aSlotLabel);
    linkA1.setFeatureValue(linkType.getFeatureByBaseName("target"), aTarget);
    aJCas.getCas().addFsToIndexes(linkA1);

    return linkA1;
}
 
Example 15
Source File: CASArtifact.java    From biomedicus with Apache License 2.0 5 votes vote down vote up
@Override
public boolean containsKey(Object key) {
  if (!(key instanceof String)) {
    return false;
  }
  FeatureStructure check = metadataCas.createFS(metadataType);
  check.setStringValue(keyFeature, (String) key);
  return metadataIndex.contains(check);
}
 
Example 16
Source File: CASArtifact.java    From biomedicus with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public String get(Object key) {
  if (!(key instanceof String)) {
    return null;
  }
  FeatureStructure check = metadataCas.createFS(metadataType);
  check.setStringValue(keyFeature, (String) key);
  FeatureStructure fs = metadataIndex.find(check);
  return fs.getStringValue(valueFeature);
}
 
Example 17
Source File: WebAnnoCasUtil.java    From webanno with Apache License 2.0 4 votes vote down vote up
/**
 * Set a feature value.
 *
 * @param aFS
 *            the feature structure.
 * @param aFeature
 *            the feature within the annotation whose value to set. If this parameter is
 *            {@code null} then nothing happens.
 * @param aValue
 *            the feature value.
 */
public static void setFeature(FeatureStructure aFS, AnnotationFeature aFeature, Object aValue)
{
    if (aFeature == null) {
        return;
    }

    Feature feature = aFS.getType().getFeatureByBaseName(aFeature.getName());

    switch (aFeature.getMultiValueMode()) {
    case NONE: {
        String effectiveType = aFeature.getType();
        if (effectiveType.contains(":")) {
            effectiveType = CAS.TYPE_NAME_STRING;
        }
        
        // Sanity check
        if (!Objects.equals(effectiveType, feature.getRange().getName())) {
            throw new IllegalArgumentException("On [" + aFS.getType().getName() + "] feature ["
                    + aFeature.getName() + "] actual type [" + feature.getRange().getName()
                    + "] does not match expected feature type [" + effectiveType + "].");
        }

        switch (effectiveType) {
        case CAS.TYPE_NAME_STRING:
            aFS.setStringValue(feature, (String) aValue);
            break;
        case CAS.TYPE_NAME_BOOLEAN:
            aFS.setBooleanValue(feature, aValue != null ? (boolean) aValue : false);
            break;
        case CAS.TYPE_NAME_FLOAT:
            aFS.setFloatValue(feature, aValue != null ? (float) aValue : 0.0f);
            break;
        case CAS.TYPE_NAME_INTEGER:
            aFS.setIntValue(feature, aValue != null ? (int) aValue : 0);
            break;
        default:
            throw new IllegalArgumentException("Cannot set value of feature ["
                    + aFeature.getName() + "] with type [" + feature.getRange().getName()
                    + "] to [" + aValue + "]");
        }
        break;
    }
    case ARRAY: {
        switch (aFeature.getLinkMode()) {
        case WITH_ROLE: {
            // Get type and features - we need them later in the loop
            setLinkFeature(aFS, aFeature, (List<LinkWithRoleModel>) aValue, feature);
            break;
        }
        default:
            throw new IllegalArgumentException("Unsupported link mode ["
                    + aFeature.getLinkMode() + "] on feature [" + aFeature.getName() + "]");
        }
        break;
    }
    default:
        throw new IllegalArgumentException("Unsupported multi-value mode ["
                + aFeature.getMultiValueMode() + "] on feature [" + aFeature.getName() + "]");
    }
}
 
Example 18
Source File: SerDesTest6.java    From uima-uimaj with Apache License 2.0 4 votes vote down vote up
private void maybeSetString(FeatureStructure fs, TTypeSystem m, String value) {
  Feature f = m.getFeature(fs, "String");
  if (f != null) {
    fs.setStringValue(f, value);
  }
}
 
Example 19
Source File: SerializationReinitTest.java    From uima-uimaj with Apache License 2.0 4 votes vote down vote up
/** Test basic blob serialization
 */
public void testBlob() throws Exception {

  /*
   * Test that FS, indexes and strings work after repeated blob serialization
   * For each iteration, add two new FS, serialize and test all created so
   * The first FS sets the string feature using standard API => goes into stringlist
   * The second FS sets the string feature using lowlevel API => goes into stringheap 
   * 
   * Throw in tests of the byte, short and long heaps as well
   * 
   */
String testString = "testString";
cas.reset();
LowLevelCAS ll_cas = cas.getLowLevelCAS();
FSIndexRepository ir = cas.getIndexRepository();
int ll_strfeatcode = ll_cas.ll_getTypeSystem().ll_getCodeForFeature(theStringFeature);
int ll_bytefeatcode = ll_cas.ll_getTypeSystem().ll_getCodeForFeature(theByteFeature);
int ll_shortfeatcode = ll_cas.ll_getTypeSystem().ll_getCodeForFeature(theShortFeature);
int ll_bytearrayfeatcode = ll_cas.ll_getTypeSystem().ll_getCodeForFeature(theByteArrayFeature);
int ll_shortarrayfeatcode = ll_cas.ll_getTypeSystem().ll_getCodeForFeature(theShortArrayFeature);
int ll_longfeatcode = ll_cas.ll_getTypeSystem().ll_getCodeForFeature(theLongFeature);

for (int cycle = 0; cycle < 10; cycle +=2 ) {
  FeatureStructure newFS1 = cas.createFS(theTypeType); 
  newFS1.setIntValue(startFeature, cycle);
  newFS1.setIntValue(endFeature, cycle+1);
  // set string using normal string feature create
  newFS1.setStringValue(theStringFeature, testString);
  newFS1.setByteValue(theByteFeature, (byte)cycle);
  newFS1.setShortValue(theShortFeature, (short)cycle);
  newFS1.setLongValue(theLongFeature, (long)cycle);
  ByteArrayFS newBA1 = cas.createByteArrayFS(1); 
  ShortArrayFS newSA1 = cas.createShortArrayFS(1); 
  newBA1.set(0, (byte)cycle);
  newSA1.set(0, (short)cycle);
  newFS1.setFeatureValue(theByteArrayFeature, newBA1);
  newFS1.setFeatureValue(theShortArrayFeature, newSA1);
  ir.addFS(newFS1);

  FeatureStructure newFS2 = cas.createFS(theTypeType);
  ByteArrayFS newBA2 = cas.createByteArrayFS(1);
  ShortArrayFS newSA2 = cas.createShortArrayFS(1); 
  newFS2.setIntValue(startFeature, cycle+1);
  newFS2.setIntValue(endFeature, cycle+2);
  ir.addFS(newFS2);
  CASImpl ci = (CASImpl) cas;
  ci.setId2FSsMaybeUnconditionally(newFS2, newBA2, newSA2);
  // set string using lowlevel string create API
  final int llfs2 = ll_cas.ll_getFSRef(newFS2);
  final int llba2 = ll_cas.ll_getFSRef(newBA2);
  final int llsa2 = ll_cas.ll_getFSRef(newSA2);
  
  ll_cas.ll_setCharBufferValue(llfs2, ll_strfeatcode,
          testString.toCharArray(), 0, testString.length());
  ll_cas.ll_setByteValue(llfs2, ll_bytefeatcode, (byte)(cycle+1));
  ll_cas.ll_setShortValue(llfs2, ll_shortfeatcode, (short)(cycle+1));
  ll_cas.ll_setLongValue(llfs2, ll_longfeatcode, (long)(cycle+1));
  ll_cas.ll_setByteArrayValue(llba2, 0, (byte)(cycle+1));
  ll_cas.ll_setShortArrayValue(llsa2, 0, (short)(cycle+1));
  newFS2.setFeatureValue(theByteArrayFeature, newBA2);
  newFS2.setFeatureValue(theShortArrayFeature, newSA2);
  ir.addFS(newFS2);

  ByteArrayOutputStream fos = new ByteArrayOutputStream();
  Serialization.serializeCAS(cas, fos);
    cas.reset();
  ByteArrayInputStream fis = new ByteArrayInputStream(fos.toByteArray());
  Serialization.deserializeCAS(cas, fis);

  FSIndex<AnnotationFS> idx = cas.getAnnotationIndex(theTypeType);
  FSIterator<AnnotationFS> iter = idx.iterator();
  for (int tc = 0; tc < cycle + 1; tc++) {
    FeatureStructure testFS = iter.get();
    iter.moveToNext();
    assertTrue(tc == testFS.getIntValue(startFeature));
    assertTrue(testString.equals(testFS.getStringValue(theStringFeature)));
    assertTrue(tc == testFS.getByteValue(theByteFeature));
    assertTrue(tc == testFS.getShortValue(theShortFeature));
    assertTrue(tc == testFS.getLongValue(theLongFeature));
    ByteArrayFS ba = (ByteArrayFS)testFS.getFeatureValue(theByteArrayFeature);
    assertTrue(tc == ba.get(0));
    ShortArrayFS sa = (ShortArrayFS)testFS.getFeatureValue(theShortArrayFeature);
    assertTrue(tc == sa.get(0));
  }
  }  
}
 
Example 20
Source File: JsonCasSerializerTest.java    From uima-uimaj with Apache License 2.0 4 votes vote down vote up
private FeatureStructure setAllValues(int v) throws CASException {
  cas = (CASImpl) cas.getView(CAS.NAME_DEFAULT_SOFA);  // create the default initial view sofa.
  JCas jcas = cas.getJCas();
  boolean s1 = v == 0;
  boolean s2 = v == 1;
  FeatureStructure fs = cas.createFS(allTypesType);
  cas.addFsToIndexes(fs);

  FeatureStructure fs2 = cas.createFS(allTypesType);
  
  fs.setBooleanValue(allTypesType.getFeatureByBaseName("aBoolean"), s1 ? true : false);
  fs.setByteValue   (allTypesType.getFeatureByBaseName("aByte"), s1 ? (byte) -117 : (byte) 0);
  fs.setShortValue  (allTypesType.getFeatureByBaseName("aShort"), s1 ? (short) -112 : (short) 0);
  fs.setIntValue    (allTypesType.getFeatureByBaseName("aInteger"), s1 ? 0 : 1);
  fs.setLongValue   (allTypesType.getFeatureByBaseName("aLong"), s2 ? 4321 : 1234);
  fs.setFloatValue  (allTypesType.getFeatureByBaseName("aFloat"), s1 ?  1.3F : Float.NaN);
  fs.setDoubleValue (allTypesType.getFeatureByBaseName("aDouble"), s2 ? Float.NEGATIVE_INFINITY : 2.6);
  fs.setStringValue (allTypesType.getFeatureByBaseName("aString"),  "some \"String\"");
  fs.setFeatureValue(allTypesType.getFeatureByBaseName("aFS"),  fs2);
  
  FeatureStructure fsAboolean = cas.createBooleanArrayFS(s1 ? 1 : 0);
  ByteArray fsAbyte    = new ByteArray(jcas, s1 ? 2 : 0);
  if (s1) {
    fsAbyte.set(0, (byte) 15);
    fsAbyte.set(1,  (byte) 0xee);
  }
  FeatureStructure fsAshort   = cas.createShortArrayFS(s2 ? 2 : 0);
  FeatureStructure fsAstring  = cas.createStringArrayFS(s1 ? 1 : 0);
  
  fsa1 = cas.createFS(allTypesType);
  fsa2 = cas.createFS(allTypesType);
  fsa3 = cas.createFS(allTypesType);
  
  fsaa = new FSArray(jcas, 3);
  fsaa.set(0, fsa1);
  fsaa.set(1, fsa2);
  fsaa.set(2, fsa3);;
  
  FeatureStructure fsMrAboolean = cas.createBooleanArrayFS(1);
  FeatureStructure fsMrAbyte    = cas.createByteArrayFS(2);
  FeatureStructure fsMrAshort   = cas.createShortArrayFS(0);
  FeatureStructure fsMrAstring  = cas.createStringArrayFS(1);
  
  fs.setFeatureValue (allTypesType.getFeatureByBaseName("aArrayBoolean"), fsAboolean);
  fs.setFeatureValue (allTypesType.getFeatureByBaseName("aArrayByte"),     fsAbyte);
  fs.setFeatureValue (allTypesType.getFeatureByBaseName("aArrayShort"),    fsAshort);
  fs.setFeatureValue (allTypesType.getFeatureByBaseName("aArrayString"),   fsAstring);
  
  fs.setFeatureValue (allTypesType.getFeatureByBaseName("aArrayMrBoolean"),  fsMrAboolean);
  fs.setFeatureValue (allTypesType.getFeatureByBaseName("aArrayMrByte"),     fsMrAbyte);
  fs.setFeatureValue (allTypesType.getFeatureByBaseName("aArrayMrShort"),    fsMrAshort);
  fs.setFeatureValue (allTypesType.getFeatureByBaseName("aArrayMrString"),   fsMrAstring);

  
  FeatureStructure fsLinteger0 = cas.createFS(tsi.getType(CAS.TYPE_NAME_EMPTY_INTEGER_LIST));
  
  FeatureStructure fsLstring0  = cas.createFS(tsi.getType(CAS.TYPE_NAME_NON_EMPTY_STRING_LIST));
  FeatureStructure fsLstring1  = cas.createFS(tsi.getType(CAS.TYPE_NAME_EMPTY_STRING_LIST));
  fsLstring0.setStringValue (tsi.getFeatureByFullName(CAS.TYPE_NAME_NON_EMPTY_STRING_LIST + ":head"), "testStr");
  fsLstring0.setFeatureValue (tsi.getFeatureByFullName(CAS.TYPE_NAME_NON_EMPTY_STRING_LIST + ":tail"), fsLstring1);
  
  
  FeatureStructure fsLfs0  = cas.createFS(tsi.getType(CAS.TYPE_NAME_NON_EMPTY_FS_LIST));
  FeatureStructure fsLfs1  = cas.createFS(tsi.getType(CAS.TYPE_NAME_EMPTY_FS_LIST));
  fsLfs0.setFeatureValue (tsi.getFeatureByFullName(CAS.TYPE_NAME_NON_EMPTY_FS_LIST + ":tail"), fsLfs1);
  
  fs.setFeatureValue (allTypesType.getFeatureByBaseName("aListInteger"), fsLinteger0);
  fs.setFeatureValue (allTypesType.getFeatureByBaseName("aListString"), fsLstring0);
  fs.setFeatureValue (allTypesType.getFeatureByBaseName("aListFs"), fsLfs0);
  
  cas.addFsToIndexes(fs);
  return fs;
}