Package org.apache.uima.cas

Examples of org.apache.uima.cas.Type


    }
    script.setEngineDependencies(additionalEnginesMap);
  }

  public static void addSourceDocumentInformation(CAS cas, File each) {
    Type sdiType = cas.getTypeSystem()
            .getType("org.apache.uima.examples.SourceDocumentInformation");
    if (sdiType != null) {
      if (cas.getAnnotationIndex(sdiType).size() == 0) {
        AnnotationFS sdi = cas.createAnnotation(sdiType, cas.getDocumentAnnotation().getBegin(),
                cas.getDocumentAnnotation().getEnd());
        Feature uriFeature = sdiType.getFeatureByBaseName("uri");
        sdi.setStringValue(uriFeature, each.toURI().getPath());
        cas.addFsToIndexes(sdi);
      }
    }
  }
View Full Code Here


      }
    }
  }

  public static void removeSourceDocumentInformation(CAS cas) {
    Type sdiType = cas.getTypeSystem()
            .getType("org.apache.uima.examples.SourceDocumentInformation");
    if (sdiType != null) {
      AnnotationIndex<AnnotationFS> annotationIndex = cas.getAnnotationIndex(sdiType);
      List<AnnotationFS> toRemove = new ArrayList<AnnotationFS>();
      for (AnnotationFS annotationFS : annotationIndex) {
View Full Code Here

    JCas modview = fromJcas.getView(toView);

    Set<Annotation> indexedFs = new HashSet<Annotation>();
    AnnotationIndex<Annotation> annotationIndex = fromJcas.getAnnotationIndex();
    TypeSystem typeSystem = fromJcas.getTypeSystem();
    Type docType = typeSystem.getType(UIMAConstants.TYPE_DOCUMENT);
    CasCopier casCopier = new CasCopier(fromJcas.getCas(), modview.getCas());
    for (Annotation annotation : annotationIndex) {
      // TODO be careful here, because some people inherit from DocumentAnnotation
      if (typeSystem.subsumes(docType, annotation.getType())) {
        continue;
View Full Code Here

   * @param relativeEnd TODO
   * @param text
   * @throws AnalysisEngineProcessException
   */
  public void recognize(JCas aJCas, PrefixTree root, int relativeBegin, int relativeEnd, String text) throws AnalysisEngineProcessException{
    Type annotationToCreateType = aJCas.getTypeSystem().getType(annotationToProcessString);

    //
    Map<PrefixTree,Branch> currentExploredBranches = new HashMap<PrefixTree,Branch>();
    if (debug)    System.out.println("Debug: Start a new exploration of the tree with the first char");
    currentExploredBranches.put(root,new Branch(annotationToCreateType,0 + relativeBegin));
View Full Code Here

        assert false : "Unexpected element!";

        return new Object[] {};
      }

      Type type = featureStructure.getType();

      Vector featureTypes = type.getAppropriateFeatures();

      Iterator featuresItertor = featureTypes.iterator();

      while (featuresItertor.hasNext()) {
        Feature feature = (Feature) featuresItertor.next();
View Full Code Here

    // insert list box

    mTypeCombo = new Combo(this, SWT.READ_ONLY);
    mTypeCombo.addModifyListener(new ModifyListener() {
      public void modifyText(ModifyEvent e) {
        Type newType = mTypeSystem.getType(mTypeCombo.getText());

        if (mListener != null && newType != null) {
          mListener.typeChanged(newType);
        }
      }
    });

    GridData typeComboData = new GridData();
    typeComboData.grabExcessHorizontalSpace = true;
    typeComboData.horizontalAlignment = SWT.FILL;
    mTypeCombo.setLayoutData(typeComboData);

    LinkedList<String> typeNameList = new LinkedList<String>();

    typeNameList.add(superType.getName());

    // get a collection of all types
    Iterator typeIterator = mTypeSystem.getProperlySubsumedTypes(superType).iterator();

    while (typeIterator.hasNext()) {
      Type type = (Type) typeIterator.next();

      if (!filterTypes.contains(type)) {
        typeNameList.add(type.getName());
      }
    }

    mTypeCombo.setItems(typeNameList.toArray(new String[typeNameList.size()]));
View Full Code Here

        insertAction(parentType, newSubMenu);

        Iterator<Type> childsIterator = childs.iterator();

        while (childsIterator.hasNext()) {
          Type child = childsIterator.next();

          fillTypeMenu(child, newSubMenu, true);
        }
      }
      // no
View Full Code Here

     * This implementation imitates the behavior without the
     * {@link IAnnotationAccessExtension}.
     */
    public boolean isSubtype(Object annotationType, Object potentialSupertype) {

      Type type = getDocument().getCAS().getTypeSystem().getType((String) annotationType);
     
      return mShowAnnotationsMenu.getSelectedTypes().contains(type) ||
          getAnnotationMode().equals(type);
    }
View Full Code Here

    if (getTypesystemElement() != null && getTypesystemElement().getTypeSystem() != null) {

      TypeSystem typeSystem = getTypesystemElement().getTypeSystem();

      Type annotationType = typeSystem.getType(CAS.TYPE_NAME_ANNOTATION);

      List<Type> displayTypes = typeSystem.getProperlySubsumedTypes(annotationType);

      // removes the document annotation
      displayTypes.remove(typeSystem.getType(CAS.TYPE_NAME_DOCUMENT_ANNOTATION));
     
      mEditorAnnotationStatus = new EditorAnnotationStatus(
              annotationType.getName(), displayTypes);
    }
  }
View Full Code Here

            if (tableItem.getData() instanceof FeatureValue) {

              // this can fail
              FeatureValue value = (FeatureValue) tableItem.getData();

              Type range = value.getFeature().getRange();

              FeatureStructure dragFeatureStructure = (FeatureStructure) event.data;

              if (range.equals(dragFeatureStructure.getType())) {

                FeatureStructure target = value.getFeatureStructure();

                target.setFeatureValue(value.getFeature(), dragFeatureStructure);
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.