Package org.apache.uima.analysis_engine.metadata

Examples of org.apache.uima.analysis_engine.metadata.AnalysisEngineMetaData


    setAeDescription(aeDescription);
  }

  private AnalysisEngineMetaData convertToAeMetaData(ResourceMetaData r) {
    ProcessingResourceMetaData p = (ProcessingResourceMetaData) r;
    AnalysisEngineMetaData d = UIMAFramework.getResourceSpecifierFactory()
            .createAnalysisEngineMetaData();
    d.setCapabilities(p.getCapabilities());
    d.setConfigurationParameterDeclarations(p.getConfigurationParameterDeclarations());
    d.setConfigurationParameterSettings(p.getConfigurationParameterSettings());
    d.setCopyright(p.getCopyright());
    d.setDescription(p.getDescription());
    d.setFsIndexCollection(p.getFsIndexCollection());
    d.setName(p.getName());
    d.setTypePriorities(p.getTypePriorities());
    d.setTypeSystem(p.getTypeSystem());
    d.setVendor(p.getVendor());
    d.setVersion(p.getVersion());
    d.setOperationalProperties(p.getOperationalProperties());
    return d;
  }
View Full Code Here


        dlgImport.setLocation(dlgDescRelPath);
        // add delegate Import to the Map
        delegatesMap.put(dlgName, dlgImport);
      }
      // get AE metadata
      AnalysisEngineMetaData aggMetadata = aggDescription.getAnalysisEngineMetaData();
      // set AE name and textual description
      aggMetadata.setName(aggCompName);
      aggMetadata.setDescription("Merged aggregate component" + "(" + PMController.PEAR_MERGER
              + ")");
      // set fixed flow constraints
      FixedFlow aggFixedFlow = rsFactory.createFixedFlow();
      String[] aggFlowSpecs = new String[dlgInstDescs.length];
      for (int i = 0; i < dlgInstDescs.length; i++)
        aggFlowSpecs[i] = dlgInstDescs[i].getMainComponentId();
      aggFixedFlow.setFixedFlow(aggFlowSpecs);
      aggMetadata.setFlowConstraints(aggFixedFlow);
      // collect capabilities & check operational props of delegates
      ArrayList allCapabilities = new ArrayList();
      boolean isMultipleDeploymentAllowed = true;
      boolean modifiesCas = false;
      for (int i = 0; i < dlgInstDescs.length; i++) {
        lastInputNo = i + 1;
        ResourceSpecifier dlgSpecifier = retrieveDelegateSpecifier(aggRootDir, dlgInstDescs[i]);
        if (dlgSpecifier instanceof AnalysisEngineDescription) {
          // get AE metadata
          AnalysisEngineMetaData dlgAeMetadata = ((AnalysisEngineDescription) dlgSpecifier)
                  .getAnalysisEngineMetaData();
          // collect AE capabilities
          Capability[] dlgCapabilities = dlgAeMetadata.getCapabilities();
          if (dlgCapabilities != null)
            for (int n = 0; n < dlgCapabilities.length; n++)
              allCapabilities.add(dlgCapabilities[n]);
          // check operational properties
          OperationalProperties dlgOperProps = dlgAeMetadata.getOperationalProperties();
          if (dlgOperProps != null) {
            if (!dlgOperProps.isMultipleDeploymentAllowed())
              isMultipleDeploymentAllowed = false;
            if (dlgOperProps.getModifiesCas())
              modifiesCas = true;
View Full Code Here

    try {
      // create pool
      pool = new AnalysisEnginePool("taePool", 3, mSimpleDesc);

      AnalysisEngine tae = pool.getAnalysisEngine();
      AnalysisEngineMetaData md = tae.getAnalysisEngineMetaData();
      Assert.assertNotNull(md);
      Assert.assertEquals("Simple Test", md.getName());
    } catch (Exception e) {
      JUnitExtension.handleException(e);
    } finally {
      if (pool != null)
        pool.destroy();
View Full Code Here

      // create primitive AE description
      primitiveDesc = new AnalysisEngineDescription_impl();
      primitiveDesc.setFrameworkImplementation(Constants.JAVA_FRAMEWORK_NAME);
      primitiveDesc.setPrimitive(true);
      primitiveDesc.setAnnotatorImplementationName("org.apache.uima.examples.TestAnnotator");
      AnalysisEngineMetaData md = primitiveDesc.getAnalysisEngineMetaData();
      md.setName("Test TAE");
      md.setDescription("Does not do anything useful.");
      md.setVersion("1.0");
      md.setTypeSystem(typeSystem);
      md.setTypePriorities(typePriorities);
      md.setFsIndexes(new FsIndexDescription[] { index, index2 });
      Capability cap1 = new Capability_impl();
      cap1.setDescription("First fake capability");
      cap1.addOutputType("Fake", false);
      cap1.addOutputFeature("TestFeature");
      Capability cap2 = new Capability_impl();
      cap2.setDescription("Second fake capability");
      cap2.addInputType("Fake", true);
      cap2.addOutputType("Fake", true);
      // SimplePrecondition precond1 = new SimplePrecondition_impl();
      // precond1.setFeatureDescription(feature1);
      // precond1.setComparisonValue(new String[]{"en,de"});
      // precond1.setPredicate(SimplePrecondition.LANGUAGE_SUBSUMED);
      // cap1.setPreconditions(new Precondition[]{precond1});
      cap1.setLanguagesSupported(new String[] { "en", "de" });
      cap1.setMimeTypesSupported(new String[] { "text/plain" });
      md.setCapabilities(new Capability[] { cap1, cap2 });
      ConfigurationParameter cfgParam1 = new ConfigurationParameter_impl();
      cfgParam1.setName("param1");
      cfgParam1.setDescription("Test Parameter 1");
      cfgParam1.setType("String");
      ConfigurationParameter cfgParam2 = new ConfigurationParameter_impl();
      cfgParam2.setName("param2");
      cfgParam2.setDescription("Test Parameter 2");
      cfgParam2.setType("Integer");
      ConfigurationGroup cfgGrp1 = new ConfigurationGroup_impl();
      cfgGrp1.setNames(new String[] { "cfgGrp1" });
      cfgGrp1.setConfigurationParameters(new ConfigurationParameter[] { cfgParam1, cfgParam2 });
      ConfigurationParameter cfgParam3 = new ConfigurationParameter_impl();
      cfgParam3.setName("param3");
      cfgParam3.setDescription("Test Parameter 3");
      cfgParam3.setType("Float");
      ConfigurationGroup cfgGrp2 = new ConfigurationGroup_impl();
      cfgGrp2.setNames(new String[] { "cfgGrp2a", "cfgGrp2b" });
      cfgGrp2.setConfigurationParameters(new ConfigurationParameter[] { cfgParam3 });
      md.getConfigurationParameterDeclarations().setConfigurationGroups(
              new ConfigurationGroup[] { cfgGrp1, cfgGrp2 });

      NameValuePair nvp1 = new NameValuePair_impl("param1", "test");
      NameValuePair nvp2 = new NameValuePair_impl("param2", Integer.valueOf("42"));
      NameValuePair nvp3a = new NameValuePair_impl("param3", Float.valueOf("2.718281828459045"));
      NameValuePair nvp3b = new NameValuePair_impl("param3", Float.valueOf("3.1415927"));
      ConfigurationParameterSettings settings = md.getConfigurationParameterSettings();
      settings.getSettingsForGroups().put("cfgGrp1", new NameValuePair[] { nvp1, nvp2 });
      settings.getSettingsForGroups().put("cfgGrp2a", new NameValuePair[] { nvp3a });
      settings.getSettingsForGroups().put("cfgGrp2b", new NameValuePair[] { nvp3b });

      // create aggregate AE description
      aggregateDesc = new AnalysisEngineDescription_impl();
      aggregateDesc.setFrameworkImplementation(Constants.JAVA_FRAMEWORK_NAME);
      aggregateDesc.setPrimitive(false);
      Map<String, MetaDataObject> delegateTaeMap = aggregateDesc.getDelegateAnalysisEngineSpecifiersWithImports();
      delegateTaeMap.put("Test", primitiveDesc);
      AnalysisEngineDescription_impl primDesc2 = new AnalysisEngineDescription_impl();
      primDesc2.setFrameworkImplementation(Constants.JAVA_FRAMEWORK_NAME);
      primDesc2.setAnnotatorImplementationName("fakeClass");
      primDesc2.getAnalysisEngineMetaData().setName("fakeAnnotator");
      primDesc2.getAnalysisEngineMetaData().setCapabilities(
              new Capability[] { new Capability_impl() });
      delegateTaeMap.put("Empty", primDesc2);
      URISpecifier uriSpec = new URISpecifier_impl();
      uriSpec.setUri("http://incubator.apache.org/uima");
      uriSpec.setProtocol(Constants.PROTOCOL_SOAP);
      FlowControllerDeclaration fcDecl = new FlowControllerDeclaration_impl();
      fcDecl.setKey("TestFlowController");
      FlowControllerDescription fcDesc = new FlowControllerDescription_impl();
      fcDesc.getMetaData().setName("MyTestFlowController");
      fcDecl.setSpecifier(fcDesc);
      aggregateDesc.setFlowControllerDeclaration(fcDecl);

      ExternalResourceDependency dep = UIMAFramework.getResourceSpecifierFactory()
              .createExternalResourceDependency();
      dep.setKey("ResourceKey");
      dep.setDescription("Test");
      aggregateDesc.setExternalResourceDependencies(new ExternalResourceDependency[] { dep });
      ResourceManagerConfiguration resMgrCfg = UIMAFramework.getResourceSpecifierFactory()
              .createResourceManagerConfiguration();
      ExternalResourceDescription extRes = UIMAFramework.getResourceSpecifierFactory()
              .createExternalResourceDescription();
      extRes.setResourceSpecifier(uriSpec);
      extRes.setName("Resource1");
      extRes.setDescription("Test");
      resMgrCfg.setExternalResources(new ExternalResourceDescription[] { extRes });

      ExternalResourceBinding binding = UIMAFramework.getResourceSpecifierFactory()
              .createExternalResourceBinding();
      binding.setKey("ResourceKey");
      binding.setResourceName("Resource1");
      aggregateDesc.setResourceManagerConfiguration(resMgrCfg);

      // AsbCreationSpecifier asbSpec = new AsbCreationSpecifier_impl();
      // asbSpec.getAsbMetaData().setAsynchronousModeSupported(true);
      // asbSpec.getAsbMetaData().setSupportedProtocols(new String[]{Constants.PROTOCOL_SOAP});
      // aggregateDesc.setAsbSpecifier(asbSpec);
      // AnalysisSequencerCrea1tionSpecifier seqSpec = new
      // AnalysisSequencerCreationSpecifier_impl();
      // seqSpec.getAnalysisSequencerMetaData().setSupportedPreconditionTypes(
      // new String[]{SimplePrecondition.PRECONDITION_TYPE});
      // aggregateDesc.setSequencerSpecifier(seqSpec);
      md = aggregateDesc.getAnalysisEngineMetaData();
      md.setName("Test Aggregate TAE");
      md.setDescription("Does not do anything useful.");
      md.setVersion("1.0");
      // md.setTypeSystem(typeSystem);
      // md.setFsIndexes(new FsIndexDescription[]{index});
      md.setCapabilities(primitiveDesc.getAnalysisEngineMetaData().getCapabilities());
      FixedFlow fixedFlow = new FixedFlow_impl();
      fixedFlow.setFixedFlow(new String[] { "Test", "Empty" });
      md.setFlowConstraints(fixedFlow);
    } catch (Exception e) {
      JUnitExtension.handleException(e);
    }
  }
View Full Code Here

    // add sequence - fixed flow
    FixedFlow fixedFlow = UIMAFramework.getResourceSpecifierFactory().createFixedFlow();
    fixedFlow.setFixedFlow(keys);

    // add analysis engine meta data
    AnalysisEngineMetaData md = desc.getAnalysisEngineMetaData();
    md.setName("PEAR aggregate");
    md.setDescription("combines one or more PEARs");
    md.setVersion("1.0");
    md.setFlowConstraints(fixedFlow);

    // serialize descriptor 
//    String outputDir = JUnitExtension.getFile("pearTests/DateTime.pear").getParent(); File
//    outputFile = new File(outputDir, "PearAggregate.xml"); OutputStream outStream = new
//    BufferedOutputStream(new FileOutputStream(outputFile)); Writer writer = new
View Full Code Here

  }

  protected Capability addCapabilitySet() {
    Capability newCset = UIMAFramework.getResourceSpecifierFactory().createCapability();
    // update the model
    AnalysisEngineMetaData md = getAnalysisEngineMetaData();
    Capability[] c = getCapabilities();
    if (c == null)
      md.setCapabilities(new Capability[] { newCset });
    else {
      Capability[] newC = new Capability[c.length + 1];
      System.arraycopy(c, 0, newC, 0, c.length);
      newC[c.length] = newCset;
      md.setCapabilities(newC);
    }
    return newCset;
  }
View Full Code Here

        setVnsHostAndPort(o);
        ae = UIMAFramework.produceAnalysisEngine(uriSpec);
      } catch (ResourceInitializationException e) {
        return null;
      }
      AnalysisEngineMetaData aemd = ae.getAnalysisEngineMetaData();
      ae.destroy();
      return aemd;
    }
   
    throw new InternalErrorCDE("invalid call");
