Package org.apache.uima.cas

Examples of org.apache.uima.cas.Type


    // Create a feature value from a string representation.
    private void handleFeature(int addr, String featName, String featVal, boolean lenient)
            throws SAXParseException {
      int typeCode = cas.ll_getFSRefType(addr);
      Type type = cas.ll_getTypeSystem().ll_getTypeForCode(typeCode);
      handleFeature(type, addr, featName, featVal, lenient);
    }
View Full Code Here


      }

      // handle v1.x sofanum values, remapping so that _InitialView always == 1
      if (featName.equals(CAS.FEATURE_BASE_NAME_SOFAID)
              && this.sofaTypeCode == cas.getHeapValue(addr)) {
        Type sofaType = ts.ll_getTypeForCode(this.sofaTypeCode);
        final FeatureImpl sofaNumFeat = (FeatureImpl) sofaType
                .getFeatureByBaseName(CAS.FEATURE_BASE_NAME_SOFANUM);
        int sofaNum = cas.getFeatureValue(addr, sofaNumFeat.getCode());
        cas.setFeatureValue(addr, sofaNumFeat.getCode(), this.indexMap.get(sofaNum));
      }
View Full Code Here

      // "Document" can be resolved to "uima.tcas.DocumentAnnotation" or "org.apache.uima.ruta.type.Document",
      // we force it to the former
      ambiguousTypeAlias.remove("Document");
      namespaces.remove("Document");
      Type documentType = cas.getTypeSystem().getType(UIMAConstants.TYPE_DOCUMENT);
      addType("Document", documentType);

      Type annotationType = cas.getJCas().getCasType(org.apache.uima.jcas.tcas.Annotation.type);
      addType("Annotation", annotationType);
    } catch (CASException e) {
      UIMAFramework.getLogger(getClass()).log(SEVERE, "Cannot initialize types.", e);
    } catch (InvalidXMLException e) {
      UIMAFramework.getLogger(getClass()).log(SEVERE, "Cannot initialize types.", e);
View Full Code Here

   *
   * @param ts Type system to import.
   * @throws CASException
   */
  private void importAllTypes(TypeSystem ts) throws CASException {
    Type topType = ts.getTopType();
    if (topType != null) {
      List<Type> list = ts.getProperlySubsumedTypes(topType);
      for (Type type : list) {
        addType(type);
      }
View Full Code Here

   * @param casTS Type system containing all known types.
   * @throws InvalidXMLException When import cannot be resolved.
   */
  private void importDeclaredTypes(TypeSystem casTS) throws InvalidXMLException {
    for (String name : declaredAnnotationTypes) {
      Type type = casTS.getType(name);
      if (type != null) {
        addType(type);
      } else {
        throw new RuntimeException("Type '" + name + "' not found");
      }
View Full Code Here

  private void importDeclaredTypesystems(TypeSystem casTS) throws InvalidXMLException {
    String[] descriptors = typesystems.toArray(new String[typesystems.size()]);
    TypeSystemDescription ts = TypeSystemDescriptionFactory.createTypeSystemDescription(descriptors);
    ts.resolveImports();
    for (TypeDescription td : ts.getTypes()) {
      Type type = casTS.getType(td.getName());
      if (type != null) {
        addType(type);
      } else {
        throw new RuntimeException("Type '" + td.getName() + "' not found");
      }
View Full Code Here

   * @param casTS Cas type system.
   */
  private void importTypeAliases(TypeSystem casTS) {
    for (List<Alias> aliases : typeImports.values()) {
      for (Alias alias : aliases) {
        Type type = casTS.getType(alias.longName);
        if (type == null) {
          throw new RuntimeException("Type '" + alias.longName + "' not found");
        }
        addType(alias.shortName, casTS.getType(alias.longName));
      }
View Full Code Here

   * @param casTS Type system containing all known types.
   */
  private void importPackageAliases(TypeSystem casTS) {
    Iterator<Type> iter = casTS.getTypeIterator();
    while(iter.hasNext()) {
      Type type = iter.next();
      String name = type.getName();
      String pkg = name.substring(0, Math.max(name.lastIndexOf('.'), 0));
      List<String> aliases = packageImports.get(pkg);
      if (aliases != null) {
        for (String alias : aliases) {
          if (alias.isEmpty()) {
            addType(type);
          } else {
            addType(alias + "." + type.getShortName(), type);
          }
        }
      }
    }
  }
View Full Code Here

      throw new IllegalArgumentException(message.toString());
    }

    // try to resolve match
    String expanded = expand(match);
    Type type = types.get(expanded);
    if (type == null) {
      RutaBlock parent = owner.getParent();
      if (parent != null) {
        type = parent.getEnvironment().getType(match);
      }
View Full Code Here

      Ruta.apply(cas, script, parameters);
    } catch (Exception e) {
      e.printStackTrace();
    }

    Type t = null;
    AnnotationIndex<AnnotationFS> ai = null;
    FSIterator<AnnotationFS> iterator = null;

    t = RutaTestUtils.getTestType(cas, 1);
    ai = cas.getAnnotationIndex(t);
View Full Code Here

TOP

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

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.