Package org.apache.uima.util

Examples of org.apache.uima.util.XMLParser


 
  public void testDocumentAnnotationRedefine() {
    final String tsDescriptor =
      "org/apache/uima/analysis_engine/impl/documentAnnotationRedefinitionTS.xml";
    File file = JUnitExtension.getFile(tsDescriptor);
    XMLParser parser = UIMAFramework.getXMLParser();
    boolean resourceInitExc = false;
    try {
      TypeSystemDescription tsd = (TypeSystemDescription) parser.parse(new XMLInputSource(file));
      CasCreationUtils.createCas(tsd, null, new FsIndexDescription[0]);
    } catch (InvalidXMLException e) {
      e.printStackTrace();
      assertTrue(false);
    } catch (IOException e) {
View Full Code Here


//      JCas jCas = JCasFactory.createJCasFromPath("src/main/resources/org/apache/ctakes/ytex/types/TypeSystem.xml");
      String text = "Dr. Doolitle asked patient\nto take a deep breath\nand exhale slowly.  Patient coughed.";
      AggregateBuilder builder = new AggregateBuilder();
      File directoryCtakes = new File("../ctakes-core/desc/analysis_engine");
      File fileCtakes = new File(directoryCtakes, "TokenizerAnnotator.xml");
      XMLParser parser = UIMAFramework.getXMLParser();
      XMLInputSource source = new XMLInputSource(fileCtakes);
      builder.add(parser.parseAnalysisEngineDescription(source));
      File directory = new File("desc/analysis_engine");
      File file = new File(directory, "SentenceDetectorAnnotator.xml");
      source = new XMLInputSource(file);
      builder.add(parser.parseAnalysisEngineDescription(source));
      AnalysisEngine engine = builder.createAggregate();
      JCas jCas = engine.newJCas();
      jCas.setDocumentText(text);
      Segment s = new Segment(jCas);
      s.setBegin(0);
View Full Code Here

  }

  private void addDescriptor(AggregateBuilder builder, String path)
      throws IOException, InvalidXMLException {
    File fileCtakes = new File(path);
    XMLParser parser = UIMAFramework.getXMLParser();
    XMLInputSource source = new XMLInputSource(fileCtakes);
    builder.add(parser.parseAnalysisEngineDescription(source));
  }
View Full Code Here

  static final String queryGetDocument = "select note_text from %s%s where note_id = :instance_id";

  public static void addDescriptor(AggregateBuilder builder, String path)
      throws IOException, InvalidXMLException {
    File fileCtakes = new File(path);
    XMLParser parser = UIMAFramework.getXMLParser();
    XMLInputSource source = new XMLInputSource(fileCtakes);
    builder.add(parser.parseAnalysisEngineDescription(source));
  }
View Full Code Here

      // load the text from the URI, run the preprocessor, then run the
      // Knowtator XML reader
      AggregateBuilder builder = new AggregateBuilder();
      builder.add(UriToDocumentTextAnnotator.getDescription());
      File preprocessDescFile = new File("desc/analysis_engine/RelationExtractorPreprocessor.xml");
      XMLParser parser = UIMAFramework.getXMLParser();
      XMLInputSource source = new XMLInputSource(preprocessDescFile);
      builder.add(parser.parseAnalysisEngineDescription(source));
      builder.add(AnalysisEngineFactory.createPrimitiveDescription(
          ViewCreatorAnnotator.class,
          ViewCreatorAnnotator.PARAM_VIEW_NAME,
          GOLD_VIEW_NAME));
      builder.add(AnalysisEngineFactory.createPrimitiveDescription(CopyDocumentTextToGoldView.class));
View Full Code Here

  // From CDE AbstractSection
  public static XMLizable parseDescriptor(XMLInputSource input) throws InvalidXMLException {
    // turn off environment variable expansion
    XMLParser.ParsingOptions parsingOptions = new XMLParser.ParsingOptions(false);
    XMLParser parser = UIMAFramework.getXMLParser();
    // disabled - error messages from XML validation not very helpful
    // parser.enableSchemaValidation(true);
    return parser.parse(input, "http://uima.apache.org/resourceSpecifier",
            urlForResourceSpecifierSchema, parsingOptions);
  }
View Full Code Here

      Document apple2xmlDoc = docBuilder.parse(new ByteArrayInputStream(apple2xml.getBytes()));
      Document orangeXmlDoc = docBuilder.parse(new ByteArrayInputStream(orangeXml.getBytes()));
      Document fruitBagXmlDoc = docBuilder.parse(new ByteArrayInputStream(fruitBagXml.getBytes()));

      // construct new objects from the XML
      XMLParser xmlp = UIMAFramework.getXMLParser();
      MetaDataObject_impl newApple1 = (MetaDataObject_impl) unknownFruit.clone();
      newApple1.buildFromXMLElement(apple1xmlDoc.getDocumentElement(), xmlp);
      MetaDataObject_impl newApple2 = (MetaDataObject_impl) unknownFruit.clone();
      newApple2.buildFromXMLElement(apple2xmlDoc.getDocumentElement(), xmlp);
      MetaDataObject_impl newOrange = (MetaDataObject_impl) unknownFruit.clone();
      newOrange.buildFromXMLElement(orangeXmlDoc.getDocumentElement(), xmlp);

      xmlp.addMapping("fruit", TestFruitObject.class.getName());

      MetaDataObject_impl newFruitBag = new TestFruitBagObject();
      newFruitBag.buildFromXMLElement(fruitBagXmlDoc.getDocumentElement(), xmlp);

      // new objects should be equal to the originals
View Full Code Here

  private static CAS createEmtpyCAS()
  {
      XMLInputSource xmlTypeSystemSource = new XMLInputSource(DocumentImportStructureProvider.class
            .getResourceAsStream("ts.xml"), new File(""));
      XMLParser xmlParser = UIMAFramework.getXMLParser();

      TypeSystemDescription typeSystemDesciptor;

      try {
        typeSystemDesciptor = (TypeSystemDescription) xmlParser
                .parse(xmlTypeSystemSource);
      } catch (InvalidXMLException e1) {
        throw new TaeError("Integrated ts.xml typesystem descriptor is not valid!");
      }
View Full Code Here

    // create annotation tester with the regex annotator specifier
    File descFile = JUnitExtension.getFile("wildcardFilenameSyntax/loadFilesWithWildcard.xml");
    File dpDir = descFile.getParentFile().getParentFile();
    String datapath = dpDir.getAbsolutePath();
    XMLParser parser = UIMAFramework.getXMLParser();
    AnalysisEngineDescription desc = parser.parseAnalysisEngineDescription(new XMLInputSource(
        descFile));
    ResourceManager rm = UIMAFramework.newDefaultResourceManager();
    rm.setDataPath(datapath);
    AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(desc, rm, null);
    CAS cas = ae.newCAS();
View Full Code Here

  private CAS cas;

  public FsVariableTest(String arg0) {
    super(arg0);
    try {
      XMLParser parser = UIMAFramework.getXMLParser();
      File descriptorFile = JUnitExtension.getFile("fsvars1.xml");
      AnalysisEngineDescription aeDesc = (AnalysisEngineDescription) parser
          .parse(new XMLInputSource(descriptorFile));
      this.cas = UIMAFramework.produceAnalysisEngine(aeDesc).newCAS();
      TypeSystem ts = this.cas.getTypeSystem();
      this.annotType1 = ts.getType(annotTypeName1);
      this.annotType2 = ts.getType(annotTypeName2);
View Full Code Here

TOP

Related Classes of org.apache.uima.util.XMLParser

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.