Package org.apache.uima.collection

Examples of org.apache.uima.collection.CollectionReaderDescription


        InputStream inCollectionReaderDescripton = getClass()
                .getResourceAsStream("CorporaCollectionReader.xml");
       
        // TODO: inCollectionReaderDescripton check for null
       
        CollectionReaderDescription collectionReaderDescripton;
        try
        {
            collectionReaderDescripton = (CollectionReaderDescription)
            UIMAFramework.getXMLParser().parseResourceSpecifier(
                    new XMLInputSource(inCollectionReaderDescripton,
                            new File("")));
        }
        catch (InvalidXMLException e)
        {
            throw new InvocationTargetException(e, "CorporaCollectionReader.xml"
                    + " could ne be parsed!");
        }
       
        NlpProject project =
                mConfiguration.getConsumerElement().getNlpProject();
       
        InputStream inTypeSystemDescription;
        try
        {
            inTypeSystemDescription =
                project.getDotCorpus().getTypeSystemFile().getContents();
        }
        catch (CoreException e)
        {
            throw new InvocationTargetException(e);
        }
       
        TypeSystemDescription typeSystemDescriptor;
        try
        {
            typeSystemDescriptor = UIMAFramework.getXMLParser()
            .parseTypeSystemDescription(
                    new XMLInputSource(inTypeSystemDescription, new File("")));
           
            typeSystemDescriptor.resolveImports();
        }
        catch (InvalidXMLException e)
        {
            throw new InvocationTargetException(e);
        }
       
//      set type system to collection reader
        ProcessingResourceMetaData collectionReaderMetaData =
            collectionReaderDescripton.getCollectionReaderMetaData();
       
        collectionReaderMetaData.setTypeSystem(typeSystemDescriptor);
       
        XMLParser xmlParser = UIMAFramework.getXMLParser();
       
