Java Code Examples for org.apache.uima.cas.TypeSystem#subsumes()

The following examples show how to use org.apache.uima.cas.TypeSystem#subsumes() . 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: Tsv3XCasSchemaAnalyzer.java    From webanno with Apache License 2.0 6 votes vote down vote up
private static boolean isSlotFeature(TypeSystem aTypeSystem, Feature feat)
{
    // This could be written more efficiently using a single conjunction. The reason this
    // has not been done is to facilitate debugging.
    
    boolean multiValued = feat.getRange().isArray() || aTypeSystem
            .subsumes(aTypeSystem.getType(CAS.TYPE_NAME_LIST_BASE), feat.getRange());
    
    if (!multiValued) {
        return false;
    }
    
    boolean linkInheritsFromTop = CAS.TYPE_NAME_TOP
            .equals(aTypeSystem.getParent(feat.getRange().getComponentType()).getName());
    boolean hasTargetFeature = feat.getRange().getComponentType()
            .getFeatureByBaseName(FEAT_SLOT_TARGET) != null;
    boolean hasRoleFeature = feat.getRange().getComponentType()
            .getFeatureByBaseName(FEAT_SLOT_ROLE) != null;
    
    return linkInheritsFromTop && hasTargetFeature && hasRoleFeature;
}
 
Example 2
Source File: Primitives.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
/**
 * Checks if is restricted by allowed values.
 *
 * @param ts the ts
 * @param type the type
 * @return true, if is restricted by allowed values
 */
public static boolean isRestrictedByAllowedValues(TypeSystem ts, Type type) {
  
  if (ts.getType(CAS.TYPE_NAME_STRING).equals(type) || 
          ts.subsumes(ts.getType(CAS.TYPE_NAME_STRING), type)) {
    LowLevelTypeSystem lts = ts.getLowLevelTypeSystem();
    final int typeCode = lts.ll_getCodeForType(type);
    String[] strings = lts.ll_getStringSet(typeCode);
    
    return strings.length > 0;
  }
  else {
    return false;
  }
  
}
 
Example 3
Source File: XCasToCasDataSaxHandlerTest.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
/**
 * @param casData
 * @param system
 */
private void assertValidCasData(CasData casData, TypeSystem typeSystem) {
  Type annotType = typeSystem.getType(CAS.TYPE_NAME_ANNOTATION);
  Type arrayType = typeSystem.getType(CAS.TYPE_NAME_ARRAY_BASE);
  Iterator<FeatureStructure> fsIter = casData.getFeatureStructures();
  while (fsIter.hasNext()) {
    org.apache.uima.cas_data.FeatureStructure fs = fsIter.next();
    String typeName = fs.getType();

    // don't do tests on the "fake" document text FS
    if (XCASSerializer.DEFAULT_DOC_TYPE_NAME.equals(typeName))
      continue;

    Type type = typeSystem.getType(typeName);
    Assert.assertNotNull(type);
    if (typeSystem.subsumes(annotType, type)) {
      // annotation type - check for presence of begin/end
      FeatureValue beginVal = fs.getFeatureValue("begin");
      Assert.assertTrue(beginVal instanceof PrimitiveValue);
      Assert.assertTrue(((PrimitiveValue) beginVal).toInt() >= 0);
      FeatureValue endVal = fs.getFeatureValue("end");
      Assert.assertTrue(endVal instanceof PrimitiveValue);
      Assert.assertTrue(((PrimitiveValue) endVal).toInt() >= 0);
    }
  }
}
 
Example 4
Source File: FeatureCopiers.java    From biomedicus with Apache License 2.0 5 votes vote down vote up
/**
 * {@code FeatureCopier} used for features which are references to {@code FeatureStructure}s.
 *
 * @param fromFeature the {@link Feature}
 * @param fromFs the {@link FeatureStructure} to copy from
 * @param toFs the {@link FeatureStructure} to copy to
 */
