Package org.apache.uima.analysis_engine.metadata

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


        aggDesc.getDelegateAnalysisEngineSpecifiersWithImports().put("XmlDetagger", xmlDetaggerDesc);
        flow.setFixedFlow(new String[] {"XmlDetagger", "UserAE", "XmiWriter"});
       
        //to run XmlDetagger we need sofa mappings
        //XmlDetagger's "xmlDocument" input sofa gets mapped to the default sofa
        SofaMapping sofaMapping1 = UIMAFramework.getResourceSpecifierFactory().createSofaMapping();
        sofaMapping1.setComponentKey("XmlDetagger");
        sofaMapping1.setComponentSofaName("xmlDocument");
        sofaMapping1.setAggregateSofaName(CAS.NAME_DEFAULT_SOFA);
       
        //for UserAE and XmiWriter, may default sofa to the "plainTextDocument" produced by the XmlDetagger
        SofaMapping sofaMapping2 = UIMAFramework.getResourceSpecifierFactory().createSofaMapping();
        sofaMapping2.setComponentKey("UserAE");
        sofaMapping2.setAggregateSofaName("plainTextDocument");
        SofaMapping sofaMapping3 = UIMAFramework.getResourceSpecifierFactory().createSofaMapping();
        sofaMapping3.setComponentKey("XmiWriter");
        sofaMapping3.setAggregateSofaName("plainTextDocument");
               
        aggDesc.setSofaMappings(new SofaMapping[] {sofaMapping1, sofaMapping2, sofaMapping3});
      }
      else {
        //no XML detagger needed in the aggregate in flow
View Full Code Here


        aggDesc.getDelegateAnalysisEngineSpecifiersWithImports().put("XmlDetagger", xmlDetaggerDesc);
        flow.setFixedFlow(new String[] {"XmlDetagger", "UserAE", "XmiWriter"});
       
        //to run XmlDetagger we need sofa mappings
        //XmlDetagger's "xmlDocument" input sofa gets mapped to the default sofa
        SofaMapping sofaMapping1 = UIMAFramework.getResourceSpecifierFactory().createSofaMapping();
        sofaMapping1.setComponentKey("XmlDetagger");
        sofaMapping1.setComponentSofaName("xmlDocument");
        sofaMapping1.setAggregateSofaName(CAS.NAME_DEFAULT_SOFA);
       
        //for UserAE and XmiWriter, may default sofa to the "plainTextDocument" produced by the XmlDetagger
        SofaMapping sofaMapping2 = UIMAFramework.getResourceSpecifierFactory().createSofaMapping();
        sofaMapping2.setComponentKey("UserAE");
        sofaMapping2.setAggregateSofaName("plainTextDocument");
        SofaMapping sofaMapping3 = UIMAFramework.getResourceSpecifierFactory().createSofaMapping();
        sofaMapping3.setComponentKey("XmiWriter");
        sofaMapping3.setAggregateSofaName("plainTextDocument");
               
        aggDesc.setSofaMappings(new SofaMapping[] {sofaMapping1, sofaMapping2, sofaMapping3});
      }
      else {
        //no XML detagger needed in the aggregate in flow
View Full Code Here

        if (!anyCapabilitySetDeclaresSofa(sofaName, isInput)) {
          Comparator comparator = new Comparator() {
            public int compare(Object o1, Object o2) {
              String name = (String) o1;
              SofaMapping sofaMapping = (SofaMapping) o2;
              if (name.equals(sofaMapping.getAggregateSofaName()))
                return 0;
              return 1;
            }
          };
          editor.getAeDescription().setSofaMappings(
View Full Code Here

    SofaMapping[] sofaMappings = getSofaMappings();
    if (null == sofaMappings)
      return stringArray0;
    Set bindings = new TreeSet();
    for (int i = 0; i < sofaMappings.length; i++) {
      SofaMapping sofaMapping = sofaMappings[i];
      if (sofaMapping.getAggregateSofaName().equals(aggrSofa))
        if (null != sofaMapping.getComponentSofaName()
                && !"".equals(sofaMapping.getComponentSofaName()))
          bindings.add(sofaMapping.getComponentKey() + '/' + sofaMapping.getComponentSofaName());
        else
          bindings.add(sofaMapping.getComponentKey());
    }
    String[] results = (String[]) bindings.toArray(stringArray0);
    Arrays.sort(results);
    return results;
  }
View Full Code Here

    // mark the bound ones with a value which is the aggr sofa they're bound to
    // also, add any that were not spec'd in the delegates (because
    // for instance, they were remote)
    SofaMapping[] sofaMappings = getSofaMappings();
    for (int i = 0; i < sofaMappings.length; i++) {
      SofaMapping sm = sofaMappings[i];
      String key = sm.getComponentKey();
      if (null != sm.getComponentSofaName())
        key = key + '/' + sm.getComponentSofaName();
      if (availOnly)
        allComponentSofas.remove(key);
      else
        allComponentSofas.put(key, sm.getAggregateSofaName());
    }

    // remove all that are bound to other Aggr sofa names
    // because although an Aggr sofa can be bound to many delegate sofas,
    // a delegate sofa can only be bound to one aggr one.
View Full Code Here

  }

  private void removeAggr(String aggrSofa) {
    Comparator comparator = new Comparator() {
      public int compare(Object aggrSofaName, Object o2) {
        SofaMapping sofaMapping = (SofaMapping) o2;
        if (sofaMapping.getAggregateSofaName().equals(aggrSofaName))
          return 0;
        else
          return -1;
      }
    };
View Full Code Here

   */
  private void removeComponentFromAggr(TreeItem selected) {
    final String aggrName = selected.getParentItem().getText();
    Comparator comparator = new Comparator() {
      public int compare(Object componentAndSofa, Object o2) {
        SofaMapping sofaMapping = (SofaMapping) o2;
        if (!sofaMapping.getAggregateSofaName().equals(aggrName))
          return -1;
        String component = getComponentOnly((String) componentAndSofa);
        if (!sofaMapping.getComponentKey().equals(component))
          return -1;
        String sofa = getSofaOnly((String) componentAndSofa);
        if (null == sofa || sofa.equals(""))
          if (null == sofaMapping.getComponentSofaName()
                  || "".equals(sofaMapping.getComponentSofaName()))
            return 0;
          else
            return -1;
        else if (sofa.equals(sofaMapping.getComponentSofaName()))
          return 0;
        else
          return -1;
      }
    };
View Full Code Here

      Set[] inOut = getCapabilitySofaNames((ResourceCreationSpecifier) delegate, componentKey);
      inOut[0].addAll(inOut[1]);
      final Set allDelegateComponentSofas = inOut[0];
      Comparator comparator = new Comparator() {
        public int compare(Object ignore, Object elementOfArray) {
          SofaMapping sofaMapping = (SofaMapping) elementOfArray;
          String key = sofaMapping.getComponentKey();
          if (null != sofaMapping.getComponentSofaName())
            key = key + '/' + sofaMapping.getComponentSofaName();
          if (allDelegateComponentSofas.contains(key)) {
            return 0;
          }
          return -1;
        }
View Full Code Here

   * @return a sofa mapping with the componentSofaName mapped to the aggregateSofaName
   */
  public static SofaMapping createSofaMapping(String componentKey, String componentSofaName,
          String aggregateSofaName) {

    SofaMapping sofaMapping = new SofaMapping_impl();
    sofaMapping.setComponentKey(componentKey);
    sofaMapping.setComponentSofaName(componentSofaName);
    sofaMapping.setAggregateSofaName(aggregateSofaName);
    return sofaMapping;
  }
View Full Code Here

        aggDesc.getDelegateAnalysisEngineSpecifiersWithImports().put("XmlDetagger", xmlDetaggerDesc);
        flow.setFixedFlow(new String[] {"XmlDetagger", "UserAE", "XmiWriter"});
       
        //to run XmlDetagger we need sofa mappings
        //XmlDetagger's "xmlDocument" input sofa gets mapped to the default sofa
        SofaMapping sofaMapping1 = UIMAFramework.getResourceSpecifierFactory().createSofaMapping();
        sofaMapping1.setComponentKey("XmlDetagger");
        sofaMapping1.setComponentSofaName("xmlDocument");
        sofaMapping1.setAggregateSofaName(CAS.NAME_DEFAULT_SOFA);
       
        //for UserAE and XmiWriter, may default sofa to the "plainTextDocument" produced by the XmlDetagger
        SofaMapping sofaMapping2 = UIMAFramework.getResourceSpecifierFactory().createSofaMapping();
        sofaMapping2.setComponentKey("UserAE");
        sofaMapping2.setAggregateSofaName("plainTextDocument");
        SofaMapping sofaMapping3 = UIMAFramework.getResourceSpecifierFactory().createSofaMapping();
        sofaMapping3.setComponentKey("XmiWriter");
        sofaMapping3.setAggregateSofaName("plainTextDocument");
               
        aggDesc.setSofaMappings(new SofaMapping[] {sofaMapping1, sofaMapping2, sofaMapping3});
      }
      else {
        //no XML detagger needed in the aggregate in flow
View Full Code Here

TOP

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

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.