Package org.apache.uima.cas

Examples of org.apache.uima.cas.Feature


    }
   
    List<Feature> features1 = fs1.getType().getFeatures();
    List<Feature> features2 = fs2.getType().getFeatures();
    for (int i = 0; i < features1.size(); i++) {
      Feature feat1 = features1.get(i);
      Feature feat2 = features2.get(i);
      // System.out.println("Comparing " + feat1.getName());
      Type rangeType1 = feat1.getRange();
      Type rangeType2 = feat2.getRange();
      Assert.assertEquals(rangeType1.getName(), rangeType2.getName());
      // System.out.println("Range type " + rangeType1);
      String rangeTypeName = rangeType1.getName();

      if (fs1.getCAS().getTypeSystem().subsumes(
View Full Code Here


    return annotation.size() == 1;
  }

  public static void lowerLeftAnnotationSide(ICasDocument document, AnnotationFS annotation) {
    Type annotationType = annotation.getType();
    Feature beginFeature = annotationType.getFeatureByBaseName("begin");

    if (annotation.getBegin() < annotation.getEnd()) {
      annotation.setIntValue(beginFeature, annotation.getBegin() + 1);
    }
View Full Code Here

    annotationDrawingStyle.draw(annotation, gc, textWidget, offset, length, color);
   
    if (annotation instanceof EclipseAnnotationPeer) {
      AnnotationFS annotationFS = ((EclipseAnnotationPeer) annotation).getAnnotationFS();
     
      Feature feature = annotationFS.getType().getFeatureByBaseName(featureName);
     
      if (feature != null && feature.getRange().isPrimitive()) {
       
        String featureValue = annotationFS.getFeatureValueAsString(feature);
       
        // Annotation can be rendered into multiple lines, always draw
        // the tag in the first line where annotation starts
View Full Code Here

   * @param document
   * @param annotation
   */
  public static void wideLeftAnnotationSide(ICasDocument document, AnnotationFS annotation) {
    Type annotationType = annotation.getType();
    Feature beginFeature = annotationType.getFeatureByBaseName("begin");

    if (annotation.getBegin() > 0) {
      annotation.setIntValue(beginFeature, annotation.getBegin() - 1);
    }

View Full Code Here

      this.indexRepository.addFS(fsIndex[i]); // add to base index
    }
    int loopStart = loopLen + 2;

    FSIterator<SofaFS> iterator = this.svd.baseCAS.getSofaIterator();
    final Feature idFeat = getTypeSystem().getFeatureByFullName(CAS.FEATURE_FULL_NAME_SOFAID);
    // Add FSs to index repository for each View
    while (iterator.isValid()) {
      SofaFS sofa = (SofaFS) iterator.get();
      String id = getLowLevelCAS().ll_getStringValue(((FeatureStructureImpl) sofa).getAddress(),
          ((FeatureImpl) idFeat).getCode());
View Full Code Here

    this.indexRepository.addFS(fsIndex[i]); // add to base index
  }
  int loopStart = loopLen + 2;

  FSIterator<SofaFS> iterator = this.svd.baseCAS.getSofaIterator();
  final Feature idFeat = getTypeSystem().getFeatureByFullName(CAS.FEATURE_FULL_NAME_SOFAID);
  // Add FSs to index repository for each View
  while (iterator.isValid()) {
        SofaFS sofa = (SofaFS) iterator.get();
        String id = getLowLevelCAS().ll_getStringValue(((FeatureStructureImpl) sofa).getAddress(),
            ((FeatureImpl) idFeat).getCode());
View Full Code Here

    // get features to copy
    int[] featcodes = getTypeSystem().getLowLevelTypeSystem().ll_getAppropriateFeatures(typeCode);
    for (int i = 0; i < featcodes.length; i++) {

      // get range type of this feature
      Feature feature = getTypeSystem().getLowLevelTypeSystem().ll_getFeatureForCode(featcodes[i]);
      Type rangeType = feature.getRange();
      // get feature code
      int featCode = ((FeatureImpl) feature).getCode();
      // get the value for this feature offset in src fs
      int val = getHeapValue(srcAddr + this.svd.casMetadata.featureOffset[featCode]);
      // if this is a string, create a new reference in the string
View Full Code Here

  public void updateDocumentAnnotation() {
    if (!mySofaIsValid()) {
      return;
    }
    final Type SofaType = this.svd.casMetadata.ts.sofaType;
    final Feature sofaString = SofaType.getFeatureByBaseName(FEATURE_BASE_NAME_SOFASTRING);
    String newDoc = getSofa(this.mySofaRef).getStringValue(sofaString);
    if (null != newDoc) {
      getDocumentAnnotation().setIntValue(getEndFeature(), newDoc.length());
    }
  }
View Full Code Here

    assertTrue(ok);

    // Test find()
    Type wType = this.cas.getTypeSystem().getType("org.apache.uima.cas.test.types.Word");

    Feature 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);
View Full Code Here

    Type stringType = aCAS.getTypeSystem().getType(CAS.TYPE_NAME_STRING);

    List<Feature> aFeatures = aFS.getType().getFeatures();
    Iterator<Feature> iter = aFeatures.iterator();
    while (iter.hasNext()) {
      Feature feat = (Feature) iter.next();
      String featName = feat.getShortName();
      // how we get feature value depends on feature's range type)
      String rangeTypeName = feat.getRange().getName();
      if (aCAS.getTypeSystem().subsumes(stringType, feat.getRange())) // must check for subtypes
      // of string
      {
        String str = aFS.getStringValue(feat);
        if (str == null) {
          attrs.addAttribute("", featName, featName, "CDATA", "null");
View Full Code Here

TOP

Related Classes of org.apache.uima.cas.Feature

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.