Examples of TypeSystemDescription_impl


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

 
 
 
  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

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

   
    //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

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

    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

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

    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

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

    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

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

      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

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

  public void testSetupTypeSystem() throws Exception {
    try {
      // test that duplicate feature names on supertype and subtype works
      // regardless of the order in which the types appear in the TypeSystemDescription
      TypeSystemDescription tsd1 = new TypeSystemDescription_impl();
      TypeDescription supertype = tsd1.addType("test.Super", "", "uima.cas.TOP");
      supertype.addFeature("testfeat", "", "uima.cas.Integer");
      TypeDescription subtype = tsd1.addType("test.Sub", "", "test.Super");
      subtype.addFeature("testfeat", "", "uima.cas.Integer");

      CASMgr casMgr = CASFactory.createCAS();
      CasCreationUtils.setupTypeSystem(casMgr, tsd1);
      assertNotNull(casMgr.getTypeSystemMgr().getType("test.Super")
              .getFeatureByBaseName("testfeat"));

      TypeSystemDescription tsd2 = new TypeSystemDescription_impl();
      tsd2.setTypes(new TypeDescription[] { subtype, supertype });

      casMgr = CASFactory.createCAS();
      CasCreationUtils.setupTypeSystem(casMgr, tsd2);
      assertNotNull(casMgr.getTypeSystemMgr().getType("test.Super")
              .getFeatureByBaseName("testfeat"));
View Full Code Here

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

  }

  public void testCreateCasCollection() throws Exception {
    try {
      // create two Type System description objects
      TypeSystemDescription tsd1 = new TypeSystemDescription_impl();
      TypeDescription supertype = tsd1.addType("test.Super", "", "uima.tcas.Annotation");
      supertype.addFeature("testfeat", "", "uima.cas.Integer");
      TypeDescription subtype = tsd1.addType("test.Sub", "", "test.Super");
      subtype.addFeature("testfeat", "", "uima.cas.Integer");

      TypeSystemDescription tsd2 = new TypeSystemDescription_impl();
      TypeDescription fooType = tsd1.addType("test.Foo", "", "uima.cas.TOP");
      fooType.addFeature("bar", "", "uima.cas.String");

      // create index and priorities descriptions
View Full Code Here

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

   */
  protected void setUp() throws Exception {
    try {
      super.setUp();

      TypeSystemDescription typeSystem = new TypeSystemDescription_impl();
      TypeDescription type1 = typeSystem.addType("Fake", "A Fake Type", "Annotation");
      FeatureDescription feature1 = type1.addFeature("TestFeature", "For Testing Only",
              CAS.TYPE_NAME_STRING);
      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") });

      TypePriorities typePriorities = new TypePriorities_impl();
View Full Code Here

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

    // verify copy
    CasComparer.assertEquals(srcCas, destCas);

    // try with type systems are not identical (dest. a superset of src.)
    TypeSystemDescription additionalTypes = new TypeSystemDescription_impl();
    TypeDescription fooType = additionalTypes.addType("test.Foo", "Test Type",
            "uima.tcas.Annotation");
    fooType.addFeature("bar", "Test Feature", "uima.cas.String");
    ArrayList<TypeSystemDescription> destTypeSystems = new ArrayList<TypeSystemDescription>();
    destTypeSystems.add(additionalTypes);
    destTypeSystems.add(typeSystem);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.