private void defaultFeatureMapper(Feature fromFeature, FeatureStructure fromFs,
    FeatureStructure toFs) {
  TypeSystem typeSystem = fromFs.getCAS().getTypeSystem();
  if (typeSystem.subsumes(typeSystem.getType(CAS.TYPE_NAME_STRING), fromFeature.getRange())) {
    STRING_COPIER.copy(fromFeature, fromFs, toFs);
  } else {
    FeatureStructure fromFeatureValue = fromFs.getFeatureValue(fromFeature);
    if (fromFeatureValue != null) {
      FeatureStructure toFeatureValue = fsEncounteredCallback.apply(fromFeatureValue);
      Feature toFeature = toFs.getType().getFeatureByBaseName(fromFeature.getShortName());
      toFs.setFeatureValue(toFeature, toFeatureValue);
    }
  }
}
 
Example 5
Source File: FSCollectionFactory.java    From uima-uimafit with Apache License 2.0 5 votes vote down vote up
/**
 * Create a {@link Collection} of the given type of feature structures. This collection is backed
 * by the CAS, either via an {@link CAS#getAnnotationIndex(Type)} or
 * {@link FSIndexRepository#getAllIndexedFS(Type)}.
 * 
 * @param cas
 *          the CAS to select from.
 * @param type
 *          the type of feature structures to select. All sub-types are returned as well.
 * @return a {@link Collection} of the given type of feature structures backed live by the CAS.
 * @see <a href="package-summary.html#SortOrder">Order of selected feature structures</a>
 * @deprecated Use {@code cas.select(type).asList()}
 */
@Deprecated
@SuppressWarnings({ "unchecked", "rawtypes" })
public static List<FeatureStructure> create(CAS cas, Type type) {
  // If the type is an annotation type, we can use the annotation index, which directly
  // provides us with its size. If not, we have to use getAllIndexedFS() which we have to
  // scan from beginning to end in order to determine its size.
  TypeSystem ts = cas.getTypeSystem();
  if (ts.subsumes(cas.getAnnotationType(), type)) {
    return (List) create(cas.getAnnotationIndex(type));
  } else {
    return (List) cas.select(type).asList();
  }
}
 
Example 6
Source File: FSCollectionFactory.java    From uima-uimafit with Apache License 2.0 5 votes vote down vote up
/**
 * Fetch all annotations of the given type or its sub-types from the given FS array.
 * 
 * @param aArray
 *          the FS array
 * @param aType
 *          the CAS type.
 * @return a new collection of all feature structures of the given type.
 */
public static <T extends FeatureStructure> List<T> create(ArrayFS<T> aArray, Type aType) {
  TypeSystem ts = aArray.getCAS().getTypeSystem();
  List<FeatureStructure> data = new ArrayList<FeatureStructure>(aArray.size());
  for (int i = 0; i < aArray.size(); i++) {
    FeatureStructure value = aArray.get(i);
    if (value != null && (aType == null || ts.subsumes(aType, value.getType()))) {
      data.add(value);
    }
  }
  return (List<T>) asList(data.toArray(new FeatureStructure[data.size()]));
}
 
Example 7
Source File: FSCollectionFactory.java    From uima-uimafit with Apache License 2.0 5 votes vote down vote up
public static <T extends TOP> List<T> create(FSList<T> aList, Type type) {
  TypeSystem ts = aList.getCAS().getTypeSystem();
  List<FeatureStructure> data = new ArrayList<FeatureStructure>();
  FSList<T> i = aList;
  while (i instanceof NonEmptyFSList) {
    NonEmptyFSList<T> l = (NonEmptyFSList<T>) i;
    TOP value = l.getHead();
    if (value != null && (type == null || ts.subsumes(type, value.getType()))) {
      data.add(l.getHead());
    }
    i = l.getTail();
  }

  return (List<T>) asList(data.toArray(new TOP[data.size()]));
}
 
Example 8
Source File: Primitives.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Retrieve the primitive java class for a primitive type.
 *
 * @param ts the ts
 * @param type the type
 * @return the primitive java class
 */
