Examples of XMLInputSource


Examples of org.apache.uima.util.XMLInputSource

      serCasStream.close();

      // now read in a TypeSystem that's a subset of those types
      TypeSystemDescription partialTypeSystemDesc = UIMAFramework.getXMLParser()
              .parseTypeSystemDescription(
                      new XMLInputSource(JUnitExtension
                              .getFile("ExampleCas/partialTestTypeSystem.xml")));
      TypeSystem partialTypeSystem = CasCreationUtils.createCas(partialTypeSystemDesc, null, null)
              .getTypeSystem();

      // reserialize as XMI, filtering out anything that doesn't fit in the
View Full Code Here

Examples of org.apache.uima.util.XMLInputSource

   
    //Test a partial type system with a missing some missing features and
    //missing "Organization" type
    File partialTypeSystemFile = JUnitExtension.getFile("ExampleCas/partialTestTypeSystem.xml");
    TypeSystemDescription partialTypeSystem = UIMAFramework.getXMLParser().parseTypeSystemDescription(
            new XMLInputSource(partialTypeSystemFile));
    CAS partialTsCas = CasCreationUtils.createCas(partialTypeSystem, null, indexes);
    XmiSerializationSharedData sharedData2 = new XmiSerializationSharedData();
    deserialize(xmiStr, partialTsCas, sharedData2, true, -1);
   
    assertEquals(1,sharedData2.getOutOfTypeSystemElements().size());
View Full Code Here

Examples of org.apache.uima.util.XMLInputSource

    String xmiStr = serialize(cas, null);
   
    //deserialize into a CAS that's missing the Organization type
    File partialTypeSystemFile = JUnitExtension.getFile("ExampleCas/partialTestTypeSystem.xml");
    TypeSystemDescription partialTypeSystem = UIMAFramework.getXMLParser().parseTypeSystemDescription(
            new XMLInputSource(partialTypeSystemFile));
    testAnnotTypeDesc = partialTypeSystem.addType("org.apache.uima.testTypeSystem.TestAnnotation", "", "uima.tcas.Annotation");
    testAnnotTypeDesc.addFeature("arrayFeat", "", "uima.cas.FSArray");
    CAS partialTsCas = CasCreationUtils.createCas(partialTypeSystem, null, null);
    XmiSerializationSharedData sharedData = new XmiSerializationSharedData();
    deserialize(xmiStr, partialTsCas, sharedData, true, -1);
View Full Code Here

Examples of org.apache.uima.util.XMLInputSource

    System.out.println(xmiStr);
   
    //deserialize into a CAS that's missing the Organization type
    File partialTypeSystemFile = JUnitExtension.getFile("ExampleCas/partialTestTypeSystem.xml");
    TypeSystemDescription partialTypeSystem = UIMAFramework.getXMLParser().parseTypeSystemDescription(
            new XMLInputSource(partialTypeSystemFile));
    testAnnotTypeDesc = partialTypeSystem.addType("org.apache.uima.testTypeSystem.TestAnnotation", "", "uima.tcas.Annotation");
    testAnnotTypeDesc.addFeature("listFeat", "", "uima.cas.FSList");
    CAS partialTsCas = CasCreationUtils.createCas(partialTypeSystem, null, null);
    XmiSerializationSharedData sharedData = new XmiSerializationSharedData();
    deserialize(xmiStr, partialTsCas, sharedData, true, -1);
View Full Code Here

Examples of org.apache.uima.util.XMLInputSource

   
    //Test a partial type system with a missing some missing features and
    //missing "Organization" type
    File partialTypeSystemFile = JUnitExtension.getFile("ExampleCas/partialTestTypeSystem.xml");
    TypeSystemDescription partialTypeSystem = UIMAFramework.getXMLParser().parseTypeSystemDescription(
            new XMLInputSource(partialTypeSystemFile));
    CAS partialTsCas = CasCreationUtils.createCas(partialTypeSystem, null, indexes);
    XmiSerializationSharedData sharedData2 = new XmiSerializationSharedData();
    deserialize(xmiStr, partialTsCas, sharedData2, true, -1);
       
    String xmiStr3 = serialize(partialTsCas, sharedData2);
View Full Code Here

Examples of org.apache.uima.util.XMLInputSource

   */
  private void setup() throws Exception {
    try {
      this.ae = null;
      // Create an XML input source from the specifier file.
      XMLInputSource in = new XMLInputSource(this.descFile);
      // Parse the specifier.
      ResourceSpecifier specifier = UIMAFramework.getXMLParser().parseResourceSpecifier(in);
      // Create the Text Analysis Engine.
      this.ae = UIMAFramework.produceAnalysisEngine(specifier, this.mgr, null);
    } catch (Exception ex) {
View Full Code Here

Examples of org.apache.uima.util.XMLInputSource

  public void changeDelegateParameterSetting(String delegeteKey, String groupName,
          String paramName, Object paramValue) throws InvalidXMLException,
          ResourceInitializationException, IOException {
    // create CasConsumer description
    AnalysisEngineDescription aeSpecifier = UIMAFramework.getXMLParser()
            .parseAnalysisEngineDescription(new XMLInputSource(this.descFile));

    // get delegates
    Map delegates = aeSpecifier.getDelegateAnalysisEngineSpecifiers();

    // check if delegeteKey is available
View Full Code Here

Examples of org.apache.uima.util.XMLInputSource

   */
  public static AnalysisEngine doConfigurationTest(String configDescFilePath) throws Exception {
    try {
      AnalysisEngine ae = null;
      // Create an XML input source from the specifier file.
      XMLInputSource in = new XMLInputSource(configDescFilePath);
      // Parse the specifier.
      ResourceSpecifier specifier = UIMAFramework.getXMLParser().parseResourceSpecifier(in);
      // Create the Text Analysis Engine.
      ae = UIMAFramework.produceAnalysisEngine(specifier, null, null);

View Full Code Here

Examples of org.apache.uima.util.XMLInputSource

  public static CAS performTest(String descFilePath, String text, String language)
          throws Exception {
    try {
      AnalysisEngine ae = null;
      // Create an XML input source from the specifier file.
      XMLInputSource in = new XMLInputSource(descFilePath);
      // Parse the specifier.
      ResourceSpecifier specifier = UIMAFramework.getXMLParser().parseResourceSpecifier(in);
      // Create the Text Analysis Engine.
      ae = UIMAFramework.produceAnalysisEngine(specifier, null, null);
View Full Code Here

Examples of org.apache.uima.util.XMLInputSource

   * @return CAS - CAS object created from the given input data
   * @throws Exception
   */
  public static CAS getCASfromXCAS(File tsFile, File xcasFile) throws Exception{
    try {
      Object tsDescriptor = UIMAFramework.getXMLParser().parse(new XMLInputSource(tsFile));
      TypeSystemDescription tsDesc = (TypeSystemDescription) tsDescriptor;
      CAS cas = CasCreationUtils.createCas(tsDesc, null, new FsIndexDescription[0]);

      SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
      XCASDeserializer xcasDeserializer = new XCASDeserializer(cas.getTypeSystem());
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.