ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seanfi...@apache.org
Subject svn commit: r1855866 - /ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cc/jdbc/table/AbstractUmlsTable.java
Date Tue, 19 Mar 2019 20:31:03 GMT
Author: seanfinan
Date: Tue Mar 19 20:31:03 2019
New Revision: 1855866

URL: http://svn.apache.org/viewvc?rev=1855866&view=rev
Log:
Temporary debug logging

Modified:
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cc/jdbc/table/AbstractUmlsTable.java

Modified: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cc/jdbc/table/AbstractUmlsTable.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cc/jdbc/table/AbstractUmlsTable.java?rev=1855866&r1=1855865&r2=1855866&view=diff
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cc/jdbc/table/AbstractUmlsTable.java
(original)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cc/jdbc/table/AbstractUmlsTable.java
Tue Mar 19 20:31:03 2019
@@ -5,12 +5,15 @@ import org.apache.ctakes.core.cc.jdbc.ro
 import org.apache.ctakes.core.util.OntologyConceptUtil;
 import org.apache.ctakes.typesystem.type.refsem.UmlsConcept;
 import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
+import org.apache.log4j.Logger;
 import org.apache.uima.fit.util.JCasUtil;
 import org.apache.uima.jcas.JCas;
 
 import java.sql.CallableStatement;
 import java.sql.Connection;
 import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 
 /**
@@ -72,9 +75,12 @@ abstract public class AbstractUmlsTable<
       row.initializeDocument( value );
       boolean batchWritten = false;
       final Collection<IdentifiedAnnotation> annotations = JCasUtil.select( value,
IdentifiedAnnotation.class );
+      Logger.getLogger( "AbstractUmlsTable" ).info( annotations.size() + " annotations to
be written" );
       for ( IdentifiedAnnotation annotation : annotations ) {
          row.initializeEntity( annotation );
          final Collection<UmlsConcept> umlsConcepts = OntologyConceptUtil.getUmlsConcepts(
annotation );
+         Logger.getLogger( "AbstractUmlsTable" )
+               .info( "   " + annotation.getCoveredText() + " " + umlsConcepts.size() + "
concepts" );
          for ( UmlsConcept concept : umlsConcepts ) {
             row.addToStatement( statement, concept );
             batchWritten = incrementBatchIndex();
@@ -82,7 +88,10 @@ abstract public class AbstractUmlsTable<
       }
       if ( !batchWritten ) {
          // The current batch has not been written to db.  Do so now.
-         getCallableStatement().executeBatch();
+         final int[] updateToLog = getCallableStatement().executeBatch();
+         final Collection<String> u2l = new ArrayList<>();
+         Arrays.stream( updateToLog ).forEach( i -> u2l.add( i + "" ) );
+         Logger.getLogger( "AbstractUmlsTable" ).info( String.join( ",", u2l ) );
       }
    }
 



Mime
View raw message