Index: trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/schema/GlobalConceptStoreSchema.java |
— | — | @@ -101,7 +101,7 @@ |
102 | 102 | meaningTable = new RelationTable(this, "meaning", getDefaultTableAttributes()); |
103 | 103 | meaningTable.addField( new ReferenceField(this, "concept", "INT", null, true, null, "concept", "id", null ) ); |
104 | 104 | 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) ); |
106 | 106 | meaningTable.addField( new DatabaseField(this, "freq", "INT", null, true, null ) ); |
107 | 107 | meaningTable.addField( new DatabaseField(this, "term_text", getTextType(255), null, true, null) ); |
108 | 108 | meaningTable.addKey( new DatabaseKey(this, KeyType.PRIMARY, "lang_term_concept", new String[] {"lang", "term_text", "concept"}) ); |
— | — | @@ -124,6 +124,7 @@ |
125 | 125 | |
126 | 126 | checkIdSanity(originTable, "local_concept"); |
127 | 127 | checkReferentialIntegrity(originTable, "global_concept", false); |
| 128 | + checkReferentialIntegrity(meaningTable, "concept", false); |
128 | 129 | |
129 | 130 | checkReferentialIntegrity(relationTable, "concept1", false); |
130 | 131 | checkReferentialIntegrity(relationTable, "concept2", false); |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseGlobalConceptStoreBuilder.java |
— | — | @@ -53,6 +53,8 @@ |
54 | 54 | protected Inserter mergeInserter; |
55 | 55 | |
56 | 56 | protected RelationTable originTable; |
| 57 | + protected RelationTable meaningTable; |
| 58 | + |
57 | 59 | protected RelationTable mergeTable; |
58 | 60 | //protected RelationTable langprepTable; |
59 | 61 | |
— | — | @@ -106,6 +108,9 @@ |
107 | 109 | Inserter originInserter = configureTable("origin", 16, 4*1024); |
108 | 110 | originTable = (RelationTable)originInserter.getTable(); |
109 | 111 | |
| 112 | + Inserter meaningInserter = configureTable("meaning", 16, 4*1024); |
| 113 | + meaningTable = (RelationTable)meaningInserter.getTable(); |
| 114 | + |
110 | 115 | mergeInserter = configureTable("merge", 16, 4*1024); |
111 | 116 | mergeTable = (RelationTable)mergeInserter.getTable(); |
112 | 117 | |
— | — | @@ -687,13 +692,12 @@ |
688 | 693 | private int importMeanings(Corpus c) throws PersistenceException { |
689 | 694 | LocalConceptStoreSchema localdb = getLocalConceptDatabase(c); |
690 | 695 | DatabaseTable localMeanings = localdb.getTable("meaning"); |
691 | | - DatabaseTable globalMeanings = database.getTable("meaning"); |
692 | 696 | DatabaseTable origin = database.getTable("origin"); |
693 | 697 | |
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 " |
696 | 700 | + " 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 " |
698 | 702 | + " AND O.lang = "+database.quoteString(c.getLanguage()); |
699 | 703 | |
700 | 704 | int n = executeChunkedUpdate("importMeanings", "import("+c.getLanguage()+")", sql, null, localMeanings, "M.concept"); |