public static Class<?> getPrimitiveClass(TypeSystem ts, Type type) {
  if (!type.isPrimitive())
    throw new IllegalArgumentException("Type " + type.getName() + " is not primitive!");
  
  // Note:
  // In a UIMA type system *only* the primitive string type can be 
  // sub-typed.
  
  if (ts.getType(CAS.TYPE_NAME_BOOLEAN).equals(type)) {
    return Boolean.class;
  }
  else if (ts.getType(CAS.TYPE_NAME_BYTE).equals(type)) {
    return Byte.class;
  }
  else if (ts.getType(CAS.TYPE_NAME_SHORT).equals(type)) {
    return Short.class;
  }
  else if (ts.getType(CAS.TYPE_NAME_INTEGER).equals(type)) {
    return Integer.class;
  }
  else if (ts.getType(CAS.TYPE_NAME_LONG).equals(type)) {
    return Long.class;
  }
  else if (ts.getType(CAS.TYPE_NAME_FLOAT).equals(type)) {
    return Float.class;
  }
  else if (ts.getType(CAS.TYPE_NAME_DOUBLE).equals(type)) {
    return Double.class;
  }
  else if (ts.getType(CAS.TYPE_NAME_STRING).equals(type) || 
          ts.subsumes(ts.getType(CAS.TYPE_NAME_STRING), type)) {
    return String.class;
  }
  else {
    throw new IllegalStateException("Unexpected primitive type: " + type.getName());
  }
}
 
Example 9
Source File: FeatureValuePathImpl.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
private boolean isEmptyList(LowLevelCAS cas, int type) {
	Type candidateType = cas.ll_getTypeSystem().ll_getTypeForCode(type);
	TypeSystem typeSystem = ((CASImpl) cas).getTypeSystem();
	boolean isEmpty = false;
	for (int i = 0; i < this.emptyListTypes.length && (!isEmpty); i++) {
		isEmpty = typeSystem.subsumes(this.emptyListTypes[i], candidateType);
	}
	return isEmpty;
}
 
Example 10
Source File: TypeSystemUtil.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Convert a {@link Type} to an equivalent {@link TypeDescription}.
 * 
 * @param aType
 *          type object to convert
 * @param aTypeSystem
 *          the TypeSystem that contains <code>aType</code>
 * @return a TypeDescription that is equivalent to <code>aType</code>
 */
public static TypeDescription type2TypeDescription(Type aType, TypeSystem aTypeSystem) {
  TypeDescription typeDesc = UIMAFramework.getResourceSpecifierFactory().createTypeDescription();
  typeDesc.setName(aType.getName());
  Type superType = aTypeSystem.getParent(aType);
  typeDesc.setSupertypeName(superType.getName());
  // special handling for string subtypes (which have "allowed values", rather than features)
  Type stringType = aTypeSystem.getType("uima.cas.String");
  if (aTypeSystem.subsumes(stringType, aType)) {
    String[] allowedValues = getAllowedValuesForType(aType, aTypeSystem);
    AllowedValue[] avObjs = new AllowedValue[allowedValues.length];
    for (int i = 0; i < allowedValues.length; i++) {
      AllowedValue av = UIMAFramework.getResourceSpecifierFactory().createAllowedValue();
      av.setString(allowedValues[i]);
      avObjs[i] = av;
    }
    typeDesc.setAllowedValues(avObjs);
  } else {
    List<FeatureDescription> featDescs = new ArrayList<>();
    for (Feature feat : aType.getFeatures()){ 
      if (!superType.getFeatures().contains(feat)) {
        featDescs.add(feature2FeatureDescription(feat));
      }
    }
    FeatureDescription[] featDescArr = new FeatureDescription[featDescs.size()];
    featDescs.toArray(featDescArr);
    typeDesc.setFeatures(featDescArr);
  }
  return typeDesc;
}
 
