Examples of CasData


Examples of org.apache.uima.cas_data.CasData

              + CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
                      "UIMA_CPM_EXP_no_proxy__WARNING", new Object[] { Thread.currentThread()
                              .getName() })));
    }

    CasData casWithAnalysis = null;
    ProcessTrace pt = new ProcessTrace_impl();
    // Send the content for analysis to the remote service via the proxy
    try {
      long pStart = System.currentTimeMillis();
      casWithAnalysis = textAnalysisProxy.analyze(aCas, pt, name);
View Full Code Here

Examples of org.apache.uima.cas_data.CasData

   *
   * @return CasData object containing all information from the CAS
   */
  public CasData casContainerToCasData(CAS aContainer) {
    // generate XCAS events and pipe them to XCasToCasDataSaxHandler
    CasData result = new CasDataImpl();
    XCasToCasDataSaxHandler handler = new XCasToCasDataSaxHandler(result);
    XCASSerializer xcasSer = new XCASSerializer(aContainer.getTypeSystem());
    xcasSer.setDocumentTypeName(this.getDocumentTextTypeName());
    xcasSer.setDocumentTextFeature(this.getDocumentTextFeatureName());
    try {
View Full Code Here

Examples of org.apache.uima.cas_data.CasData

              + CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
                      "UIMA_CPM_EXP_no_proxy__WARNING", new Object[] { Thread.currentThread()
                              .getName() })));
    }

    CasData casWithAnalysis = null;
    ProcessTrace pt = new ProcessTrace_impl();
    // Send the content for analysis to the remote service via the proxy
    try {
      long pStart = System.currentTimeMillis();
      casWithAnalysis = textAnalysisProxy.analyze(aCas, pt, name);
View Full Code Here

Examples of org.apache.uima.cas_data.CasData

    super(arg0);
  }

  public void testParse() throws Exception {
    try {
      CasData casData = new CasDataImpl();
      XCasToCasDataSaxHandler handler = new XCasToCasDataSaxHandler(casData);

      SAXParserFactory fact = SAXParserFactory.newInstance();
      SAXParser parser = fact.newSAXParser();
      XMLReader xmlReader = parser.getXMLReader();
      xmlReader.setContentHandler(handler);
      xmlReader.parse(new InputSource(getClass().getResourceAsStream("xcastest.xml")));

      // System.out.println(casData);
      Iterator fsIter = casData.getFeatureStructures();
      boolean foundCrawlUrl = false;
      while (fsIter.hasNext()) {
        FeatureStructure fs = (FeatureStructure) fsIter.next();
        if ("Crawl_colon_URL".equals(fs.getType())) {
          // System.out.println("[" + fs.getFeatureValue("value") + "]");
View Full Code Here

Examples of org.apache.uima.cas_data.CasData

  private void _testConversions(CAS aCAS) throws CASException, IOException,
          ParserConfigurationException, SAXException, ResourceInitializationException,
          CASRuntimeException {
    // generate XCAS events and pipe them to XCasToCasDataSaxHandler
    CasData casData = new CasDataImpl();
    XCasToCasDataSaxHandler handler = new XCasToCasDataSaxHandler(casData);
    XCASSerializer xcasSer = new XCASSerializer(aCAS.getTypeSystem());
    xcasSer.serialize(aCAS, handler);

    Assert.assertNotNull(casData);
View Full Code Here

Examples of org.apache.uima.cas_data.CasData

  /*
   * Test for void generateXCas(CasData)
   */
  public void testGenerateXCasCasData() throws Exception {
    try {
      CasData casData = new CasDataImpl();
      FeatureStructure testFS = new FeatureStructureImpl();
      testFS.setType("Test");
      testFS.setId("foo");
      testFS.setIndexed(new int[] { 1 });
      testFS.setFeatureValue("myFeature", new PrimitiveValueImpl("myValue"));
      testFS.setFeatureValue("value", new PrimitiveValueImpl("this should show up in XML content"));
      casData.addFeatureStructure(testFS);

      CasDataToXCas generator = new CasDataToXCas();
      TestContentHandler testContentHandler = new TestContentHandler("Test");
      generator.setContentHandler(testContentHandler);
      generator.generateXCas(casData);
      Assert.assertTrue(testContentHandler.foundTestElement);

      // also try colon and dash conversions
      casData = new CasDataImpl();
      testFS = new FeatureStructureImpl();
      testFS.setType("Test_colon_Foo_dash_Bar_colon_What_dash_a_dash_mess");
      testFS.setId("foo");
      testFS.setIndexed(new int[] { 1 });
      testFS.setFeatureValue("myFeature", new PrimitiveValueImpl("myValue"));
      testFS.setFeatureValue("value", new PrimitiveValueImpl("this should show up in XML content"));
      casData.addFeatureStructure(testFS);

      testContentHandler = new TestContentHandler("Test:Foo-Bar:What-a-mess");
      generator.setContentHandler(testContentHandler);
      generator.generateXCas(casData);
      Assert.assertTrue(testContentHandler.foundTestElement);
View Full Code Here

Examples of org.apache.uima.cas_data.CasData

    super(arg0);
  }

  public void testParse() throws Exception {
    try {
      CasData casData = new CasDataImpl();
      XCasToCasDataSaxHandler handler = new XCasToCasDataSaxHandler(casData);

      SAXParserFactory fact = SAXParserFactory.newInstance();
      SAXParser parser = fact.newSAXParser();
      XMLReader xmlReader = parser.getXMLReader();
      xmlReader.setContentHandler(handler);
      xmlReader.parse(new InputSource(getClass().getResourceAsStream("xcastest.xml")));

      // System.out.println(casData);
      Iterator<FeatureStructure> fsIter = casData.getFeatureStructures();
      boolean foundCrawlUrl = false;
      while (fsIter.hasNext()) {
        FeatureStructure fs = fsIter.next();
        if ("Crawl_colon_URL".equals(fs.getType())) {
          // System.out.println("[" + fs.getFeatureValue("value") + "]");
View Full Code Here

Examples of org.apache.uima.cas_data.CasData

  private void _testConversions(CAS aCAS) throws IOException,
          ParserConfigurationException, SAXException, ResourceInitializationException,
          CASRuntimeException {
    // generate XCAS events and pipe them to XCasToCasDataSaxHandler
    CasData casData = new CasDataImpl();
    XCasToCasDataSaxHandler handler = new XCasToCasDataSaxHandler(casData);
    XCASSerializer xcasSer = new XCASSerializer(aCAS.getTypeSystem());
    xcasSer.serialize(aCAS, handler);

    Assert.assertNotNull(casData);
View Full Code Here

Examples of org.apache.uima.cas_data.CasData

    super(arg0);
  }

  public void testParse() throws Exception {
    try {
      CasData casData = new CasDataImpl();
      XCasToCasDataSaxHandler handler = new XCasToCasDataSaxHandler(casData);

      SAXParserFactory fact = SAXParserFactory.newInstance();
      SAXParser parser = fact.newSAXParser();
      XMLReader xmlReader = parser.getXMLReader();
      xmlReader.setContentHandler(handler);
      xmlReader.parse(new InputSource(getClass().getResourceAsStream("xcastest.xml")));

      // System.out.println(casData);
      Iterator fsIter = casData.getFeatureStructures();
      boolean foundCrawlUrl = false;
      while (fsIter.hasNext()) {
        FeatureStructure fs = (FeatureStructure) fsIter.next();
        if ("Crawl_colon_URL".equals(fs.getType())) {
          // System.out.println("[" + fs.getFeatureValue("value") + "]");
View Full Code Here

Examples of org.apache.uima.cas_data.CasData

  private void _testConversions(CAS aCAS) throws IOException,
          ParserConfigurationException, SAXException, ResourceInitializationException,
          CASRuntimeException {
    // generate XCAS events and pipe them to XCasToCasDataSaxHandler
    CasData casData = new CasDataImpl();
    XCasToCasDataSaxHandler handler = new XCasToCasDataSaxHandler(casData);
    XCASSerializer xcasSer = new XCASSerializer(aCAS.getTypeSystem());
    xcasSer.serialize(aCAS, handler);

    Assert.assertNotNull(casData);
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.