ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seanfi...@apache.org
Subject svn commit: r1855847 - in /ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cc/jdbc: db/JdbcDb.java table/AbstractUmlsTable.java
Date Tue, 19 Mar 2019 15:53:24 GMT
Author: seanfinan
Date: Tue Mar 19 15:53:24 2019
New Revision: 1855847

URL: http://svn.apache.org/viewvc?rev=1855847&view=rev
Log:
JdbcDb use assignableFrom to check table class for valid subclasses
AbstractUmlsTable make sure that the last statement batch is written

Modified:
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cc/jdbc/db/JdbcDb.java
    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/db/JdbcDb.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cc/jdbc/db/JdbcDb.java?rev=1855847&r1=1855846&r2=1855847&view=diff
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cc/jdbc/db/JdbcDb.java (original)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cc/jdbc/db/JdbcDb.java Tue
Mar 19 15:53:24 2019
@@ -31,7 +31,7 @@ public interface JdbcDb {
    default <T> Collection<JdbcTable<T>> getTables( final Class<T>
dataClass ) {
       final Collection<JdbcTable<T>> tables = new ArrayList<>();
       for ( JdbcTable<?> table : getTables() ) {
-         if ( table.getDataType().equals( dataClass ) ) {
+         if ( dataClass.isAssignableFrom( table.getDataType() ) ) {
             tables.add( (JdbcTable<T>)table );
          }
       }

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=1855847&r1=1855846&r2=1855847&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 15:53:24 2019
@@ -70,15 +70,20 @@ abstract public class AbstractUmlsTable<
       row.initializeCorpus( corpusInitializer );
       row.initializePatient( value );
       row.initializeDocument( value );
+      boolean batchWritten = false;
       final Collection<IdentifiedAnnotation> annotations = JCasUtil.select( value,
IdentifiedAnnotation.class );
       for ( IdentifiedAnnotation annotation : annotations ) {
          row.initializeEntity( annotation );
          final Collection<UmlsConcept> umlsConcepts = OntologyConceptUtil.getUmlsConcepts(
annotation );
          for ( UmlsConcept concept : umlsConcepts ) {
             row.addToStatement( statement, concept );
-            incrementBatchIndex();
+            batchWritten = incrementBatchIndex();
          }
       }
+      if ( !batchWritten ) {
+         // The current batch has not been written to db.  Do so now.
+         getCallableStatement().executeBatch();
+      }
    }
 
 



Mime
View raw message