This is an automated email from the ASF dual-hosted git repository.

seanfinan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ctakes.git


The following commit(s) were added to refs/heads/main by this push:
     new a97258b  Cleared compile wanrings in bin.xml and the 4 java classes 
pom switched from user resources copy in package phase to prepare-package phase
a97258b is described below

commit a97258b01d455f7816994070cf64deb311b29acc
Author: Sean Finan <[email protected]>
AuthorDate: Fri Dec 23 13:57:54 2022 -0500

    Cleared compile wanrings in bin.xml and the 4 java classes
    pom switched from user resources copy in package phase to prepare-package 
phase
---
 .../ae/ExtractionPrepAnnotator.java                | 59 +++++-----------------
 .../runtime/BagOfAnnotationsGenerator.java         |  4 +-
 ctakes-distribution/src/main/assembly/bin.xml      |  8 +--
 .../ctakes/ytex/tools/DBAnnotationViewerMain.java  | 38 ++++++--------
 .../docanalyzer/DBAnnotationViewerDialog.java      | 24 +++------
 pom.xml                                            |  3 +-
 6 files changed, 46 insertions(+), 90 deletions(-)

diff --git 
a/ctakes-clinical-pipeline/src/main/java/org/apache/ctakes/clinicalpipeline/ae/ExtractionPrepAnnotator.java
 
b/ctakes-clinical-pipeline/src/main/java/org/apache/ctakes/clinicalpipeline/ae/ExtractionPrepAnnotator.java
index 4543474..f6dc6be 100644
--- 
a/ctakes-clinical-pipeline/src/main/java/org/apache/ctakes/clinicalpipeline/ae/ExtractionPrepAnnotator.java
+++ 
b/ctakes-clinical-pipeline/src/main/java/org/apache/ctakes/clinicalpipeline/ae/ExtractionPrepAnnotator.java
@@ -19,6 +19,8 @@
 package org.apache.ctakes.clinicalpipeline.ae;
 
 import org.apache.ctakes.core.pipeline.PipeBitInfo;
+import org.apache.ctakes.core.util.annotation.IdentifiedAnnotationUtil;
+import org.apache.ctakes.core.util.annotation.OntologyConceptUtil;
 import org.apache.ctakes.core.util.annotation.WordTokenUtil;
 import org.apache.ctakes.typesystem.type.refsem.OntologyConcept;
 import org.apache.ctakes.typesystem.type.syntax.BaseToken;
@@ -31,6 +33,7 @@ import org.apache.uima.UimaContext;
 import org.apache.uima.analysis_component.JCasAnnotator_ImplBase;
 import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
 import org.apache.uima.cas.FSIterator;
+import org.apache.uima.fit.util.JCasUtil;
 import org.apache.uima.jcas.JCas;
 import org.apache.uima.jcas.JFSIndexRepository;
 import org.apache.uima.jcas.cas.FSArray;
