Package org.apache.uima.jcas.cas

Examples of org.apache.uima.jcas.cas.TOP


      } catch (CASException e1) {
       logAndThrow(e1, jcasView);
      }
    
     // Return eq fs instance if already created
      TOP fs = jcasView.getJfsFromCaddr(addr);
      if (null != fs) {
        fs.jcasType = jcasView.getType(type);
      } else {
        initargs[0] = Integer.valueOf(addr);
        initargs[1] = jcasView.getType(type);
View Full Code Here


    // covert to array for spring batch update
    // final Integer[] annoIdArray = annoIds.toArray(new Integer[] {});
    final List<Integer> annoIdList = new ArrayList<Integer>(annoIds);
    // get mappinginfo
    // final TOP t = mapIdToAnno.get(annoIdArray[0]);
    final TOP t = mapIdToAnno.get(annoIdList.get(0));
    final Type type = t.getType();
    final AnnoMappingInfo mapInfo = this.getMapInfo(t);
    // get non primitive fields, insert them after inserting the annotation
    final Set<String> fsNames = this.tl_mapFieldInfo.get().get(
        type.getName());
    final ListMultimap<String, AnnoFSAttribute> mapAnnoToFS = ArrayListMultimap
View Full Code Here

    Collection<? extends TOP> srcObjs = JCasUtil.select(jcas, srcClass);
    for(TOP srcObj : srcObjs){
      Object[] constrArgVals = { jcas };
      try {
        // create new destination object
        TOP destObj = (TOP) iv_destContr.newInstance(constrArgVals);

        // copy data from source to destination
        Iterator<Method> getterItr = iv_getSetMap.keySet().iterator();
        while (getterItr.hasNext()) {
          Method getterMeth = getterItr.next();
          Method setterMeth = iv_getSetMap.get(getterMeth);

          Object val = getterMeth.invoke(srcObj, (Object[]) null);
          Object[] setterArgs = { val };
          setterMeth.invoke(destObj, setterArgs);
        }
        // add new destination object to JCas
        destObj.addToIndexes();
      } catch (Exception e) {
        throw new AnalysisEngineProcessException(e);
      }
    }
  }
