Package org.apache.uima.cas

Examples of org.apache.uima.cas.Type


  }

  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;

    if (style == null) {
      style = new AnnotationStyle(selectedType.getName(), AnnotationStyle.DEFAULT_STYLE,
              AnnotationStyle.DEFAULT_COLOR, mCurrentSelectedAnnotation.getLayer());
    }

    mStyleCombo.setText(style.getStyle().name());
    mStyleCombo.setEnabled(true);
View Full Code Here


    typeColumn.getColumn().setWidth(250);
    typeColumn.setLabelProvider(new CellLabelProvider(){
      @Override
      public void update(ViewerCell cell) {

        Type type = (Type) cell.getElement();

        cell.setText(type.getName());
      }});

    TableViewerColumn layerColumn = new TableViewerColumn(mTypeList, SWT.LEFT);
    layerColumn.getColumn().setText("Layer");
    layerColumn.getColumn().setWidth(50);

    layerColumn.setLabelProvider(new CellLabelProvider() {

      @Override
      public void update(ViewerCell cell) {

        Type type = (Type) cell.getElement();

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

   *
   * @throws AnalysisEngineProcessException
   */
  public static Type getType(TypeSystem typeSystem, String name)
      throws AnalysisEngineProcessException {
    Type type = typeSystem.getType(name);
   
    if (type == null) {
      throw new OpenNlpAnnotatorProcessException(
          ExceptionMessages.TYPE_NOT_FOUND,
          new Object[] {name});
View Full Code Here

   *
   * @throws ResourceInitializationException
   */
  public static Type getType(TypeSystem typeSystem, String name)
      throws ResourceInitializationException {
    Type type = getOptionalType(typeSystem, name);
   
    if (type == null) {
      throw new ResourceInitializationException(
          ResourceInitializationException.INCOMPATIBLE_RANGE_TYPES,
          new Object[] { "Unable to retrieve " + name + " type!" });
View Full Code Here

      // if output dir specified, dump CAS to XMI
      if (outputDir != null) {
        // try to retreive the filename of the input file from the CAS
        File outFile = null;
        Type srcDocInfoType = aCas.getTypeSystem().getType(
                "org.apache.uima.examples.SourceDocumentInformation");
        if (srcDocInfoType != null) {
          FSIterator it = aCas.getIndexRepository().getAllIndexedFS(srcDocInfoType);
          if (it.hasNext()) {
            FeatureStructure srcDocInfoFs = it.get();
            Feature uriFeat = srcDocInfoType.getFeatureByBaseName("uri");
            Feature offsetInSourceFeat = srcDocInfoType.getFeatureByBaseName("offsetInSource");
            String uri = srcDocInfoFs.getStringValue(uriFeat);
            int offsetInSource = srcDocInfoFs.getIntValue(offsetInSourceFeat);
            File inFile;
            try {
              inFile = new File(new URL(uri).getPath());
View Full Code Here

      RutaRuleElement re = (RutaRuleElement) nextElement;
      RutaMatcher matcher = re.getMatcher();
      if (matcher instanceof RutaTypeMatcher) {
        RutaTypeMatcher typeMatcher = (RutaTypeMatcher) re.getMatcher();
        List<Type> types = typeMatcher.getTypes(parent, stream);
        Type type = types.get(0);
        iterator = getIteratorOfType(after, type, annotation, stream);
      } else {
        // should not happen
      }
    } else {
View Full Code Here

  }

  private AnnotationFS getCoveredByWildCard(boolean after, AnnotationFS last, AnnotationFS next,
          RutaStream stream) {
    CAS cas = stream.getCas();
    Type type = cas.getAnnotationType();
    AnnotationFS documentAnnotation = stream.getDocumentAnnotation();

    // order like in the index
    AnnotationFS before = last;
    AnnotationFS later = next;
View Full Code Here

      // 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();
      FSIndex ind = irep.getIndex("Index1");
View Full Code Here

              .parseAnalysisEngineDescription(
                      new XMLInputSource(JUnitExtension
                              .getFile("TextAnalysisEngineImplTest/NewlineResegmenter.xml")));
      AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(segmenterDesc);
      CAS inputCas1 = ae.newCAS();
      Type sdiType = inputCas1.getTypeSystem().getType(
              "org.apache.uima.examples.SourceDocumentInformation");
      Feature uriFeat = sdiType.getFeatureByBaseName("uri");
      inputCas1.setDocumentText("This is");
      FeatureStructure sdiFS = inputCas1.createFS(sdiType);
      sdiFS.setStringValue(uriFeat, "cas1");
      inputCas1.getIndexRepository().addFS(sdiFS);
      CAS inputCas2 = ae.newCAS();
View Full Code Here

       */
      int id = -1;
      IntVector indexRep = new IntVector(); // empty means not indexed
      String attrName, attrValue;
      final int heapValue = cas.getHeapValue(addr);
      final Type type = cas.ll_getTypeSystem().ll_getTypeForCode(cas.ll_getFSRefType(addr));

      // Special handling for Sofas
      if (sofaTypeCode == heapValue) {
        // create some maps to handle v1 format XCAS ...
        // ... where the sofa feature of annotations was an int not a ref
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.