Package org.apache.uima.cas

Examples of org.apache.uima.cas.Feature


      fs.setDoubleValue(f, value);
    }
  }

  private void maybeSetString(FeatureStructure fs, TTypeSystem m, String value) {
    Feature f = m.getFeature(fs, "String");
    if (f != null) {
      fs.setStringValue(f, value);
    }
  }
View Full Code Here


      fs.setStringValue(f, value);
    }
  }

  private void maybeSetFeature(FeatureStructure fs, TTypeSystem m, FeatureStructure value) {
    Feature f = m.getFeature(fs, "Fs");
    if (f != null) {
      fs.setFeatureValue(f, value);
    }
  }
View Full Code Here

  private void maybeSetFeatureKind(FeatureStructure fs, TTypeSystem m, String kind, FeatureStructure value) {
    maybeSetFeature(fs, m.getFeature(fs, kind), value);
  }
 
  private FeatureStructure maybeGetFeatureKind(FeatureStructure fs, TTypeSystem m, String kind) {
    Feature f = m.getFeature(fs, kind);
    return (f == null) ? null : fs.getFeatureValue(f);
  }
View Full Code Here

        finalizeArray(type, addr);
        return;
      }
      // remap IDs for all nonprimtive, non-multivalued-property features
      int[] feats = casBeingFilled.getTypeSystemImpl().ll_getAppropriateFeatures(type);
      Feature feat;
      for (int i = 0; i < feats.length; i++) {
        feat = ts.ll_getFeatureForCode(feats[i]);
        int typeCode = ts.ll_getRangeType(feats[i]);
        if (casBeingFilled.ll_isRefType(typeCode)
                && (featureType[feats[i]] == LowLevelCAS.TYPE_CLASS_FS || feat
                        .isMultipleReferencesAllowed())) {
          int featVal = casBeingFilled.getFeatureValue(addr, feats[i]);
          if (featVal != CASImpl.NULL ) {
            int fsValAddr = CASImpl.NULL;
            try {
              fsValAddr = getFsAddrForXmiId(featVal);
            } catch (NoSuchElementException e) {
              if (!lenient) {
                throw createException(XCASParsingException.UNKNOWN_ID, Integer.toString(featVal));
              }
              else {
                // we may not have deserialized the value of this feature because it
                // was of unknown type.  We set it to null, and record in the
                // out-of-typesystem data.
                this.sharedData.addOutOfTypeSystemAttribute(
                        addr, feat.getShortName(), Integer.toString(featVal));
              }
            }
            casBeingFilled.setFeatureValue(addr, feats[i], fsValAddr);
          }
        }
View Full Code Here

        if (keys != null) {
          for (int j = 0; j < keys.length; j++) {
            if (keys[j].isTypePriority()) {
              comparator.addKey(irm.getDefaultTypeOrder(), FSIndexComparator.STANDARD_COMPARE);
            } else {
              Feature feature = type.getFeatureByBaseName(keys[j].getFeatureName());
              if (feature == null) {
                throw new ResourceInitializationException(
                    ResourceInitializationException.INDEX_KEY_FEATURE_NOT_FOUND, new Object[] {
                        keys[j].getFeatureName(), aIndexes[i].getLabel(),
                        aIndexes[i].getSourceUrlString() });
View Full Code Here

  }
 
  public static Feature getRequiredFeature(Type type, String featureName)
      throws AnalysisEngineProcessException {

    Feature feature = type.getFeatureByBaseName(featureName);

    if (feature == null) {
      throw new OpenNlpAnnotatorProcessException(
          ExceptionMessages.FEATURE_NOT_FOUND, new Object[] { type.getName(),
              featureName});
View Full Code Here

   * @throws AnnotatorConfigurationException
   */
  public static Feature getRequiredFeature(Type type, String featureName,
      String rangeType) throws AnalysisEngineProcessException {

    Feature feature = getRequiredFeature(type, featureName);

    checkFeatureType(feature, rangeType);

    return feature;
  }
View Full Code Here

  }
 
  public static Feature getOptionalFeature(Type type, String featureName, String rangeType)
    throws AnalysisEngineProcessException{

    Feature feature = type.getFeatureByBaseName(featureName);
   
    checkFeatureType(feature, rangeType);
   
    return feature;
  }
View Full Code Here

  public boolean isValid() {
    if (this.type == null) {
      return false;
    }
    final int max = this.getNumberOfKeys();
    Feature feat;
    for (int i = 0; i < max; i++) {
      if (this.keyTypeVector.get(i) != FEATURE_KEY) {
        continue;
      }
      feat = (Feature) this.keyVector.get(i);
      // if (feat.getTypeSystem() != ts) {
      // return false;
      // }
      if (!this.ts.subsumes(feat.getDomain(), this.type)) {
        return false;
      }
    }
    return true;
  }
View Full Code Here

      // type system
      CAS cas = ae.newCAS();
      TypeSystem ts = cas.getTypeSystem();
      Type t1 = ts.getType("Type1");
      Assert.assertEquals("Type1", t1.getName());
      Feature f1 = t1.getFeatureByBaseName("Feature1");
      Feature f1a = ts.getFeatureByFullName("Type1:Feature1");
      Assert.assertEquals(f1, f1a);
      Assert.assertEquals("Feature1", f1.getShortName());
      Assert.assertEquals(t1, f1.getDomain());

      Type t2 = ts.getType("Type2");
      Assert.assertEquals("Type2", t2.getName());
      Feature f2 = t2.getFeatureByBaseName("Feature2");
      Feature f2a = ts.getFeatureByFullName("Type2:Feature2");
      Assert.assertEquals(f2, f2a);
      Assert.assertEquals("Feature2", f2.getShortName());
      Assert.assertEquals(t2, f2.getDomain());

      Type et = ts.getType("EnumType");
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.