View Full Code Here

      op.setModifiesCas(MODIFIES_CAS_DEFAULT);
      op.setOutputsNewCASes(OUTPUTS_NEW_CASES_DEFAULT);
    }

    // Configure resource meta data
    AnalysisEngineMetaData meta = desc.getAnalysisEngineMetaData();
    ResourceMetaDataFactory.configureResourceMetaData(meta, componentClass);

    // set parameters
    setParameters(desc, componentClass, configurationParameters, configurationValues);
View Full Code Here

      SaxDeserializer saxDeser = UIMAFramework.getXMLParser().newSaxDeserializer();

      VinciSaxParser vinciSaxParser = new VinciSaxParser();
      vinciSaxParser.setContentHandler(saxDeser);
      vinciSaxParser.parse(resultFrame);
      AnalysisEngineMetaData metadata = (AnalysisEngineMetaData) saxDeser.getObject();

      return metadata;
    } catch (Exception e) {
      throw new ResourceServiceException(e);
    }
View Full Code Here

        dlgImport.setLocation(dlgDescRelPath);
        // add delegate Import to the Map
        delegatesMap.put(dlgName, dlgImport);
      }
      // get AE metadata
      AnalysisEngineMetaData aggMetadata = aggDescription.getAnalysisEngineMetaData();
      // set AE name and textual description
      aggMetadata.setName(aggCompName);
      aggMetadata.setDescription("Merged aggregate component" + "(" + PMController.PEAR_MERGER
              + ")");
      // set fixed flow constraints
      FixedFlow aggFixedFlow = rsFactory.createFixedFlow();
      String[] aggFlowSpecs = new String[dlgInstDescs.length];
      for (int i = 0; i < dlgInstDescs.length; i++)
        aggFlowSpecs[i] = dlgInstDescs[i].getMainComponentId();
      aggFixedFlow.setFixedFlow(aggFlowSpecs);
      aggMetadata.setFlowConstraints(aggFixedFlow);
      // collect capabilities & check operational props of delegates
      ArrayList allCapabilities = new ArrayList();
      boolean isMultipleDeploymentAllowed = true;
      boolean modifiesCas = false;
      for (int i = 0; i < dlgInstDescs.length; i++) {
        lastInputNo = i + 1;
        ResourceSpecifier dlgSpecifier = retrieveDelegateSpecifier(aggRootDir, dlgInstDescs[i]);
        if (dlgSpecifier instanceof AnalysisEngineDescription) {
          // get AE metadata
          AnalysisEngineMetaData dlgAeMetadata = ((AnalysisEngineDescription) dlgSpecifier)
                  .getAnalysisEngineMetaData();
          // collect AE capabilities
          Capability[] dlgCapabilities = dlgAeMetadata.getCapabilities();
          if (dlgCapabilities != null)
            for (int n = 0; n < dlgCapabilities.length; n++)
              allCapabilities.add(dlgCapabilities[n]);
          // check operational properties
          OperationalProperties dlgOperProps = dlgAeMetadata.getOperationalProperties();
          if (dlgOperProps != null) {
            if (!dlgOperProps.isMultipleDeploymentAllowed())
              isMultipleDeploymentAllowed = false;
            if (dlgOperProps.getModifiesCas())
              modifiesCas = true;
View Full Code Here

TOP

Related Classes of org.apache.uima.analysis_engine.metadata.AnalysisEngineMetaData

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.