Examples of TypeSystem


Examples of org.apache.uima.cas.TypeSystem

      }
      else if (selection.getFirstElement() instanceof ArrayValue) {
        ArrayValue value = (ArrayValue) selection.getFirstElement();


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

        CreateFeatureStructureDialog createFsDialog =
          new CreateFeatureStructureDialog(Display.getCurrent()
                  .getActiveShell(), typeSystem.getType(CAS.TYPE_NAME_TOP),
                  typeSystem);

        int returnCode = createFsDialog.open();

        if (returnCode == IDialogConstants.OK_ID) {
View Full Code Here

Examples of org.apache.uima.cas.TypeSystem

  private void itemSelected() {
    IStructuredSelection selection = (IStructuredSelection) mTypeList.getSelection();

    Type selectedType = (Type) selection.getFirstElement();

    TypeSystem typesystem = mProject.getTypesystemElement().getTypeSystem();

    AnnotationStyle style = mDotCorpusElement.getAnnotation(selectedType);

    mCurrentSelectedAnnotation = style;
View Full Code Here

Examples of org.apache.uima.cas.TypeSystem

        AnnotationStyle style = mDotCorpusElement.getAnnotation(type);

        cell.setText(Integer.toString(style.getLayer()));
      }});

    TypeSystem typeSytstem = mProject.getTypesystemElement().getTypeSystem();

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

    java.util.List types = typeSytstem.getProperlySubsumedTypes(annotationType);

    for (Object typeObject : types) {
      // inserts objects with type Type
      mTypeList.add(typeObject);
    }
View Full Code Here

Examples of org.apache.uima.cas.TypeSystem

      ae.initialize(desc, null); // this calls createAnalysisProcessData

      // check results in CAS
      // 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");
      Assert.assertEquals("EnumType", et.getName());
      Assert.assertEquals(et, f2.getRange());

      // indexes
      FSIndexRepository irep = cas.getIndexRepository();
View Full Code Here

Examples of org.apache.uima.cas.TypeSystem

              || label1.equals("FlowControllerTestIndex")
              || label2.equals("FlowControllerTestIndex"));

      // test that we can create a CAS
      CAS cas = ae.newCAS();
      TypeSystem ts = cas.getTypeSystem();
      assertNotNull(ts.getType("NamedEntity"));
      assertNotNull(ts.getType("Person"));
      assertNotNull(ts.getType("Place"));
      assertNotNull(ts.getType("Org"));
      assertNotNull(ts.getType("DocumentStructure"));
      assertNotNull(ts.getType("Paragraph"));
      assertNotNull(ts.getType("Sentence"));
      assertNotNull(ts.getType("test.flowController.Test"));
    } catch (Exception e) {
      JUnitExtension.handleException(e);
    }
  }
View Full Code Here