@@ -38,9 +41,7 @@ import org.apache.uima.jcas.cas.TOP;
 import org.apache.uima.jcas.tcas.Annotation;
 import org.apache.uima.resource.ResourceInitializationException;
 
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
+import java.util.*;
 
 /**
  * UIMA annotator that prepares the CAS for output - performs
@@ -148,50 +149,18 @@ public class ExtractionPrepAnnotator extends 
JCasAnnotator_ImplBase {
     * Assigns OID and segmentID values to NamedEntities
     */
    private void assignNamedEntityFeats( JCas jcas ) {
-      JFSIndexRepository indexes = jcas.getJFSIndexRepository();
-      // Set keySet = new HashSet();
-      // List dupList = new ArrayList();
-
-      Set segmentSet = new HashSet();
-      Iterator segmentItr = indexes.getAnnotationIndex( Segment.type 
).iterator();
-      while ( segmentItr.hasNext() ) {
-         segmentSet.add( segmentItr.next() );
-      }
-
-      // For each NE, assign segment ID and assign ontology concept OIDs if 
applicable
-      Iterator neItr = indexes.getAnnotationIndex( IdentifiedAnnotation.type 
).iterator();
-      while ( neItr.hasNext() ) {
-
-         IdentifiedAnnotation neAnnot = (IdentifiedAnnotation)neItr.next();
-
-         // assign segment ID
-         Iterator segItr = segmentSet.iterator();
-         while ( segItr.hasNext() ) {
-            Segment seg = (Segment)segItr.next();
-            // see if NE is inside this segment
-            if ( (neAnnot.getBegin() >= seg.getBegin())
-                 && (neAnnot.getEnd() <= seg.getEnd()) ) {
-               // found segment for this NE
-               neAnnot.setSegmentID( seg.getId() );
-               break;
-            }
-         }
-
-         // assign ontology concept OID values
-         FSArray ocArr = neAnnot.getOntologyConceptArr();
-         if ( ocArr != null ) {
-            for ( int i = 0; i < ocArr.size(); i++ ) {
-               OntologyConcept oc = (OntologyConcept)ocArr.get( i );
-               String code = oc.getCode();
-               String scheme = oc.getCodingScheme();
-
-               StringBuffer oid = new StringBuffer();
-               oid.append( code );
-               oid.append( "#" );
-               oid.append( scheme );
-               oc.setOid( oid.toString() );
+      final Map<Segment,Collection<IdentifiedAnnotation>> sectionAnnotationsMap
+            = JCasUtil.indexCovered( jcas, Segment.class, 
IdentifiedAnnotation.class );
+      for ( Map.Entry<Segment,Collection<IdentifiedAnnotation>> 
sectionAnnotations
+            : sectionAnnotationsMap.entrySet() ) {
+         final String segmentId = sectionAnnotations.getKey().getId();
+         for ( IdentifiedAnnotation annotation : sectionAnnotations.getValue() 
) {
+            annotation.setSegmentID( segmentId );
+            for ( OntologyConcept concept : 
OntologyConceptUtil.getOntologyConcepts( annotation ) ) {
+               concept.setOid( concept.getCode() + '#' + 
concept.getCodingScheme() );
             }
          }
       }
    }
+
 }
\ No newline at end of file
diff --git 
a/ctakes-clinical-pipeline/src/main/java/org/apache/ctakes/clinicalpipeline/runtime/BagOfAnnotationsGenerator.java
 
b/ctakes-clinical-pipeline/src/main/java/org/apache/ctakes/clinicalpipeline/runtime/BagOfAnnotationsGenerator.java
index 380b866..b47ac94 100644
--- 
a/ctakes-clinical-pipeline/src/main/java/org/apache/ctakes/clinicalpipeline/runtime/BagOfAnnotationsGenerator.java
+++ 
b/ctakes-clinical-pipeline/src/main/java/org/apache/ctakes/clinicalpipeline/runtime/BagOfAnnotationsGenerator.java
@@ -46,8 +46,8 @@ public abstract class BagOfAnnotationsGenerator<T extends 
Annotation,K> {
        private Class<T> classOfT;
        
        /**
-        * @throws IOException
-        * @throws UIMAException 
+        * @throws IOException -
+        * @throws UIMAException  -
         */
        public BagOfAnnotationsGenerator(String inputDir, String outputDir) 
throws UIMAException, IOException{
                this(inputDir, outputDir, null);
diff --git a/ctakes-distribution/src/main/assembly/bin.xml 
b/ctakes-distribution/src/main/assembly/bin.xml
index 7ff1741..49de896 100644
--- a/ctakes-distribution/src/main/assembly/bin.xml
+++ b/ctakes-distribution/src/main/assembly/bin.xml
@@ -76,18 +76,18 @@
                                
<exclude>org.apache.ctakes:ctakes-coreference-models</exclude>
                                
<exclude>org.apache.ctakes:ctakes-core-models</exclude>
                                
<exclude>org.apache.ctakes:ctakes-dependency-parser-models</exclude>
-                               
<exclude>org.apache.ctakes:ctakes-dependency-parser-models-clear</exclude>
+<!--                           
<exclude>org.apache.ctakes:ctakes-dependency-parser-models-clear</exclude>-->
                                
<exclude>org.apache.ctakes:ctakes-pos-tagger-models</exclude>
                                
<exclude>org.apache.ctakes:ctakes-relation-extractor-models</exclude>
                                
<exclude>org.apache.ctakes:ctakes-side-effect-models</exclude>
                                
<exclude>org.apache.ctakes:ctakes-smoking-status-models</exclude>
                                
<exclude>org.apache.ctakes:ctakes-temporal-models</exclude>
-                                       <!-- exclude non-asf compliant 
dependencies used by ytex -->
+                                       <!-- exclude non-asf compliant 
dependencies used by ctakes-ytex -->
                                <exclude>org.hibernate:*</exclude>
                                <exclude>nz.ac.waikato.cms.weka:*</exclude>
                                <exclude>mysql:*</exclude>
-                               <exclude>com.microsoft.sqlserver:*</exclude>
-                               <exclude>oracle.jdbc:*</exclude>
+<!--                           <exclude>com.microsoft.sqlserver:*</exclude>-->
+<!--                           <exclude>oracle.jdbc:*</exclude>-->
                  </excludes>
                        <outputDirectory>lib</outputDirectory>
                        <unpack>false</unpack>
diff --git 
a/ctakes-ytex-uima/src/main/java/org/apache/ctakes/ytex/tools/DBAnnotationViewerMain.java
 
b/ctakes-ytex-uima/src/main/java/org/apache/ctakes/ytex/tools/DBAnnotationViewerMain.java
index 5c73d5e..5d75344 100644
--- 
a/ctakes-ytex-uima/src/main/java/org/apache/ctakes/ytex/tools/DBAnnotationViewerMain.java
+++ 
b/ctakes-ytex-uima/src/main/java/org/apache/ctakes/ytex/tools/DBAnnotationViewerMain.java
@@ -420,11 +420,11 @@ public class DBAnnotationViewerMain extends JFrame {
        }
 
        /**
-        * @param tae
+        * @param tad -
         *            // *
-        * @param taeDescFileName
-        * @return
-        * @throws IOException
+        * @param descFileName -
+        * @return -
+        * @throws IOException -
         */
        private File getStyleMapFile(AnalysisEngineDescription tad,
                        String descFileName) throws IOException {
@@ -444,11 +444,11 @@ public class DBAnnotationViewerMain extends JFrame {
        }
 
        /**
-        * @param tae
+        * @param tsd -
         *            // *
-        * @param taeDescFileName
-        * @return
-        * @throws IOException
+        * @param descFileName -
+        * @return -
+        * @throws IOException -
         */
        private File getStyleMapFile(TypeSystemDescription tsd, String 
descFileName)
                        throws IOException {
@@ -717,10 +717,10 @@ public class DBAnnotationViewerMain extends JFrame {
         */
        public void getColorsForTypesFromFile(CasAnnotationViewer viewer,
                        File aStyleMapFile) {
-               List colorList = new ArrayList();
-               ArrayList typeList = new ArrayList();
-               ArrayList notCheckedList = new ArrayList();
-               ArrayList hiddenList = new ArrayList();
+               List<Color> colorList = new ArrayList<>();
+               ArrayList<String> typeList = new ArrayList<>();
+               ArrayList<String> notCheckedList = new ArrayList<>();
+               ArrayList<String> hiddenList = new ArrayList<>();
                hiddenList.add("uima.cpm.FileLocation");
 
                if (aStyleMapFile.exists()) {
@@ -732,16 +732,10 @@ public class DBAnnotationViewerMain extends JFrame {
                                DocumentBuilder db = 
DocumentBuilderFactory.newInstance()
                                                .newDocumentBuilder();
                                parse = db.parse(stream);
-                       } catch (FileNotFoundException e) {
-                               throw new UIMARuntimeException(e);
-                       } catch (ParserConfigurationException e) {
-                               throw new UIMARuntimeException(e);
-                       } catch (FactoryConfigurationError e) {
-                               throw new UIMARuntimeException(e);
-                       } catch (SAXException e) {
-                               throw new UIMARuntimeException(e);
-                       } catch (IOException e) {
-                               throw new UIMARuntimeException(e);
+                       } catch ( ParserConfigurationException
+                                       | FactoryConfigurationError
+                                       | SAXException | IOException multE ) {
+                               throw new UIMARuntimeException( multE );
                        }
                        Node node0 = parse.getDocumentElement();
                        // Node node1 = 
getFirstChildByName(parse.getDocumentElement(),
diff --git 
a/ctakes-ytex-uima/src/main/java/org/apache/ctakes/ytex/tools/docanalyzer/DBAnnotationViewerDialog.java
 
b/ctakes-ytex-uima/src/main/java/org/apache/ctakes/ytex/tools/docanalyzer/DBAnnotationViewerDialog.java
index 6025ba7..1e2848c 100644
--- 
a/ctakes-ytex-uima/src/main/java/org/apache/ctakes/ytex/tools/docanalyzer/DBAnnotationViewerDialog.java
+++ 
b/ctakes-ytex-uima/src/main/java/org/apache/ctakes/ytex/tools/docanalyzer/DBAnnotationViewerDialog.java
@@ -140,10 +140,10 @@ public class DBAnnotationViewerDialog extends JDialog 
implements ActionListener
    * 
    * @param aParentFrame
    *          frame containing this panel
-   * @param aTitle
+   * @param aDialogTitle
    *          title to display for the dialog
-   * @param aInputDir
-   *          directory containing input files (in XCAS foramt) to read
+//   * @param aInputDir
+//   *          directory containing input files (in XCAS foramt) to read
    * @param aStyleMapFile
    *          filename of style map to be used to view files in HTML
    * @param aPerformanceStats
@@ -519,10 +519,10 @@ public class DBAnnotationViewerDialog extends JDialog 
implements ActionListener
    */
 
   public void getColorsForTypesFromFile(CasAnnotationViewer viewer, File 
aStyleMapFile) {
-    List colorList = new ArrayList();
-    ArrayList typeList = new ArrayList();
-    ArrayList notCheckedList = new ArrayList();
-    ArrayList hiddenList = new ArrayList();
+    List<Color> colorList = new ArrayList<>();
+    ArrayList<String> typeList = new ArrayList<>();
+    ArrayList<String> notCheckedList = new ArrayList<>();
+    ArrayList<String> hiddenList = new ArrayList<>();
     hiddenList.add("uima.cpm.FileLocation");
 
     if (aStyleMapFile.exists()) {
@@ -533,15 +533,7 @@ public class DBAnnotationViewerDialog extends JDialog 
implements ActionListener
         stream = new FileInputStream(aStyleMapFile);
         DocumentBuilder db = 
DocumentBuilderFactory.newInstance().newDocumentBuilder();
         parse = db.parse(stream);
-      } catch (FileNotFoundException e) {
-        throw new UIMARuntimeException(e);
-      } catch (ParserConfigurationException e) {
-        throw new UIMARuntimeException(e);
-      } catch (FactoryConfigurationError e) {
-        throw new UIMARuntimeException(e);
-      } catch (SAXException e) {
-        throw new UIMARuntimeException(e);
-      } catch (IOException e) {
+      } catch ( ParserConfigurationException | FactoryConfigurationError | 
SAXException | IOException e) {
         throw new UIMARuntimeException(e);
       }
       Node node0 = parse.getDocumentElement();
diff --git a/pom.xml b/pom.xml
index 0565bb3..76d4a75 100644
--- a/pom.xml
+++ b/pom.xml
@@ -816,7 +816,8 @@
                                                        <!--    Copy resources 
that should be user-editable to ctakes-user-resources  -->
                                                        <!--    This makes 
these resources available as a jar in maven central. -->
                                                        
<id>copy-to-user-resources</id>
-                                                       <phase>package</phase>
+<!--                                                   
<phase>package</phase>-->
+                                                       
<phase>prepare-package</phase>
                                                        <goals>
                                                                
<goal>copy-resources</goal>
                                                        </goals>

Reply via email to