Example 11
Source File: TypeSystemAnalysis.java    From webanno with Apache License 2.0 4 votes vote down vote up
private void analyzeType(TypeSystem aTS, TypeSystemDescription aTSD, TypeDescription aTD) {
    log.trace("Analyzing [{}]", aTD.getName());
    
    Type type = aTS.getType(aTD.getName());
    
    // Skip built-in UIMA types
    if (aTD.getName().startsWith("uima.tcas.")) {
        log.debug("[{}] is a built-in UIMA type. Skipping.", aTD.getName());
        return;
    }
    
    // Skip document metadata types
    if (aTS.subsumes(aTS.getType(CAS.TYPE_NAME_DOCUMENT_ANNOTATION), type)) {
        log.debug("[{}] is a document-level annotation. Skipping.", type.getName());
        return;
    }

    // Skip DKPro Core Token and Sentence which as handled specially by WebAnno
    if (
        "de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Sentence".equals(aTD.getName()) ||
        "de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Token".equals(aTD.getName())
    ) {
        log.debug("[{}] is a DKPro Core segmentation type. Skipping.", aTD.getName());
        return;
    }
    
    Optional<RelationDetails> relationDetails = analyzeRelationLayer(aTS, type);
    Optional<ChainDetails> chainDetails = analyzeChainLayer(aTS, type);
    boolean isChain = chainDetails.isPresent();
    
    // Layers must be sub-types of Annotation (unless they are chains)
    if (!isChain && !aTS.subsumes(aTS.getType(CAS.TYPE_NAME_ANNOTATION), type)) {
        log.debug("[{}] is not an annotation type. Skipping.", aTD.getName());
        return;
    }

    // Actually, layers must inherit directly from Annotation (unless they are chains)
    // because WebAnno presently does not support DKPro Core elevated types (e.g. NOUN).
    if (isElevatedType(aTS, type)) {
        log.debug("[{}] looks like an elevated type. Skipping.", aTD.getName());
        return;
    }

    AnnotationLayer layer = new AnnotationLayer();
    Optional<? extends LayerDetails> details;
    if (isChain) {
        details = chainDetails;
        layer.setName(removeEnd(aTD.getName(), "Chain"));
        layer.setUiName(removeEnd(type.getShortName(), "Chain"));
        layer.setType(CHAIN_TYPE);
        chainDetailMap.put(layer.getName(), chainDetails.get());
    }
    else if (relationDetails.isPresent()) {
        details = relationDetails;
        layer.setName(aTD.getName());
        layer.setUiName(type.getShortName());
        layer.setType(RELATION_TYPE);
        relationDetailMap.put(layer.getName(), relationDetails.get());
    }
    else if (isSpanLayer(aTS, type)) {
        details = Optional.empty();
        layer.setName(aTD.getName());
        layer.setUiName(type.getShortName());
        layer.setType(SPAN_TYPE);
    }
    else {
        log.debug("Unable to determine layer type for [{}]", type.getName());
        return;
    }
    
    log.debug("[{}] seems to be a {}", aTD.getName(), layer.getType());
    
    layer.setDescription(trimToNull(aTD.getDescription()));
    
    layer.setEnabled(true);
    layer.setBuiltIn(false);
    
    // We cannot determine good values for these without looking at actual annotations, thus
    // we choose the most relaxed/permissive configuration here.
    layer.setOverlapMode(OverlapMode.ANY_OVERLAP);
    layer.setCrossSentence(true);
    layer.setAnchoringMode(AnchoringMode.CHARACTERS);
    layer.setLinkedListBehavior(false);
    
    layers.add(layer);
    
    // If the current layer is a chain layer (chain head), then we do not record
    // any features for it - instead we record the features of the link type.
    if (CHAIN_TYPE.equals(layer.getType())) {
        TypeDescription linkTypeDescription = aTSD.getType(layer.getName() + "Link");
        analyzeFeatures(layer, aTS, linkTypeDescription, details);
    }
    else {
        analyzeFeatures(layer, aTS, aTD, details);
    }
}
 