Examples of org.apache.uima.cas.TypeSystem

   * @param resultCas
   *          must contain TP, FP, FN annotations
   */
  public void calculateEvaluatData(TestCasData data, CAS resultCas) {
    data.setEvaluationStatus(true);
    TypeSystem ts = resultCas.getTypeSystem();
    Type falsePositiveType = ts.getType(ICasEvaluator.FALSE_POSITIVE);
    Type falseNegativeType = ts.getType(ICasEvaluator.FALSE_NEGATIVE);
    Type truePositiveType = ts.getType(ICasEvaluator.TRUE_POSITIVE);

    int falsePositiveCount = resultCas.getAnnotationIndex(falsePositiveType).size();
    int falseNegativeCount = resultCas.getAnnotationIndex(falseNegativeType).size();
    int truePositiveCount = resultCas.getAnnotationIndex(truePositiveType).size();

View Full Code Here

Examples of org.apache.uima.cas.TypeSystem

  }

  private List<AnnotationFS> getAnnotations(AnnotationFS annotation, Type type,
          FeatureMatchExpression fme, RutaStream stream) {
    List<AnnotationFS> result = new ArrayList<AnnotationFS>();
    TypeSystem typeSystem = stream.getCas().getTypeSystem();
    if (typeSystem.subsumes(type, annotation.getType())) {
      result.add(annotation);
    } else {
      Collection<AnnotationFS> beginAnchors = stream.getBeginAnchor(annotation.getBegin())
              .getBeginAnchors(type);
      Collection<AnnotationFS> endAnchors = stream.getEndAnchor(annotation.getEnd()).getEndAnchors(type);
View Full Code Here

Examples of org.apache.uima.cas.TypeSystem

   *
   * @param cl
   * @return
   */
  private synchronized Map<String, LoadedJCasType> loadJCasClasses(ClassLoader cl) {
    final TypeSystem ts = casImpl.getTypeSystem();
    Iterator<Type> typeIt = ts.getTypeIterator();
    TypeImpl t;
    String casName;
    Map<String, LoadedJCasType> jcasTypes = new HashMap<String, LoadedJCasType>();

    // * note that many of these may have already been loaded
View Full Code Here

Examples of org.apache.uima.cas.TypeSystem

    }
  }

  // note all callers are synchronized
  private void copyDownSuperGenerators(Map<String, LoadedJCasType> jcasTypes, FSGenerator[] fsGenerators) {
    final TypeSystem ts = casImpl.getTypeSystem();
    Iterator<Type> typeIt = ts.getTypeIterator(); // reset iterator to start
    Type topType = ts.getTopType();
    Type superType = null;
    while (typeIt.hasNext()) {
      Type t = (Type) typeIt.next();
      if (builtInsWithNoJCas.contains(t.getName()))
        continue;
      // comment here
      if (CAS.TYPE_NAME_DOCUMENT_ANNOTATION.equals(t.getName())) {
        if (jcasTypes.get("org.apache.uima.jcas.tcas.DocumentAnnotation") != null)
          continue;
      } else if (builtInsWithAltNames.contains(t.getName()))
        continue; // because jcasTypes has no entry for these
      if (null != jcasTypes.get(t.getName()))
        continue;
      // we believe that at this point, t is not "top", because top is
      // always loaded
      // find closest supertype that has a loaded cover class
      superType = t;
      String superTypeName;
      do {
        superType = ts.getParent(superType);
        superTypeName = superType.getName();
        if (builtInsWithAltNames.contains(superTypeName)) {
          superTypeName = "org.apache.uima.jcas." + superTypeName.substring(5);
        }
      } while ((null == jcasTypes.get(superTypeName) && !superType.equals(topType)));
View Full Code Here

Examples of org.apache.uima.cas.TypeSystem

        throw new IllegalArgumentException("Cannot create FS for primitive type!");
      }

      FeatureStructure fs;

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

      if (type.isArray()) {
          if (type.getName().equals(CAS.TYPE_NAME_BOOLEAN_ARRAY)) {
              fs = document.getCAS().createBooleanArrayFS(arraySize);
            } else if (type.getName().equals(CAS.TYPE_NAME_BYTE_ARRAY)) {
              fs = document.getCAS().createByteArrayFS(arraySize);
            } else if (type.getName().equals(CAS.TYPE_NAME_SHORT_ARRAY)) {
              fs = document.getCAS().createShortArrayFS(arraySize);
            } else if (type.getName().equals(CAS.TYPE_NAME_INTEGER_ARRAY)) {
              fs = document.getCAS().createIntArrayFS(arraySize);
            } else if (type.getName().equals(CAS.TYPE_NAME_LONG_ARRAY)) {
              fs = document.getCAS().createLongArrayFS(arraySize);
            } else if (type.getName().equals(CAS.TYPE_NAME_FLOAT_ARRAY)) {
              fs = document.getCAS().createFloatArrayFS(arraySize);
            } else if (type.getName().equals(CAS.TYPE_NAME_DOUBLE_ARRAY)) {
              fs = document.getCAS().createDoubleArrayFS(arraySize);
            } else if (type.getName().equals(CAS.TYPE_NAME_STRING_ARRAY)) {
              fs = document.getCAS().createStringArrayFS(arraySize);
            } else if (type.getName().equals(CAS.TYPE_NAME_FS_ARRAY)) {
              fs = document.getCAS().createArrayFS(arraySize);
            } else {
              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;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.