Package org.apache.uima.cas.impl

Examples of org.apache.uima.cas.impl.CASSerializer


        System.out.println("Annotation took: " + annotationTime + "ms");
      }

      // serialize CAS
      AFrame responseFrame = new AFrame();
      CASSerializer responseSerializer = Serialization.serializeCAS(cas);
      byte[] responseCasBytes = SerializationUtils.serialize(responseSerializer);
      responseFrame.fsetTrueBinary("BinaryCAS", responseCasBytes);
      // also add annotation time
      responseFrame.fset(Constants.ANNOTATION_TIME, annotationTime);
View Full Code Here


      // Set the document text
      // gs.setLocalSofaData("das bier ist gut");
      gerJcas.setDocumentText("das bier ist gut");

      // Test multiple Sofas across binary serialization
      CASSerializer cs = Serialization.serializeNoMetaData(cas);
      cas = Serialization.createCAS(casMgr, cs);

      // Add a new Sofa
      // id.setSofaID("FrenchDocument");
      // Sofa fs = new Sofa(jcas, id, "text");
View Full Code Here

    try {
      resetJNI();

      if (!casIsEmpty) {
        CASSerializer casSerializerIn = Serialization.serializeCAS(cas);
        /**
         * fillCASJNI(casSerializerIn.heapArray, casSerializerIn.fsIndex,
         * casSerializerIn.stringTable);
         */

 
View Full Code Here

    try {
      hasNext = hasNextSegmentJNI();
      // get the CAS data of the original input CAS.
      if (!hasNext) {
        CASSerializer casSerializerOut = new CASSerializer();
        // per document data
        serializeCASJNI(true);
        casSerializerOut.heapMetaData = null;
        casSerializerOut.heapArray = (int[]) getSerializedDataJNI(FSHEAP);
        casSerializerOut.fsIndex = (int[]) getSerializedDataJNI(INDEXEDFSS);
View Full Code Here

      // get the CAS data of CAS produce by segmenter component.
      if (hasNext) {

        nextSegmentJNI();
        CASSerializer casSerializerOut = new CASSerializer();
        // per document data
        serializeSegmentJNI(true);
        casSerializerOut.heapMetaData = null;
        casSerializerOut.heapArray = (int[]) getSerializedSegmentDataJNI(FSHEAP);
        casSerializerOut.fsIndex = (int[]) getSerializedSegmentDataJNI(INDEXEDFSS);
View Full Code Here

      // Set the document text
      // gs.setLocalSofaData("das bier ist gut");
      gerTcas.setDocumentText("das bier ist gut");

      // Test multiple Sofas across binary serialization
      CASSerializer cs = Serialization.serializeNoMetaData(cas);
      cas = Serialization.createCAS(casMgr, cs);

      // Add a new Sofa
      // SofaID_impl fid = new SofaID_impl();
      // fid.setSofaID("FrenchDocument");
View Full Code Here

    try {
      resetJNI();

      if (!casIsEmpty) {
        CASSerializer casSerializerIn = Serialization.serializeCAS(cas);
        /**
         * fillCASJNI(casSerializerIn.heapArray, casSerializerIn.fsIndex,
         * casSerializerIn.stringTable);
         */

 
View Full Code Here

    try {
      hasNext = hasNextSegmentJNI();
      // get the CAS data of the original input CAS.
      if (!hasNext) {
        CASSerializer casSerializerOut = new CASSerializer();
        // per document data
        serializeCASJNI(true);
        casSerializerOut.heapMetaData = null;
        casSerializerOut.heapArray = (int[]) getSerializedDataJNI(FSHEAP);
        casSerializerOut.fsIndex = (int[]) getSerializedDataJNI(INDEXEDFSS);
View Full Code Here

      // get the CAS data of CAS produce by segmenter component.
      if (hasNext) {

        nextSegmentJNI();
        CASSerializer casSerializerOut = new CASSerializer();
        // per document data
        serializeSegmentJNI(true);
        casSerializerOut.heapMetaData = null;
        casSerializerOut.heapArray = (int[]) getSerializedSegmentDataJNI(FSHEAP);
        casSerializerOut.fsIndex = (int[]) getSerializedSegmentDataJNI(INDEXEDFSS);
View Full Code Here

      casImpl.reset();

      // 1. deserialize CAS

      CASSerializer serializer = new CASSerializer();
      // set serialization data
      serializer.heapArray = heapArray;
      serializer.fsIndex = fsIndex;
      serializer.stringTable = stringTable;

      serializer.byteHeapArray = aByteHeapArray;
      serializer.shortHeapArray = aShortHeapArray;
      serializer.longHeapArray = aLongHeapArray;

      casImpl.reinit(serializer);

      // 2. create result spec
      if (ae != null) {

        ResultSpecification rs = ae.createResultSpecification(casImpl.getTypeSystem());
        for (int i = 0; i < resultSpecTypes.length; ++i) {
          // allAnnotatorFeatures is not considere here! (TODO)
          rs
                  .addResultType(casImpl.getTypeSystemImpl().ll_getTypeForCode(resultSpecTypes[i]).getName(),
                          false);
        }
        for (int i = 0; i < resultSpecFeatures.length; ++i) {
          rs.addResultFeature(casImpl.getTypeSystemImpl().ll_getFeatureForCode(resultSpecFeatures[i])
                  .getName());
        }
        // 3. call process with cas
        ae.process(casImpl, rs);

      } else if (cc != null) {
        // 3. call process with tcas or cas
        if (requiresTCas && sofaNum == 0) {
          result = 1;
          exceptionString = "This CasConsumer expects a View, but the Sofa from which to construct one is not specified.";
        } else if (sofaNum > 0) {
          CAS view = casImpl.getView(sofaNum);
          cc.processCas(view);
        } else {
          cc.processCas(casImpl);
        }
      }
      // 4. deserialize CAS again
      CASSerializer deSerializer = Serialization.serializeCAS(casImpl);

      saveSerializedCAS(deSerializer);

    } catch (Exception exc) {
      result = 1;
View Full Code Here

TOP

Related Classes of org.apache.uima.cas.impl.CASSerializer

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.