Package org.apache.uima.resource.metadata

Examples of org.apache.uima.resource.metadata.TypeDescription


      for (FeatureDescription fd : typeDescription.getFeatures()) {
        typeFeatures.add(fd.getName());
      }
      String supertypeName = typeDescription.getSupertypeName();
      if (supertypeName != null) {
        TypeDescription superTypeDesc = tsd.getType(supertypeName);
        if (superTypeDesc != null) {
          for (FeatureDescription fd : superTypeDesc.getFeatures()) {
            typeFeatures.add(fd.getName());
          }
        }
      }
      String name = typeDescription.getName();
View Full Code Here


    if (complexTypes != null) {
      Set<Entry<String, String>> entrySet = complexTypes.entrySet();
      for (Entry<String, String> entry : entrySet) {
        String name = entry.getKey();
        TypeDescription addType = basicTypeSystem.addType(name, "Type for Testing",
                entry.getValue());
        if (features != null) {
          List<TestFeature> list = features.get(name);
          for (TestFeature f : list) {
            addType.addFeature(f.name, f.description, f.range);
          }
        }
      }
    }
View Full Code Here

      list.add(eachSlot + TextRulerToolkit.LEFT_BOUNDARY_EXTENSION);
      list.add(eachSlot + TextRulerToolkit.RIGHT_BOUNDARY_EXTENSION);
    }
    TypeSystemDescription typeSystem = description.getAnalysisEngineMetaData().getTypeSystem();
    for (String string : list) {
      TypeDescription type = typeSystem.getType(string);
      if (type == null) {
        typeSystem.addType(string, "", "uima.tcas.Annotation");
      }
    }
  }
View Full Code Here

      return result;
    }
    result.addAll(Arrays.asList(features));
    String supertypeName = typeDescription.getSupertypeName();
    if (supertypeName != null) {
      TypeDescription parent = typeMap.get(supertypeName);
      result.addAll(getAllDeclaredFeatures(parent, typeMap));
    }
    return result;
  }
View Full Code Here

      return null;
    }
  }

  private String checkFSFeatureOfType(String featureName, String longTypeName) {
    TypeDescription t = typeDescriptionMap.get(longTypeName);
    if (t == null) {
      return null;
    }
    FeatureDescription[] features = t.getFeatures();
    for (FeatureDescription featureDescription : features) {
      String name = featureDescription.getName();
      String rangeTypeName = featureDescription.getRangeTypeName();
      boolean isFS = isFeatureStructure(rangeTypeName);
      if (name.equals(featureName) && isFS) {
View Full Code Here

  private boolean isFeatureStructure(String rangeTypeName) {
    if (rangeTypeName.equals("uima.tcas.Annotation") || rangeTypeName.equals("uima.cas.TOP")) {
      return true;
    }
    TypeDescription type = typeDescriptionMap.get(rangeTypeName);
    if (type == null) {
      return false;
    }
    String supertypeName = type.getSupertypeName();
    if (supertypeName != null) {
      return isFeatureStructure(supertypeName);
    }
    return false;
  }
View Full Code Here

      typeTriple = resolveType(typeTriple, typeNameMap, mainScript);
      if (typeSystemDescription.getType(typeTriple.getName()) != null) {
        continue;
      }
      if (!finalTypes.contains(typeTriple.getParent())) {
        TypeDescription newType = typeSystemDescription.addType(typeTriple.getName(),
                typeTriple.getDescription(), typeTriple.getParent());
        capability.addInputType(typeTriple.getName(), false);
        capability.addOutputType(typeTriple.getName(), false);
        Collection<StringTriple> collection = desc.getFeatures().get(eachType);
        if (collection != null) {
          for (StringTriple eachFeature : collection) {
            eachFeature = resolveFeature(eachFeature, typeNameMap);
            newType.addFeature(eachFeature.getName(), eachFeature.getDescription(),
                    eachFeature.getParent());
            // capability.addInputFeature(eachFeature.getName());
            // capability.addOutputFeature(eachFeature.getName());
          }
        }
View Full Code Here

    if (complexTypes != null) {
      Set<Entry<String, String>> entrySet = complexTypes.entrySet();
      for (Entry<String, String> entry : entrySet) {
        String name = entry.getKey();
        TypeDescription addType = basicTypeSystem.addType(name, "Type for Testing",
                entry.getValue());
        if (features != null) {
          List<TestFeature> list = features.get(name);
          for (TestFeature f : list) {
            addType.addFeature(f.name, f.description, f.range);
          }
        }
      }
    }
View Full Code Here

    }
    if (complexTypes != null) {
      Set<Entry<String, String>> entrySet = complexTypes.entrySet();
      for (Entry<String, String> entry : entrySet) {
        String name = entry.getKey();
        TypeDescription addType = basicTypeSystem.addType(name, "Type for Testing",
                entry.getValue());
        if (features != null) {
          List<TestFeature> list = features.get(name);
          for (TestFeature f : list) {
            addType.addFeature(f.name, f.description, f.range);
          }
        }
      }
    }
    Collection<TypeSystemDescription> tsds = new ArrayList<TypeSystemDescription>();
View Full Code Here

              UIMAFramework.newDefaultResourceManager(), mergedTypes);

      // test results of merge
      Assert.assertEquals(8, typeSys.getTypes().length);

      TypeDescription type0 = typeSys.getType("NamedEntity");
      Assert.assertNotNull(type0);
      Assert.assertEquals("uima.tcas.Annotation", type0.getSupertypeName());
      Assert.assertEquals(1, type0.getFeatures().length);

      TypeDescription type1 = typeSys.getType("Person");
      Assert.assertNotNull(type1);
      Assert.assertEquals("NamedEntity", type1.getSupertypeName());
      Assert.assertEquals(1, type1.getFeatures().length);

      TypeDescription type2 = typeSys.getType("Place");
      Assert.assertNotNull(type2);
      Assert.assertEquals("NamedEntity", type2.getSupertypeName());
      Assert.assertEquals(3, type2.getFeatures().length);

      TypeDescription type3 = typeSys.getType("Org");
      Assert.assertNotNull(type3);
      Assert.assertEquals("uima.tcas.Annotation", type3.getSupertypeName());
      Assert.assertEquals(0, type3.getFeatures().length);

      TypeDescription type4 = typeSys.getType("DocumentStructure");
      Assert.assertNotNull(type4);
      Assert.assertEquals("uima.tcas.Annotation", type4.getSupertypeName());
      Assert.assertEquals(0, type4.getFeatures().length);

      TypeDescription type5 = typeSys.getType("Paragraph");
      Assert.assertNotNull(type5);
      Assert.assertEquals("DocumentStructure", type5.getSupertypeName());
      Assert.assertEquals(0, type5.getFeatures().length);

      TypeDescription type6 = typeSys.getType("Sentence");
      Assert.assertNotNull(type6);
      Assert.assertEquals("DocumentStructure", type6.getSupertypeName());
      Assert.assertEquals(0, type6.getFeatures().length);

      TypeDescription type7 = typeSys.getType("test.flowController.Test");
      Assert.assertNotNull(type7);
      Assert.assertEquals("uima.tcas.Annotation", type7.getSupertypeName());
      Assert.assertEquals(1, type7.getFeatures().length);

      // Place has merged features, Person has different supertype
      assertEquals(2, mergedTypes.size());
      assertTrue(mergedTypes.containsKey("Place"));
      assertTrue(mergedTypes.containsKey("Person"));
View Full Code Here

TOP

Related Classes of org.apache.uima.resource.metadata.TypeDescription

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.