Package org.apache.uima.resource.metadata.impl

Examples of org.apache.uima.resource.metadata.impl.TypeSystemDescription_impl


    assertTrue(CAS.NAME_DEFAULT_SOFA.equals(v1cas.getSofa().getSofaID()));
    assertTrue(v1cas.getDocumentText().equals("some text for the default text sofa."));
  }
 
  public void testDuplicateNsPrefixes() throws Exception {
    TypeSystemDescription ts = new TypeSystemDescription_impl();
    ts.addType("org.bar.foo.Foo", "", "uima.tcas.Annotation");
    ts.addType("org.baz.foo.Foo", "", "uima.tcas.Annotation");
    CAS cas = CasCreationUtils.createCas(ts, null, null);
    cas.setDocumentText("Foo");
    Type t1 = cas.getTypeSystem().getType("org.bar.foo.Foo");
    Type t2 = cas.getTypeSystem().getType("org.baz.foo.Foo");
    AnnotationFS a1 = cas.createAnnotation(t1,0,3);
View Full Code Here


 
 
 
  public void testOutOfTypeSystemData() throws Exception {
    // deserialize a simple XMI into a CAS with no TypeSystem   
    CAS cas = CasCreationUtils.createCas(new TypeSystemDescription_impl(),
            new TypePriorities_impl(), new FsIndexDescription[0]);
    File xmiFile = JUnitExtension.getFile("ExampleCas/simpleCas.xmi");
    String xmiStr = FileUtils.file2String(xmiFile, "UTF-8");
   
    XmiSerializationSharedData sharedData = new XmiSerializationSharedData();
View Full Code Here

   
    //serialize to XMI
    String xmiStr = serialize(originalCas, null);
   
    //deserialize into a CAS with no type system
    CAS casWithNoTs = CasCreationUtils.createCas(new TypeSystemDescription_impl(),
            new TypePriorities_impl(), new FsIndexDescription[0]);
    XmiSerializationSharedData sharedData = new XmiSerializationSharedData();
    deserialize(xmiStr, casWithNoTs, sharedData, true, -1);
       
    // now reserialize including OutOfTypeSystem data
View Full Code Here

      primitiveDesc.setPrimitive(true);
      primitiveDesc
              .setAnnotatorImplementationName("org.apache.uima.analysis_engine.impl.TestAnnotator");
      primitiveDesc.getMetaData().setName("Test Primitive TAE");

      TypeSystemDescription tsd = new TypeSystemDescription_impl();
      tsd.addType("NamedEntity", "", "uima.tcas.Annotation");
      tsd.addType("DocumentStructure", "", "uima.cas.TOP");
      primitiveDesc.getAnalysisEngineMetaData().setTypeSystem(tsd);
      cap = new Capability_impl();
      cap.addOutputType("NamedEntity", true);
      cap.addOutputType("DocumentStructure", true);
      caps = new Capability[] {cap};
View Full Code Here

      AnalysisEngineDescription desc = new AnalysisEngineDescription_impl();
      desc.setPrimitive(true);
      desc.getMetaData().setName("Test Primitive TAE");
      desc.setAnnotatorImplementationName("org.apache.uima.analysis_engine.impl.TestAnnotator");

      TypeSystemDescription typeSystem = new TypeSystemDescription_impl();
      TypeDescription type1 = typeSystem.addType("Type1", "Test Type One",
              CAS.TYPE_NAME_ANNOTATION);
      FeatureDescription feat1 = new FeatureDescription_impl();
      feat1.setName("Feature1");
      feat1.setRangeTypeName(CAS.TYPE_NAME_INTEGER);
      type1.setFeatures(new FeatureDescription[] { feat1 });
      TypeDescription type2 = typeSystem.addType("Type2", "Test Type Two",
              CAS.TYPE_NAME_ANNOTATION);
      FeatureDescription feat2 = new FeatureDescription_impl();
      feat2.setName("Feature2");
      feat2.setRangeTypeName("EnumType");
      type2.setFeatures(new FeatureDescription[] { feat2 });
      TypeDescription enumType = typeSystem.addType("EnumType", "Test Enumerated Type",
              "uima.cas.String");
      enumType.setAllowedValues(new AllowedValue[] { new AllowedValue_impl("One", "First Value"),
          new AllowedValue_impl("Two", "Second Value") });
      desc.getAnalysisEngineMetaData().setTypeSystem(typeSystem);
View Full Code Here

    }
  }
 
  public void testIndexTwice() throws Exception {
    try {
      CAS newCas = CasCreationUtils.createCas(new TypeSystemDescription_impl(), null, null);
      JCas newJCas = newCas.getJCas();
      CAS view = newCas.createView("DetaggedView");
      view.getJCas();

      Annotation annot = new Annotation(newJCas);
View Full Code Here

    fixedFlowController = new FixedFlowController();
    fixedFlowController.initialize(fcContext);   
  }

  public void testComputeFlow() throws Exception {
    CAS cas1 = CasCreationUtils.createCas(new TypeSystemDescription_impl(), null, null);
    CAS cas2 = CasCreationUtils.createCas(new TypeSystemDescription_impl(), null, null);
    Flow flow1 = fixedFlowController.computeFlow(cas1);
    Flow flow2 = fixedFlowController.computeFlow(cas2);
    //two steps in flow 1
    Step step = flow1.next();
    assertTrue(step instanceof SimpleStep);
View Full Code Here

    step = flow2.next();
    assertTrue(step instanceof FinalStep);
  }
 
  public void testAddAnalysisEngines() throws Exception {
    CAS cas = CasCreationUtils.createCas(new TypeSystemDescription_impl(), null, null);
    Flow flow = fixedFlowController.computeFlow(cas);
    //two steps in flow
    Step step = flow.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key1", ((SimpleStep)step).getAnalysisEngineKey());
View Full Code Here

    step = flow.next();
    assertTrue(step instanceof FinalStep);
  }
 
  public void testRemoveAnalysisEngines() throws Exception {
    CAS cas = CasCreationUtils.createCas(new TypeSystemDescription_impl(), null, null);
    Flow flow = fixedFlowController.computeFlow(cas);
    //one step in flow
    Step step = flow.next();
    assertTrue(step instanceof SimpleStep);
    assertEquals("key1", ((SimpleStep)step).getAnalysisEngineKey());
View Full Code Here

      mSimpleDesc.setFrameworkImplementation(Constants.JAVA_FRAMEWORK_NAME);
      mSimpleDesc.setPrimitive(true);
      mSimpleDesc
              .setAnnotatorImplementationName("org.apache.uima.analysis_engine.impl.TestAnnotator");
      mSimpleDesc.getMetaData().setName("Simple Test");
      TypeSystemDescription typeSys = new TypeSystemDescription_impl();
      typeSys.addType("foo.Bar", "test", "uima.tcas.Annotation");
      typeSys.addType("NamedEntity", "test", "uima.tcas.Annotation");
      typeSys.addType("DocumentStructure", "test", "uima.tcas.Annotation");
      mSimpleDesc.getAnalysisEngineMetaData().setTypeSystem(typeSys);
      Capability cap = new Capability_impl();
      cap.addOutputType("NamedEntity", true);
      cap.addOutputType("DocumentStructure", true);
      Capability[] caps = new Capability[] {cap};
View Full Code Here

TOP

Related Classes of org.apache.uima.resource.metadata.impl.TypeSystemDescription_impl

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.