Note that there are some explanatory texts on larger screens.

plurals
  1. POCopy the current UIMA CAS object
    primarykey
    data
    text
    <p>I'm working on a project which uses <a href="https://uima.apache.org/" rel="nofollow">Apache UIMA</a> framework to annotate documents. Since I have to pass all the documents once and process them in one for-lopp, so I have to temporarily store (copy) the current CAS object for the current document so as to avoid being messed up by following FSs and heap values.</p> <p>So as is followed, I used CasCopier to firstly copy the current CAS and display that before processing the next document.</p> <pre><code> 1. public class DocumentAnalysis { 2. public DocumentAnalysis(CAS cas) { 3. this.cas = cas; 4. } 5. 6. public processDocuments(Document documents) { 7. for(Document document: documents) { 8. // process each document, after this method, the cas has all values 9. processSingleDoc(document); 10. 11. // create a new CAS as the destination of copy 12. CAS localCas = CASFactory.createCas().getCas(); 13. 14. // copy the current CAS to the new CAS 15. CASCopier.copyCas(this.cas, localCas, true); 16. } 17. } 18. 19. public processSingleDoc(Document document) { 20. // the logic for processing 21. // implement UIMA process() method 22. ...... 23. } 24. 25. CAS cas; 26. } </code></pre> <p>However, the problem is that it threw a NullPointerException at line 12 and I figured that the getCAS() method requires the indexRepository variable and the localCas I created doesn't have that value, which means that the creation of new CAS might be incorrect. </p> <p>I've searched online and haven't found out any solutions yet. So does anyone know how I can copy the current CAS to a newly created CAS?</p> <p>Thanks in advance!!! </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload