ctakes-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tomasz Oliwa <ol...@uchicago.edu>
Subject Delete an OntologyConcept from a JCas using an Annotator
Date Thu, 07 Apr 2016 22:15:48 GMT
How can I delete an OntologyConcept from a JCas using an Annotator? 

As an example, the following process method from an Annotator loops over all IdentifiedAnnotations,
and is supposed to simply remove all OntologyConcepts. However, it does not remove anything
from the CAS. I can still see all OntologyConcepts in the CAS Visual Debugger after running

    public void process(JCas aJCas) throws AnalysisEngineProcessException {
        JFSIndexRepository indexes = aJCas.getJFSIndexRepository();
        Iterator neItr = indexes.getAnnotationIndex(IdentifiedAnnotation.type).iterator();
        while (neItr.hasNext()) {
            IdentifiedAnnotation neAnnot = (IdentifiedAnnotation) neItr.next();
            FSArray ocArr = neAnnot.getOntologyConceptArr();
            if (ocArr != null) {
                for (int i = 0; i < ocArr.size(); i++) {
                    OntologyConcept oc = (OntologyConcept) ocArr.get(i);

If I change the code above to do neAnnot.removeFromIndexes(aJCas); to remove the whole IdentifiedAnnotation,
this works and the annotation is removed and not displayed in the CAS Visual Debugger. 

But how can I remove OntologyConcepts? 

Am I missing an API call? Does the API have a problem here?

View raw message