Example 12
Source File: TypeSystemAnalysis.java    From webanno with Apache License 2.0 4 votes vote down vote up
private Optional<RelationDetails> analyzeRelationLayer(TypeSystem aTS, Type aType)
{
    // A UIMA type can be a relation layer if...
    // ... there are exactly two non-primitive features
    // ... both have the same range
    // ... the range is a span layer

    List<Feature> nonPrimitiveFeatures = aType.getFeatures().stream()
            .filter(f -> !isBuiltInFeature(f))
            .filter(f -> !f.getRange().isPrimitive())
            .collect(Collectors.toList());
    
    // ... there are exactly two non-primitive features
    if (nonPrimitiveFeatures.size() != 2) {
        return Optional.empty();
    }
    
    Feature ref1 = nonPrimitiveFeatures.get(0);
    Feature ref2 = nonPrimitiveFeatures.get(1);
    
    // Relations must use the names "Governor" and "Dependent" for its references because
    // these names are hardcoded throughout WebAnno.
    List<String> validNames = asList(FEAT_REL_SOURCE, FEAT_REL_TARGET);
    if (
            !validNames.contains(ref1.getShortName()) || 
            !validNames.contains(ref2.getShortName())
    ) {
        return Optional.empty();
    }
    
    // ... both have the same range
    if (!ref1.getRange().getName().equals(ref2.getRange().getName())) {
        return Optional.empty();
    }
    
    // ... the range is a span layer
    // Well, we will not test this in detail at the moment and assume that any sub-type of
    // Annotation should be fine.
    if (!aTS.subsumes(aTS.getType(CAS.TYPE_NAME_ANNOTATION), ref1.getRange())) {
        return Optional.empty();
    }
    
    RelationDetails details = new RelationDetails();
    details.attachLayer = ref1.getRange().getName();
    details.sourceFeature = WebAnnoConst.FEAT_REL_SOURCE;
    details.targetFeature = WebAnnoConst.FEAT_REL_TARGET;
    
    // Hm, ok, so this looks like a relation layer.
    return Optional.of(details);
}
 
Example 13
Source File: FSUtil.java    From uima-uimafit with Apache License 2.0 4 votes vote down vote up
private static boolean isListType(TypeSystem aTS, Type aType)
{
  return aTS.subsumes(aTS.getType(CAS.TYPE_NAME_LIST_BASE), aType);
}
 
Example 14
Source File: CasUtil.java    From uima-uimafit with Apache License 2.0 4 votes vote down vote up
/**
 * Get a list of annotations of the given annotation type constraint by a certain annotation.
 * Iterates over all annotations to find the covering annotations.
 * <p>
 * The method only returns properly covering annotations, that is annotations where the begin/end
 * offsets are equal to the given begin/end to or where given span is properly contained within
 * the span of the 'covering' annotation. Partially overlapping annotations are not returned.
 * 
 * <p>
 * <b>Note:</b> this is <b>REALLY SLOW!</b> You don't want to use this. Instead, consider using
 * {@link #indexCovering(CAS, Type, Type)} or a {@link ContainmentIndex}.
 * 
 * @param cas
 *          a CAS.
 * @param type
 *          a UIMA type.
 * @param begin
 *          begin offset.
 * @param end
 *          end offset.
 * @return a return value.
 * @see <a href="package-summary.html#SortOrder">Order of selected feature structures</a>
 */
public static List<AnnotationFS> selectCovering(CAS cas, Type type, int begin, int end) {

  TypeSystem ts = cas.getTypeSystem();
  List<AnnotationFS> list = new ArrayList<AnnotationFS>();
  
  // withSnapshotIterators() not needed here since we copy the FSes to a list anyway    
  FSIterator<AnnotationFS> iter = cas.getAnnotationIndex().iterator();
  
  while (iter.hasNext()) {
    AnnotationFS a = iter.next();
    if ((a.getBegin() <= begin) && (a.getEnd() >= end)
            && ((type == null) || (ts.subsumes(type, a.getType())))) {
      list.add(a);
    }
  }
  return list;
}
 
Example 15
Source File: EditViewPage.java    From uima-uimaj with Apache License 2.0 4 votes vote down vote up
/**
 * Creates the FS.
 *
 * @param type the type
 * @param arraySize the array size
 * @return the feature structure
 */