View Full Code Here

      this.featureValue = featureValue;
    }

    public void setValueFrom(Map<String, ? extends TOP> idAnnotationMap) {
      if (this.featureValue != null) {
        TOP valueAnnotation = idAnnotationMap.get(this.featureValue.id);
        if (valueAnnotation == null) {
          LOGGER.warn(String.format(
              "unable to set feature; found no annotation for %s",
              this.featureValue.id));
        } else {
View Full Code Here

      this.featureValue = featureValue;
    }

    public void setValueFrom(Map<String, ? extends TOP> idAnnotationMap) {
      if (this.featureValue != null) {
        TOP valueAnnotation = idAnnotationMap.get(this.featureValue.id);
        if (valueAnnotation == null) {
          LOGGER.warn(String.format(
              "unable to set feature; found no annotation for %s",
              this.featureValue.id));
        } else {
View Full Code Here

        // remove old NominalAttributeValue objects from CAS
        Iterator<NominalAttributeValue> removalItr = removalList.iterator();
        while (removalItr.hasNext())
        {
            TOP top = (TOP) removalItr.next();
            top.removeFromIndexes();
        }
     
        /**
         *
         * This is to deal with cases like "nonsmoker" and "non-smoker"
View Full Code Here

    Iterator srcObjItr = indexes.getAnnotationIndex(org.apache.ctakes.typesystem.type.textspan.Segment.type).iterator();
    org.apache.ctakes.typesystem.type.textspan.Segment segment = null;
   
    while (srcObjItr.hasNext())
    {
      TOP srcObj = (TOP) srcObjItr.next();

      Object[] constrArgVals = { jcas };
      try
      {
        // create new destination object
        TOP destObj = (TOP) iv_destContr.newInstance(constrArgVals);
       
        // Find the segments that are to be handled as complete sections
                boolean okayToSkip = false;
                boolean segmentMissing = iv_skipSegmentsSet.isEmpty();
        if (!segmentMissing){
          Iterator getSkipSegs = iv_skipSegmentsSet.iterator();
          segment = (org.apache.ctakes.typesystem.type.textspan.Segment) srcObj;
          while (getSkipSegs.hasNext()  && !okayToSkip){
            if (getSkipSegs.next().equals(segment.getId())){

              okayToSkip = true;
            }
          }
         
        }
        // copy data from source to destination
        Iterator getterItr = iv_getSetMap.keySet().iterator();
       

        while (getterItr.hasNext() && (okayToSkip || segmentMissing))
        {
          Method getterMeth = (Method) getterItr.next();
          Method setterMeth = (Method) iv_getSetMap.get(getterMeth);

          Object val = getterMeth.invoke(srcObj, (Object []) null);
          Object[] setterArgs = { val };
          setterMeth.invoke(destObj, setterArgs);
         
        }
        // add new destination object to JCas
        if (okayToSkip) {
          destObj.addToIndexes();
        } else {
          Iterator lookupWindows = FSUtil.getAnnotationsInSpanIterator(jcas, org.apache.ctakes.typesystem.type.textspan.LookupWindowAnnotation.type, segment.getBegin(), segment.getEnd());
          while (lookupWindows.hasNext()){
            org.apache.ctakes.typesystem.type.textspan.LookupWindowAnnotation lookup = (org.apache.ctakes.typesystem.type.textspan.LookupWindowAnnotation) lookupWindows.next();
            org.apache.ctakes.typesystem.type.textspan.DrugLookupWindowAnnotation drugLookup = new org.apache.ctakes.typesystem.type.textspan.DrugLookupWindowAnnotation(jcas, lookup.getBegin(), lookup.getEnd()); //Reorganized paths in 3.0 SPM
View Full Code Here

    // iterate over source objects in JCas
    JFSIndexRepository indexes = jcas.getJFSIndexRepository();
    FSIterator<Annotation> srcObjItr = indexes.getAnnotationIndex(
        iv_srcType).iterator();
    while (srcObjItr.hasNext()) {
      TOP srcObj = (TOP) srcObjItr.next();

      Object[] constrArgVals = { jcas };
      try {
        // create new destination object
        TOP destObj = (TOP) iv_destContr.newInstance(constrArgVals);

        // copy data from source to destination
        Iterator<Method> getterItr = iv_getSetMap.keySet().iterator();
        while (getterItr.hasNext()) {
          Method getterMeth = (Method) getterItr.next();
          Method setterMeth = (Method) iv_getSetMap.get(getterMeth);

          Object val = getterMeth.invoke(srcObj, (Object[]) null);
          Object[] setterArgs = { val };
          setterMeth.invoke(destObj, setterArgs);
        }
        // add new destination object to JCas
        destObj.addToIndexes();
      } catch (Exception e) {
        throw new AnalysisEngineProcessException(e);
      }
    }
  }
View Full Code Here

      this.featureValue = featureValue;
    }

    public void setValueFrom(Map<String, ? extends TOP> idAnnotationMap) {
      if (this.featureValue != null) {
        TOP valueAnnotation = idAnnotationMap.get(this.featureValue.id);
        if (valueAnnotation == null) {
          LOGGER.warn(String.format(
              "unable to set feature; found no annotation for %s",
              this.featureValue.id));
        } else {
View Full Code Here

        Annotation a = (Annotation) newFS;
        a.setBegin(matchedAnnotation.getBegin());
        a.setEnd(matchedAnnotation.getEnd());
        stream.addAnnotation(a, match);
      }
      TOP newStructure = null;
      if (newFS instanceof TOP) {
        newStructure = (TOP) newFS;
        gatherFeatures(newStructure, features, matchedAnnotation, element, match, stream);
        newStructure.addToIndexes();
      }
    }

  }
View Full Code Here

TOP

Related Classes of org.apache.uima.jcas.cas.TOP

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.