r66563 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66562‎ | r66563 | r66564 >
Date:14:03, 17 May 2010
Author:daniel
Status:deferred
Tags:
Comment:
fixed: global meaning table
Modified paths:
  • /trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/schema/GlobalConceptStoreSchema.java (modified) (history)
  • /trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseGlobalConceptStoreBuilder.java (modified) (history)

Diff [purge]

Index: trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/schema/GlobalConceptStoreSchema.java
@@ -101,7 +101,7 @@
102102 meaningTable = new RelationTable(this, "meaning", getDefaultTableAttributes());
103103 meaningTable.addField( new ReferenceField(this, "concept", "INT", null, true, null, "concept", "id", null ) );
104104 meaningTable.addField( new DatabaseField(this, "lang", getTextType(10), null, true, null ) );
105 - meaningTable.addField( new DatabaseField(this, "score", "INT", null, true, null ) );
 105+ meaningTable.addField( new DatabaseField(this, "rule", "INT", null, true, KeyType.INDEX) );
106106 meaningTable.addField( new DatabaseField(this, "freq", "INT", null, true, null ) );
107107 meaningTable.addField( new DatabaseField(this, "term_text", getTextType(255), null, true, null) );
108108 meaningTable.addKey( new DatabaseKey(this, KeyType.PRIMARY, "lang_term_concept", new String[] {"lang", "term_text", "concept"}) );
@@ -124,6 +124,7 @@
125125
126126 checkIdSanity(originTable, "local_concept");
127127 checkReferentialIntegrity(originTable, "global_concept", false);
 128+ checkReferentialIntegrity(meaningTable, "concept", false);
128129
129130 checkReferentialIntegrity(relationTable, "concept1", false);
130131 checkReferentialIntegrity(relationTable, "concept2", false);
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseGlobalConceptStoreBuilder.java
@@ -53,6 +53,8 @@
5454 protected Inserter mergeInserter;
5555
5656 protected RelationTable originTable;
 57+ protected RelationTable meaningTable;
 58+
5759 protected RelationTable mergeTable;
5860 //protected RelationTable langprepTable;
5961
@@ -106,6 +108,9 @@
107109 Inserter originInserter = configureTable("origin", 16, 4*1024);
108110 originTable = (RelationTable)originInserter.getTable();
109111
 112+ Inserter meaningInserter = configureTable("meaning", 16, 4*1024);
 113+ meaningTable = (RelationTable)meaningInserter.getTable();
 114+
110115 mergeInserter = configureTable("merge", 16, 4*1024);
111116 mergeTable = (RelationTable)mergeInserter.getTable();
112117
@@ -687,13 +692,12 @@
688693 private int importMeanings(Corpus c) throws PersistenceException {
689694 LocalConceptStoreSchema localdb = getLocalConceptDatabase(c);
690695 DatabaseTable localMeanings = localdb.getTable("meaning");
691 - DatabaseTable globalMeanings = database.getTable("meaning");
692696 DatabaseTable origin = database.getTable("origin");
693697
694 - String sql = "INSERT INTO "+globalMeanings.getSQLName()+" (concept, lang, rule, freq, term_text) "
695 - + " SELECT (O.global_concept, "+database.quoteString(c.getLanguage())+", M.rule, M.freq, M.term_text "
 698+ String sql = "INSERT INTO "+meaningTable.getSQLName()+" (concept, lang, rule, freq, term_text) "
 699+ + " SELECT O.global_concept, "+database.quoteString(c.getLanguage())+", M.rule, M.freq, M.term_text "
696700 + " FROM "+origin.getSQLName()+" as O "
697 - + " JOIN "+localMeanings.getSQLName()+" as M ON M.concept = O.localConcept "
 701+ + " JOIN "+localMeanings.getSQLName()+" as M ON M.concept = O.local_concept "
698702 + " AND O.lang = "+database.quoteString(c.getLanguage());
699703
700704 int n = executeChunkedUpdate("importMeanings", "import("+c.getLanguage()+")", sql, null, localMeanings, "M.concept");

Status & tagging log