Package org.apache.uima.cas

Examples of org.apache.uima.cas.SofaID


    // engTcas = aCas.getView(aCas.getSofa(realSofaName));
    engTcas = aCas;
    // if (engTcas == null )
    // System.out.println(realSofaName + " sofa not found in CAS");

    SofaID realSofaName = getContext().mapToSofaID("GermanDocument");
    // System.out.println("TRANSANNOTATOR: real sofa name of GermanDocument " +
    // realSofaName.getSofaID());
    // Create the output German text Sofa and open CAS view
    germTcas = aCas.getView(aCas.createSofa(realSofaName, "text"));
View Full Code Here


  public void process(CAS aCas, ResultSpecification aResultSpec) throws AnnotatorProcessException {
    CAS engTcas, germTcas;

    // get English text Sofa and open CAS view
    SofaID realSofaName = getContext().mapToSofaID("EnglishDocument");
    // System.out.println("TRANSANNOTATOR: real sofa name for English document " +
    // realSofaName.getSofaID());

    engTcas = aCas.getView(aCas.getSofa(realSofaName));
    // if (engTcas == null)
View Full Code Here

   * Test the mapToSofaID method in UimaContext.
   *
   */
  public void testGetUimaContextMapToSofaID() throws Exception {
    try {
      SofaID sofaid1 = delegateAE.getUimaContext().mapToSofaID("EnglishDocument");
      Assert.assertEquals("SourceDocument", sofaid1.getSofaID());
      SofaID sofaid2 = delegateAE.getUimaContext().mapToSofaID("GermanDocument");
      Assert.assertEquals("OutputTranslator1", sofaid2.getSofaID());

      SofaID sofaid3 = flowController.getUimaContext().mapToSofaID("OriginalDocument");
      Assert.assertEquals("SourceDocument", sofaid3.getSofaID());

      // now try the second aggregate (With the sofa-unaware mapping)
      sofaid1 = delegateAE2.getUimaContext().mapToSofaID(CAS.NAME_DEFAULT_TEXT_SOFA);
      Assert.assertEquals("SourceDocument", sofaid1.getSofaID());
      sofaid2 = delegateAE2.getUimaContext().mapToSofaID("GermanDocument");
View Full Code Here

   * Test the mapToSofaID method in UimaContext.
   *
   */
  public void testMapRootSofaNameToSofaID() throws Exception {
    try {
      SofaID sofaid1 = delegateAE.getUimaContext().mapToSofaID("EnglishDocument.1.txt");
      Assert.assertEquals("SourceDocument.1.txt", sofaid1.getSofaID());
      SofaID sofaid2 = delegateAE.getUimaContext().mapToSofaID("SomeID.1");
      Assert.assertEquals("SomeID.1", sofaid2.getSofaID());
    } catch (Exception e) {
      JUnitExtension.handleException(e);
    }
  }
View Full Code Here

   *
   */
  public void testGetAnnotatorContextMapToSofaID() throws Exception {
    try {
      AnnotatorContext context = new AnnotatorContext_impl(delegateAE.getUimaContextAdmin());
      SofaID sofaid1 = context.mapToSofaID("EnglishDocument");
      Assert.assertEquals("SourceDocument", sofaid1.getSofaID());
      SofaID sofaid2 = context.mapToSofaID("GermanDocument");
      Assert.assertEquals("OutputTranslator1", sofaid2.getSofaID());
    } catch (Exception e) {
      JUnitExtension.handleException(e);
    }
  }
View Full Code Here

      String absoluteRoot = (String) mSofaMappings.get(nameToMap);
      if (absoluteRoot == null)
        absoluteRoot = nameToMap;
      absoluteSofaName = absoluteRoot + rest;
    }
    SofaID sofaid = new SofaID_impl();
    sofaid.setSofaID(absoluteSofaName);
    return sofaid;
  }
View Full Code Here

    Iterator iter = sofamap.iterator();
    SofaID[] sofaArr = new SofaID_impl[sofamap.size()];
    int i = 0;
    while (iter.hasNext()) {
      Map.Entry elem = (Map.Entry) iter.next();
      SofaID sofaid = new SofaID_impl();
      sofaid.setComponentSofaName((String) elem.getKey());
      sofaid.setSofaID((String) elem.getValue());
      sofaArr[i] = sofaid;
      i++;
    }
    return sofaArr;
 
View Full Code Here

      CAS newCas = CasCreationUtils.createCas(typeSystem, null, null);
      File xcasFile = JUnitExtension.getFile("ExampleCas/multiSofaCas.xml");
      XCASDeserializer.deserialize(new FileInputStream(xcasFile), newCas);
      JCas newJCas = newCas.getJCas();
     
      SofaID sofaId = new SofaID_impl("EnglishDocument");
      JCas view = newJCas.getView(newJCas.getSofa(sofaId));
    }
    catch (Exception e) {
      JUnitExtension.handleException(e);     
    }     
View Full Code Here

TOP

Related Classes of org.apache.uima.cas.SofaID

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.