ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1770426 - in /ctakes/sandbox/dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator: gui/ctakes/DictionaryBuilder.java gui/ctakes/DictionaryXmlWriter.java util/HsqlUtil.java util/JdbcUtil.java util/RareWordDbWriter.java
Date Fri, 18 Nov 2016 19:15:57 GMT
Author: tmill
Date: Fri Nov 18 19:15:57 2016
New Revision: 1770426

URL: http://svn.apache.org/viewvc?rev=1770426&view=rev
Log:
Escape all instances of the vocab source name that contain - for _, making it DSM-5 compatible.

Modified:
    ctakes/sandbox/dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/gui/ctakes/DictionaryBuilder.java
    ctakes/sandbox/dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/gui/ctakes/DictionaryXmlWriter.java
    ctakes/sandbox/dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/HsqlUtil.java
    ctakes/sandbox/dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/JdbcUtil.java
    ctakes/sandbox/dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/RareWordDbWriter.java

Modified: ctakes/sandbox/dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/gui/ctakes/DictionaryBuilder.java
URL: http://svn.apache.org/viewvc/ctakes/sandbox/dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/gui/ctakes/DictionaryBuilder.java?rev=1770426&r1=1770425&r2=1770426&view=diff
==============================================================================
--- ctakes/sandbox/dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/gui/ctakes/DictionaryBuilder.java
(original)
+++ ctakes/sandbox/dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/gui/ctakes/DictionaryBuilder.java
Fri Nov 18 19:15:57 2016
@@ -59,8 +59,7 @@ static private final String DEFAULT_DATA
          nitricOxides.removeTexts( Arrays.asList( "nos", "synthase" ) );
       }
 
-      writeDatabase( ctakesDirPath, dictionaryName, conceptMap );
-      return true;
+      return writeDatabase( ctakesDirPath, dictionaryName, conceptMap );
    }
 
 

Modified: ctakes/sandbox/dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/gui/ctakes/DictionaryXmlWriter.java
URL: http://svn.apache.org/viewvc/ctakes/sandbox/dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/gui/ctakes/DictionaryXmlWriter.java?rev=1770426&r1=1770425&r2=1770426&view=diff
==============================================================================
--- ctakes/sandbox/dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/gui/ctakes/DictionaryXmlWriter.java
(original)
+++ ctakes/sandbox/dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/gui/ctakes/DictionaryXmlWriter.java
Fri Nov 18 19:15:57 2016
@@ -84,7 +84,7 @@ public class DictionaryXmlWriter {
          writer.write( "Uncommenting these lines alone may not persist term information;\n"
);
          writer.write( "persistence depends upon the TermConsumer.  -->\n" );
          for ( String vocabulary : Vocabulary.getInstance().getAllVocabularies() ) {
-            writer.write( createProperty( vocabulary.toLowerCase().replace( '.','_' )
+            writer.write( createProperty( vocabulary.toLowerCase().replace( '.','_' ).replace('-',
'_')
                                           + "Table", Vocabulary.getInstance().getCtakesClass(
vocabulary ) ) );
          }
          writer.write( "      </properties>\n" );

Modified: ctakes/sandbox/dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/HsqlUtil.java
URL: http://svn.apache.org/viewvc/ctakes/sandbox/dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/HsqlUtil.java?rev=1770426&r1=1770425&r2=1770426&view=diff
==============================================================================
--- ctakes/sandbox/dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/HsqlUtil.java
(original)
+++ ctakes/sandbox/dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/HsqlUtil.java
Fri Nov 18 19:15:57 2016
@@ -77,7 +77,7 @@ final public class HsqlUtil {
          // vocabulary tables
          for ( String vocabulary : Vocabulary.getInstance().getAllVocabularies() ) {
             final String jdbcClass = Vocabulary.getInstance().getJdbcClass( vocabulary );
-            final String tableName = vocabulary.replace( '.','_' );
+            final String tableName = vocabulary.replace( '.','_' ).replace('-', '_');
             writer.write( "CREATE MEMORY TABLE " + tableName + "(CUI BIGINT," + tableName
+ " " + jdbcClass + ")\n" );
             writer.write( "CREATE INDEX IDX_" + tableName + " ON " + tableName + "(CUI)\n"
);
          }

Modified: ctakes/sandbox/dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/JdbcUtil.java
URL: http://svn.apache.org/viewvc/ctakes/sandbox/dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/JdbcUtil.java?rev=1770426&r1=1770425&r2=1770426&view=diff
==============================================================================
--- ctakes/sandbox/dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/JdbcUtil.java
(original)
+++ ctakes/sandbox/dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/JdbcUtil.java
Fri Nov 18 19:15:57 2016
@@ -62,7 +62,7 @@ final public class JdbcUtil {
    }
 
    static public String createCodeInsertSql( final String vocabulary ) {
-      return createRowInsertSql( vocabulary.toLowerCase().replace( '.','_' ), "CUI", vocabulary
);
+      return createRowInsertSql( vocabulary.toLowerCase().replace( '.','_' ).replace('-',
'_'), "CUI", vocabulary.replace('-', '_') );
    }
 
    static public String createRowInsertSql( final String tableName, final String... fieldNames
) {

Modified: ctakes/sandbox/dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/RareWordDbWriter.java
URL: http://svn.apache.org/viewvc/ctakes/sandbox/dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/RareWordDbWriter.java?rev=1770426&r1=1770425&r2=1770426&view=diff
==============================================================================
--- ctakes/sandbox/dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/RareWordDbWriter.java
(original)
+++ ctakes/sandbox/dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/RareWordDbWriter.java
Fri Nov 18 19:15:57 2016
@@ -130,7 +130,7 @@ final public class RareWordDbWriter {
             // write extra vocabulary code tables
             final Collection<String> vocabularies = concept.getVocabularies();
             for ( String vocabulary : vocabularies ) {
-               final PreparedStatement statement = codeStatements.get( vocabulary );
+               final PreparedStatement statement = codeStatements.get( vocabulary.replace('-',
'_') );
                statement.setLong( CuiTermsField.CUI.__index, cui );
                for ( String code : concept.getCodes( vocabulary ) ) {
                   setCodeAppropriately( statement, code, Vocabulary.getInstance().getVocabularyClass(
vocabulary ) );
@@ -177,7 +177,7 @@ final public class RareWordDbWriter {
 
 
    static private Map<String,String> createCodeInsertSqls() {
-      return Vocabulary.getInstance().getAllVocabularies().stream()
+      return Vocabulary.getInstance().getAllVocabularies().stream().map(vocab -> vocab.replace('-',
'_'))
             .collect( Collectors.toMap( asSelf, JdbcUtil::createCodeInsertSql ) );
    }
 



Mime
View raw message