View Full Code Here


      uimaEEEngine = new BaseUIMAAsynchronousEngine_impl();
    }

    // add Collection Reader if specified
    if (collectionReaderDescriptor != null) {
      CollectionReaderDescription collectionReaderDescription = UIMAFramework.getXMLParser()
              .parseCollectionReaderDescription(new XMLInputSource(collectionReaderDescriptor));

      CollectionReader collectionReader = UIMAFramework
              .produceCollectionReader(collectionReaderDescription);
View Full Code Here

    AbstractSection.setVnsHostAndPort(aAe);
    // copy Ae into real descriptors if needed
    getTrueDescriptor();
    // use clones because validation modifies (imports get imported)
    if (isCollectionReaderDescriptor()) {
      CollectionReaderDescription collRdr = (CollectionReaderDescription) collectionReaderDescription
              .clone();
      try {
        collRdr.doFullValidation(createResourceManager());
      } catch (Throwable e) { // all these are Throwable to catch errors like
        // UnsupportedClassVersionError, which happens if the annotator
        // class is compiled for Java 5.0, but the CDE is running Java 1.4.2
        Utility
                .popMessage(
View Full Code Here

    AbstractSection.setVnsHostAndPort(aAe);
    // copy Ae into real descriptors if needed
    getTrueDescriptor();
    // use clones because validation modifies (imports get imported)
    if (isCollectionReaderDescriptor()) {
      CollectionReaderDescription collRdr = (CollectionReaderDescription) collectionReaderDescription
              .clone();
      try {
        collRdr.doFullValidation(createResourceManager());
      } catch (Throwable e) { // all these are Throwable to catch errors like
        // UnsupportedClassVersionError, which happens if the annotator
        // class is compiled for Java 5.0, but the CDE is running Java 1.4.2
        Utility
                .popMessage(
View Full Code Here

  public void runProcessingThread(File inputDir, String inputFileFormat, Boolean lenient, File outputDir, File aeSpecifierFile,
          String xmlTag, String language, String encoding) {
    try {
      // create and configure collection reader that will read input docs
      CollectionReaderDescription collectionReaderDesc = FileSystemCollectionReader
              .getDescription();
      ConfigurationParameterSettings paramSettings = collectionReaderDesc.getMetaData()
              .getConfigurationParameterSettings();
      paramSettings.setParameterValue(FileSystemCollectionReader.PARAM_INPUTDIR, inputDir
              .getAbsolutePath());
      paramSettings.setParameterValue(FileSystemCollectionReader.PARAM_XCAS, inputFileFormat);
      paramSettings.setParameterValue(FileSystemCollectionReader.PARAM_LENIENT, lenient ? "true" : "false");
View Full Code Here

    if (filename == null) {
      fail("Unable to find file:" + "descriptors/collection_reader/FileSystemCollectionReader.xml"
              + "in classloader");
    }
    File collectionReaderDescriptor = new File(filename);
    CollectionReaderDescription collectionReaderDescription = UIMAFramework.getXMLParser()
            .parseCollectionReaderDescription(new XMLInputSource(collectionReaderDescriptor));
    CollectionReader collectionReader = UIMAFramework
            .produceCollectionReader(collectionReaderDescription);
    eeUimaEngine.setCollectionReader(collectionReader);
    initialize(eeUimaEngine, appCtx);
View Full Code Here

  public void runProcessingThread(File inputDir, File outputDir, File aeSpecifierFile,
          String xmlTag, String language, String encoding) {
    try {
      // create and configure collection reader that will read input docs
      CollectionReaderDescription collectionReaderDesc = FileSystemCollectionReader
              .getDescription();
      ConfigurationParameterSettings paramSettings = collectionReaderDesc.getMetaData()
              .getConfigurationParameterSettings();
      paramSettings.setParameterValue(FileSystemCollectionReader.PARAM_INPUTDIR, inputDir
              .getAbsolutePath());
      paramSettings.setParameterValue(FileSystemCollectionReader.PARAM_LANGUAGE, language);
      paramSettings.setParameterValue(FileSystemCollectionReader.PARAM_ENCODING, encoding);
View Full Code Here

    AbstractSection.setVnsHostAndPort(aAe);
    // copy Ae into real descriptors if needed
    getTrueDescriptor();
    // use clones because validation modifies (imports get imported)
    if (isCollectionReaderDescriptor()) {
      CollectionReaderDescription collRdr = (CollectionReaderDescription) collectionReaderDescription
              .clone();
      try {
        collRdr.doFullValidation(createResourceManager());
      } catch (Throwable e) { // all these are Throwable to catch errors like
        // UnsupportedClassVersionError, which happens if the annotator
        // class is compiled for Java 5.0, but the CDE is running Java 1.4.2
        Utility
                .popMessage(
View Full Code Here

  protected void setUp() throws Exception {
    ccFactory = new CollectionReaderFactory_impl();
  }

  public void testInvalidFrameworkImplementation() {
    CollectionReaderDescription desc = new CollectionReaderDescription_impl();
    desc.setFrameworkImplementation("foo");   
    try {
      ccFactory.produceResource(CollectionReader.class, desc, Collections.EMPTY_MAP);
      fail();
    } catch (ResourceInitializationException e) {
      assertNotNull(e.getMessage());
View Full Code Here

        InputStream inCollectionReaderDescripton = getClass()
                .getResourceAsStream("CorporaCollectionReader.xml");

        // TODO: inCollectionReaderDescripton check for null

        CollectionReaderDescription collectionReaderDescripton;
        try
        {
            collectionReaderDescripton = (CollectionReaderDescription)
            UIMAFramework.getXMLParser().parseResourceSpecifier(
                    new XMLInputSource(inCollectionReaderDescripton,
                            new File("")));
        }
        catch (InvalidXMLException e)
        {
            throw new InvocationTargetException(e, "CorporaCollectionReader.xml"
                    + " could ne be parsed!");
        }

        NlpProject project =
                mConfiguration.getConsumerElement().getNlpProject();

        InputStream inTypeSystemDescription;
        try
        {
            inTypeSystemDescription =
                project.getDotCorpus().getTypeSystemFile().getContents();
        }
        catch (CoreException e)
        {
            throw new InvocationTargetException(e);
        }

        TypeSystemDescription typeSystemDescriptor;
        try
        {
            typeSystemDescriptor = UIMAFramework.getXMLParser()
            .parseTypeSystemDescription(
                    new XMLInputSource(inTypeSystemDescription, new File("")));

            typeSystemDescriptor.resolveImports();
        }
        catch (InvalidXMLException e)
        {
            throw new InvocationTargetException(e);
        }

//      set type system to collection reader
        ProcessingResourceMetaData collectionReaderMetaData =
            collectionReaderDescripton.getCollectionReaderMetaData();

        collectionReaderMetaData.setTypeSystem(typeSystemDescriptor);

        XMLParser xmlParser = UIMAFramework.getXMLParser();
View Full Code Here

TOP

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

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.