FeatureStructure createFS(Type type, int arraySize) {

  if (type.isPrimitive()) {
    throw new IllegalArgumentException("Cannot create FS for primitive type!");
  }

  FeatureStructure fs;

  TypeSystem ts = document.getCAS().getTypeSystem();

  if (type.isArray()) {
    switch (type.getName()) {
      case CAS.TYPE_NAME_BOOLEAN_ARRAY:
        fs = document.getCAS().createBooleanArrayFS(arraySize);
        break;
      case CAS.TYPE_NAME_BYTE_ARRAY:
        fs = document.getCAS().createByteArrayFS(arraySize);
        break;
      case CAS.TYPE_NAME_SHORT_ARRAY:
        fs = document.getCAS().createShortArrayFS(arraySize);
        break;
      case CAS.TYPE_NAME_INTEGER_ARRAY:
        fs = document.getCAS().createIntArrayFS(arraySize);
        break;
      case CAS.TYPE_NAME_LONG_ARRAY:
        fs = document.getCAS().createLongArrayFS(arraySize);
        break;
      case CAS.TYPE_NAME_FLOAT_ARRAY:
        fs = document.getCAS().createFloatArrayFS(arraySize);
        break;
      case CAS.TYPE_NAME_DOUBLE_ARRAY:
        fs = document.getCAS().createDoubleArrayFS(arraySize);
        break;
      case CAS.TYPE_NAME_STRING_ARRAY:
        fs = document.getCAS().createStringArrayFS(arraySize);
        break;
      case CAS.TYPE_NAME_FS_ARRAY:
        fs = document.getCAS().createArrayFS(arraySize);
        break;
      default:
        throw new CasEditorError("Unkown array type: " + type.getName() + "!");
    }
  }
  else if (ts.subsumes(ts.getType(CAS.TYPE_NAME_ANNOTATION), type)) {

	// get begin of selection from editor, if any
	// TODO: Add an interface to retrieve the span from the editor

	int begin = 0;
	int end = 0;

	if (editor instanceof AnnotationEditor) {
	  Point selection = ((AnnotationEditor) editor).getSelection();

	  begin = selection.x;
	  end = selection.y;
	}

	fs = document.getCAS().createAnnotation(type, begin, end);
  }
  else if (!type.isArray()) {
    fs = document.getCAS().createFS(type);
  }
  else {
    throw new TaeError("Unexpected error!");
  }

  return fs;
}
 
Example 16
Source File: DebugFSLogicalStructure.java    From uima-uimaj with Apache License 2.0 4 votes vote down vote up
public static Object getDebugLogicalStructure_FeatureStructure(FeatureStructure fs) {

    if (fs instanceof StringArrayFS) {
      return ((StringArrayFS) fs).toArray();
    }
    if (fs instanceof FloatArrayFS) {
      return ((FloatArrayFS) fs).toArray();
    }
    if (fs instanceof IntArrayFS) {
      return ((IntArrayFS) fs).toArray();
    }
    if (fs instanceof ArrayFS) {
      return ((ArrayFS) fs).toArray();
    }
    CASImpl cas = (CASImpl) fs.getCAS();
    TypeSystem ts = cas.getTypeSystem();
    Type fsType = fs.getType();
    if (ts.subsumes(ts.getType("uima.cas.FloatList"), fsType)) {
      return (floatListToArray(fs));
    }
    if (ts.subsumes(ts.getType("uima.cas.IntegerList"), fsType)) {
      return (integerListToArray(fs));
    }
    if (ts.subsumes(ts.getType("uima.cas.StringList"), fsType)) {
      return (stringListToArray(fs));
    }
    if (ts.subsumes(ts.getType("uima.cas.FSList"), fsType)) {
      return (fsListToArray(fs));
    }

    DebugNameValuePair[] result;
    String typeName = fsType.getName();

    List<Feature> features = fsType.getFeatures();
    int nbrFeats = features.size();
    boolean isAnnotation = false;
    boolean isJCasClass = false;
    if (fs.getClass().getName().equals(typeName)) { // true for JCas cover classes
      isJCasClass = true;
    }

    if (ts.subsumes(cas.getAnnotationType(), fsType)) {
      isAnnotation = true;
    }

    result = new DebugNameValuePair[(isJCasClass ? 0 : 1) // slot for type name if not JCas
            + (isAnnotation ? 3 : nbrFeats) // annotations have 4 slot display
    ];
    int i = 0;
    if (!isJCasClass) {
      result[i++] = new DebugNameValuePair("CasType", typeName);
    }

    if (isAnnotation) {
      DebugNameValuePair[] featResults = new DebugNameValuePair[nbrFeats];
      fillFeatures(featResults, 0, fs, features);
      result[i++] = new DebugNameValuePair("Features", featResults);
      result[i++] = new DebugNameValuePair("Covered Text", ((AnnotationFS) fs).getCoveredText());
      result[i++] = new DebugNameValuePair("SubAnnotations", new UnexpandedFeatureStructures(
              (AnnotationFS) fs));
    } else {
      fillFeatures(result, isJCasClass ? 0 : 1, fs, features);
    }

    return result;
  }