Package org.apache.uima.collection

Examples of org.apache.uima.collection.CollectionException


    File currentFile = (File) mFiles.get(mCurrentIndex++);
    FileInputStream inputStream = new FileInputStream(currentFile);
    try {
      XmiCasDeserializer.deserialize(inputStream, aCAS, ! mFailOnUnknownType);
    } catch (SAXException e) {
      throw new CollectionException(e);
    } finally {
      inputStream.close();
    }
  }
View Full Code Here


  public void getNext(JCas jCas) throws IOException, CollectionException {
    FileInputStream inputStream = new FileInputStream(this.filesIter.next());
    try {
      XmiCasDeserializer.deserialize(new BufferedInputStream(inputStream), jCas.getCas());
    } catch (SAXException e) {
      throw new CollectionException(e);
    }
    inputStream.close();
    this.completed += 1;
  }
View Full Code Here

  public void getNext(JCas jCas) throws IOException, CollectionException {
    FileInputStream inputStream = new FileInputStream(this.filesIter.next());
    try {
      XmiCasDeserializer.deserialize(new BufferedInputStream(inputStream), jCas.getCas());
    } catch (SAXException e) {
      throw new CollectionException(e);
    } finally {
      inputStream.close();
    }
    this.completed += 1;
  }
View Full Code Here

        }

      }   
      catch (CASException e)
      {
        throw new CollectionException(e);
      }
      finally
    {
      if (fileInputStream != null)
        fileInputStream.close();
View Full Code Here

                logger.error(document);
                throw e;
            }
        } catch (Exception e)
        {
            throw new CollectionException(e);
        }
    }
View Full Code Here

            }

            return hasAnotherRow;
        } catch (Exception e)
        {
            throw new CollectionException(e);
        }
    }
View Full Code Here

                  lines.add(line);
              }
          }
         
      } catch (CASException ce) {
          throw new CollectionException(ce);
      }
      line=null;

  }
View Full Code Here

    File currentFile = (File) mFiles.get(mCurrentIndex++);
    FileInputStream inputStream = new FileInputStream(currentFile);
    try {
      XmiCasDeserializer.deserialize(inputStream, aCAS, ! mFailOnUnknownType);
    } catch (SAXException e) {
      throw new CollectionException(e);
    } finally {
      inputStream.close();
    }
  }
View Full Code Here

  public void getNext(JCas jCas) throws IOException, CollectionException {
    FileInputStream inputStream = new FileInputStream(this.filesIter.next());
    try {
      XmiCasDeserializer.deserialize(new BufferedInputStream(inputStream), jCas.getCas());
    } catch (SAXException e) {
      throw new CollectionException(e);
    }
    inputStream.close();
    this.completed += 1;
  }
View Full Code Here

        String text;
        if(iv_delimeter != null)
      {
        int delimeterLoc = line.indexOf(iv_delimeter);
        if(delimeterLoc <= 0)
          throw new CollectionException(new Exception("Line in file number "+lineNumber+" is not well formatted.  " +
              "\nIt should have the format:" +
              "\n<doc_id>"+iv_delimeter+"<doc_text>"));
        id = line.substring(0,delimeterLoc);
        text = line.substring(delimeterLoc+iv_delimeter.length());
      }
        else
        {
          id = Integer.toString(lineNumber); //id will one more than its index into iv_linesFromFile (iv_currentIndex has already been incremented)
          text = line;
        }
       

        iv_logger.debug("id="+id);
        iv_logger.debug("text="+text);
       
      //if there's a CAS Initializer, call it 
      if (getCasInitializer() != null)
      {
        Reader reader = new StringReader(text);
        getCasInitializer().initializeCas(reader, cas);
        reader.close();
      }
      else  //No CAS Initiliazer, so read file and set document text ourselves
      {       
        jcas.setDocumentText(text);
      }
      
        //set language if it was explicitly specified as a configuration parameter
        if (iv_language != null)
        {
//          ((DocumentAnnotation)jcas.getDocumentAnnotationFs()).setLanguage(iv_language);
        }
       
       
        DocumentID documentIDAnnotation = new DocumentID(jcas);
        documentIDAnnotation.setDocumentID(id);
        documentIDAnnotation.addToIndexes();

      }
      catch (CASException e)
      {
        throw new CollectionException(e);
      }
      finally
      {
        iv_currentIndex++;
      }
View Full Code Here

TOP

Related Classes of org.apache.uima.collection.CollectionException

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.