Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/builder/ImportApp.java |
— | — | @@ -256,10 +256,11 @@ |
257 | 257 | |
258 | 258 | if (operation == Operation.FRESH) { |
259 | 259 | section("-- purge --------------------------------------------------"); |
260 | | - store.prepare(true, getDropWarnings()); //FIXME: don't purge warning always... but when?! |
| 260 | + store.initialize(true, getDropWarnings()); //FIXME: don't purge warning always... but when?! |
| 261 | + ...all stores... |
261 | 262 | } |
262 | 263 | else { |
263 | | - store.prepare(false, getDropWarnings()); |
| 264 | + store.initialize(false, getDropWarnings()); |
264 | 265 | } |
265 | 266 | |
266 | 267 | if (!useAgenda || agenda.beginTask("ImportApp.launch", agendaTask)) { |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/builder/ConceptImporter.java |
— | — | @@ -49,6 +49,8 @@ |
50 | 50 | @Override |
51 | 51 | public void prepare() throws PersistenceException { |
52 | 52 | store.prepare(); |
| 53 | + if (storeProperties) propertyStore.prepare(); |
| 54 | + if (storeFlatText) textStore.prepare(); |
53 | 55 | } |
54 | 56 | |
55 | 57 | @Override |
— | — | @@ -58,6 +60,16 @@ |
59 | 61 | endTask("ConceptImporter.finish", "finishImport"); |
60 | 62 | } |
61 | 63 | |
| 64 | + if (beginTask("ConceptImporter.finish", "finishImport")) { |
| 65 | + propertyStore.finishImport(); |
| 66 | + endTask("ConceptImporter.finish", "finishImport"); |
| 67 | + } |
| 68 | + |
| 69 | + if (beginTask("ConceptImporter.finish", "finishImport")) { |
| 70 | + textStore.finishImport(); |
| 71 | + endTask("ConceptImporter.finish", "finishImport"); |
| 72 | + } |
| 73 | + |
62 | 74 | if (beginTask("ConceptImporter.finish", "finishBadLinks")) { |
63 | 75 | store.finishBadLinks(); |
64 | 76 | endTask("ConceptImporter.finish", "finishBadLinks"); |
— | — | @@ -86,11 +98,13 @@ |
87 | 99 | endTask("ConceptImporter.finish", "finishAliases"); |
88 | 100 | } |
89 | 101 | |
90 | | - if (beginTask("ConceptImporter.finish", "propertyStore#finishAliases")) { |
| 102 | + if (propertyStore!=null && beginTask("ConceptImporter.finish", "propertyStore#finishAliases")) { |
91 | 103 | propertyStore.finishAliases(); |
92 | 104 | endTask("ConceptImporter.finish", "propertyStore#finishAliases"); |
93 | 105 | } |
94 | 106 | |
| 107 | + //TODO: finish aliases for textStore! |
| 108 | + |
95 | 109 | if (beginTask("ConceptImporter.finish", "finishRelations")) { |
96 | 110 | store.finishRelations(); |
97 | 111 | endTask("ConceptImporter.finish", "finishRelations"); |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DebugLocalConceptStoreBuilder.java |
— | — | @@ -79,7 +79,7 @@ |
80 | 80 | log("* optimize *"); |
81 | 81 | } |
82 | 82 | |
83 | | - public void prepare(boolean purge, boolean dropAll) throws PersistenceException { |
| 83 | + public void initialize(boolean purge, boolean dropAll) throws PersistenceException { |
84 | 84 | log("* prepare("+purge+", "+dropAll+") *"); |
85 | 85 | } |
86 | 86 | |
— | — | @@ -152,7 +152,7 @@ |
153 | 153 | log("* optimize *"); |
154 | 154 | } |
155 | 155 | |
156 | | - public void prepare(boolean purge, boolean dropAll) throws PersistenceException { |
| 156 | + public void initialize(boolean purge, boolean dropAll) throws PersistenceException { |
157 | 157 | log("* prepare *"); |
158 | 158 | } |
159 | 159 | |
— | — | @@ -229,7 +229,7 @@ |
230 | 230 | log("* optimize *"); |
231 | 231 | } |
232 | 232 | |
233 | | - public void prepare(boolean purge, boolean dropAll) throws PersistenceException { |
| 233 | + public void initialize(boolean purge, boolean dropAll) throws PersistenceException { |
234 | 234 | log("* prepare *"); |
235 | 235 | } |
236 | 236 | |
— | — | @@ -299,7 +299,7 @@ |
300 | 300 | log("* optimize *"); |
301 | 301 | } |
302 | 302 | |
303 | | - public void prepare(boolean purge, boolean dropAll) throws PersistenceException { |
| 303 | + public void initialize(boolean purge, boolean dropAll) throws PersistenceException { |
304 | 304 | log("* prepare *"); |
305 | 305 | } |
306 | 306 | |
— | — | @@ -387,7 +387,7 @@ |
388 | 388 | log("* close *"); |
389 | 389 | } |
390 | 390 | |
391 | | - public void prepare(boolean purge, boolean dropAll) { |
| 391 | + public void initialize(boolean purge, boolean dropAll) { |
392 | 392 | log("* prepare *"); |
393 | 393 | } |
394 | 394 | |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseWikiWordStoreBuilder.java |
— | — | @@ -20,6 +20,7 @@ |
21 | 21 | import de.brightbyte.util.PersistenceException; |
22 | 22 | import de.brightbyte.util.StringUtils; |
23 | 23 | import de.brightbyte.wikiword.TweakSet; |
| 24 | +import de.brightbyte.wikiword.schema.AliasScope; |
24 | 25 | import de.brightbyte.wikiword.schema.WikiWordStoreSchema; |
25 | 26 | import de.brightbyte.wikiword.store.DatabaseWikiWordStore; |
26 | 27 | |
— | — | @@ -343,7 +344,7 @@ |
344 | 345 | } |
345 | 346 | */ |
346 | 347 | |
347 | | - public void prepare(boolean purge, boolean dropAll) throws PersistenceException { |
| 348 | + public void initialize(boolean purge, boolean dropAll) throws PersistenceException { |
348 | 349 | if (purge) { |
349 | 350 | dropTables(true, dropAll); |
350 | 351 | createTables(false); |
— | — | @@ -449,5 +450,32 @@ |
450 | 451 | throw new PersistenceException(e); |
451 | 452 | } |
452 | 453 | } |
| 454 | + |
| 455 | + protected int resolveRedirects(RelationTable aliasTable, DatabaseTable table, String relNameField, String relIdField, AliasScope scope, int chunkFactor) throws PersistenceException { |
| 456 | + if (relIdField==null && relNameField==null) throw new IllegalArgumentException("relNameFields and relIdField can't both be null"); |
| 457 | + |
| 458 | + DatabaseField nmField = relNameField ==null ? null : table.getField(relNameField); |
| 459 | + DatabaseField idField = relIdField == null ? null : table.getField(relIdField); |
| 460 | + |
| 461 | + if (nmField!=null && !(nmField instanceof ReferenceField)) throw new IllegalArgumentException(relNameField+" is not a reference field in table "+table.getName()); |
| 462 | + if (idField!=null && !(idField instanceof ReferenceField)) throw new IllegalArgumentException(relIdField+" is not a reference field in table "+table.getName()); |
| 463 | + |
| 464 | + String nmTable = nmField == null ? null : ((ReferenceField)nmField).getTargetTable(); |
| 465 | + String idTable = idField == null ? null : ((ReferenceField)idField).getTargetTable(); |
| 466 | + |
| 467 | + if (idTable!=null && nmTable!=null && !nmTable.equals(idTable)) throw new IllegalArgumentException(relNameField+" and "+relIdField+" in table "+table.getName()+" do not reference the same table: "+nmTable+" != "+idTable); |
453 | 468 | |
| 469 | + String sql = "UPDATE "+table.getSQLName()+" as R JOIN "+aliasTable.getSQLName()+" as E " |
| 470 | + + ((idField!=null) ? " ON R."+relIdField+" = E.source " : " ON R."+relNameField+" = E.source_name ") |
| 471 | + + " SET "; |
| 472 | + |
| 473 | + if (nmField!=null) sql += " R."+relNameField+" = E.target_name"; |
| 474 | + if (nmField!=null && idField!=null) sql += ", "; |
| 475 | + if (idField!=null) sql += " R."+relIdField+" = E.target"; |
| 476 | + |
| 477 | + String where = scope == null ? null : " scope = "+scope.ordinal(); |
| 478 | + |
| 479 | + return executeChunkedUpdate("resolveRedirects", table.getName()+"."+relNameField+"+"+relIdField, sql, where, aliasTable, "source", chunkFactor); |
| 480 | + } |
| 481 | + |
454 | 482 | } |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseLocalConceptStoreBuilder.java |
— | — | @@ -35,9 +35,7 @@ |
36 | 36 | import de.brightbyte.wikiword.schema.ConceptInfoStoreSchema; |
37 | 37 | import de.brightbyte.wikiword.schema.LocalConceptStoreSchema; |
38 | 38 | import de.brightbyte.wikiword.schema.LocalStatisticsStoreSchema; |
39 | | -import de.brightbyte.wikiword.schema.PropertyStoreSchema; |
40 | 39 | import de.brightbyte.wikiword.schema.StatisticsStoreSchema; |
41 | | -import de.brightbyte.wikiword.schema.TextStoreSchema; |
42 | 40 | import de.brightbyte.wikiword.store.DatabaseLocalConceptStore; |
43 | 41 | |
44 | 42 | /** |
— | — | @@ -160,7 +158,7 @@ |
161 | 159 | } |
162 | 160 | |
163 | 161 | @Override |
164 | | - public void prepare(boolean purge, boolean dropAll) throws PersistenceException { |
| 162 | + public void initialize(boolean purge, boolean dropAll) throws PersistenceException { |
165 | 163 | if (purge) { |
166 | 164 | if (idManager!=null) idManager.clear(); |
167 | 165 | } |
— | — | @@ -175,7 +173,7 @@ |
176 | 174 | } |
177 | 175 | } |
178 | 176 | |
179 | | - super.prepare(purge, dropAll); |
| 177 | + super.initialize(purge, dropAll); |
180 | 178 | } |
181 | 179 | |
182 | 180 | public ConceptType getConceptType(int type) { |
— | — | @@ -671,7 +669,7 @@ |
672 | 670 | //NOTE: need to resolve category-aliases here, so no concepts are generated for aliased categories! |
673 | 671 | //NOTE: bad category redirs have been droped in finishBadLinks |
674 | 672 | if (beginTask("finishMissingConcpets", "resolveRedirects:broader")) { |
675 | | - int n = resolveRedirects(broaderTable, "broad_name", idManager==null ? null : "broad", AliasScope.CATEGORY, 1); |
| 673 | + int n = resolveRedirects(aliasTable, broaderTable, "broad_name", idManager==null ? null : "broad", AliasScope.CATEGORY, 1); |
676 | 674 | endTask("finishMissingConcpets", "resolveRedirects:broader", n+" entries"); |
677 | 675 | } |
678 | 676 | |
— | — | @@ -743,24 +741,24 @@ |
744 | 742 | if (beginTask("finishAliases", "resolveRedirects:link")) { |
745 | 743 | //XXX: SLOW! |
746 | 744 | //TODO: smaller chunks? chunk on target table, not alias table? force index? |
747 | | - int n = resolveRedirects(linkTable, "target_name", "target", AliasScope.REDIRECT, 8); |
| 745 | + int n = resolveRedirects(aliasTable, linkTable, "target_name", "target", AliasScope.REDIRECT, 8); |
748 | 746 | endTask("finishAliases", "resolveRedirects:link", n+" entries"); |
749 | 747 | } |
750 | 748 | |
751 | 749 | //NOTE: broader.broad_name already done in finishMissingConcepts for AliasScope.BROADER |
752 | 750 | |
753 | 751 | if (beginTask("finishAliases", "resolveRedirects:about")) { |
754 | | - int n = resolveRedirects(aboutTable, null, "concept", null, 1); |
| 752 | + int n = resolveRedirects(aliasTable, aboutTable, null, "concept", null, 1); |
755 | 753 | endTask("finishAliases", "resolveRedirects:about", n+" entries"); |
756 | 754 | } |
757 | 755 | |
758 | 756 | if (beginTask("finishAliases", "resolveRedirects:narrow")) { |
759 | | - int n = resolveRedirects(broaderTable, "narrow_name", "narrow", null, 1); |
| 757 | + int n = resolveRedirects(aliasTable, broaderTable, "narrow_name", "narrow", null, 1); |
760 | 758 | endTask("finishAliases", "resolveRedirects:narrow", n+" entries"); |
761 | 759 | } |
762 | 760 | |
763 | 761 | if (beginTask("finishAliases", "resolveRedirects:broad")) { |
764 | | - int n = resolveRedirects(broaderTable, "broad_name", "broad", null, 1); |
| 762 | + int n = resolveRedirects(aliasTable, broaderTable, "broad_name", "broad", null, 1); |
765 | 763 | endTask("finishAliases", "resolveRedirects:broad", n+" entries"); |
766 | 764 | } |
767 | 765 | |
— | — | @@ -1148,29 +1146,6 @@ |
1149 | 1147 | return executeChunkedUpdate("buildIdLinks", table.getName()+"."+relNameField, sql, where, target, targetIdField, chunkFactor); |
1150 | 1148 | } |
1151 | 1149 | |
1152 | | - protected int resolveRedirects(DatabaseTable table, String relNameField, String relIdField, AliasScope scope, int chunkFactor) throws PersistenceException { |
1153 | | - DatabaseField nmField = table.getField(relNameField); |
1154 | | - DatabaseField idField = relIdField == null ? null : table.getField(relIdField); |
1155 | | - |
1156 | | - if (!(nmField instanceof ReferenceField)) throw new IllegalArgumentException(relNameField+" is not a reference field in table "+table.getName()); |
1157 | | - if (idField!=null && !(idField instanceof ReferenceField)) throw new IllegalArgumentException(relIdField+" is not a reference field in table "+table.getName()); |
1158 | | - |
1159 | | - String nmTable = ((ReferenceField)nmField).getTargetTable(); |
1160 | | - String idTable = idField == null ? null : ((ReferenceField)idField).getTargetTable(); |
1161 | | - |
1162 | | - if (idTable!=null && !nmTable.equals(idTable)) throw new IllegalArgumentException(relNameField+" and "+relIdField+" in table "+table.getName()+" do not reference the same table: "+nmTable+" != "+idTable); |
1163 | | - |
1164 | | - String sql = "UPDATE "+table.getSQLName()+" as R JOIN "+aliasTable.getSQLName()+" as E " |
1165 | | - + ((idField!=null) ? " ON R."+relIdField+" = E.source " : " ON R."+relNameField+" = E.source_name ") |
1166 | | - + " SET R."+relNameField+" = E.target_name"; |
1167 | | - |
1168 | | - if (idField!=null) sql += ", R."+relIdField+" = E.target"; |
1169 | | - |
1170 | | - String where = scope == null ? null : " scope = "+scope.ordinal(); |
1171 | | - |
1172 | | - return executeChunkedUpdate("resolveRedirects", table.getName()+"."+relNameField+"+"+relIdField, sql, where, aliasTable, "source", chunkFactor); |
1173 | | - } |
1174 | | - |
1175 | 1150 | ///////////////////////////////////////////////////////////////////////////////////////////// |
1176 | 1151 | protected class DatabaseLocalStatisticsStoreBuilder extends DatabaseStatisticsStoreBuilder { |
1177 | 1152 | protected EntityTable termTable; |
— | — | @@ -1262,13 +1237,11 @@ |
1263 | 1238 | private DatabasePropertyStoreBuilder propertyStore; |
1264 | 1239 | |
1265 | 1240 | protected DatabaseTextStoreBuilder newTextStoreBuilder() throws SQLException, PersistenceException { |
1266 | | - TextStoreSchema schema = new TextStoreSchema(getCorpus(), getDatabaseAccess().getConnection(), tweaks, false); |
1267 | | - return new DatabaseTextStoreBuilder(schema, tweaks); |
| 1241 | + return new DatabaseTextStoreBuilder(this, tweaks); |
1268 | 1242 | } |
1269 | 1243 | |
1270 | 1244 | protected DatabasePropertyStoreBuilder newPropertyStoreBuilder() throws SQLException, PersistenceException { |
1271 | | - PropertyStoreSchema schema = new PropertyStoreSchema(getCorpus(), getDatabaseAccess().getConnection(), tweaks, false); |
1272 | | - return new DatabasePropertyStoreBuilder(schema, tweaks); |
| 1245 | + return new DatabasePropertyStoreBuilder(this, tweaks); |
1273 | 1246 | } |
1274 | 1247 | |
1275 | 1248 | public TextStoreBuilder getTextStoreBuilder() throws PersistenceException { |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/WikiWordStoreBuilder.java |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | |
9 | 9 | public interface WikiWordStoreBuilder extends WikiWordStore { |
10 | 10 | |
11 | | - public abstract void prepare(boolean purge, boolean dropAll) throws PersistenceException; |
| 11 | + public abstract void initialize(boolean purge, boolean dropAll) throws PersistenceException; |
12 | 12 | |
13 | 13 | public abstract void close(boolean flush) throws PersistenceException; |
14 | 14 | |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/FauxStoreBuilder.java |
— | — | @@ -41,7 +41,7 @@ |
42 | 42 | flush(); |
43 | 43 | } |
44 | 44 | |
45 | | - public void prepare(boolean purge, boolean dropAll) throws PersistenceException { |
| 45 | + public void initialize(boolean purge, boolean dropAll) throws PersistenceException { |
46 | 46 | //noop |
47 | 47 | } |
48 | 48 | |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseTextStoreBuilder.java |
— | — | @@ -31,7 +31,13 @@ |
32 | 32 | |
33 | 33 | protected Inserter plainTextInserter; |
34 | 34 | protected Inserter rawTextInserter; |
| 35 | + |
| 36 | + public DatabaseTextStoreBuilder(DatabaseLocalConceptStoreBuilder conceptStore, TweakSet tweaks) throws SQLException { |
| 37 | + this(new TextStoreSchema(conceptStore.getCorpus(), |
| 38 | + conceptStore.getDatabaseAccess().getConnection(), tweaks, true), tweaks); |
| 39 | + } |
35 | 40 | |
| 41 | + |
36 | 42 | /** |
37 | 43 | * Constructs a DatabaseWikiStore, soring information from/about the given Corpus |
38 | 44 | * into the database defined by the DatabaseConnectionInfo. |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabasePropertyStoreBuilder.java |
— | — | @@ -1,24 +1,22 @@ |
2 | 2 | package de.brightbyte.wikiword.store.builder; |
3 | 3 | |
4 | | -import java.sql.Connection; |
5 | 4 | import java.sql.SQLException; |
6 | 5 | |
7 | | -import javax.sql.DataSource; |
8 | | - |
9 | 6 | import de.brightbyte.db.Inserter; |
10 | 7 | import de.brightbyte.db.RelationTable; |
11 | 8 | import de.brightbyte.util.PersistenceException; |
12 | 9 | import de.brightbyte.wikiword.Corpus; |
13 | 10 | import de.brightbyte.wikiword.TweakSet; |
14 | 11 | import de.brightbyte.wikiword.schema.AliasScope; |
| 12 | +import de.brightbyte.wikiword.schema.ConceptStoreSchemas; |
| 13 | +import de.brightbyte.wikiword.schema.LocalConceptStoreSchema; |
15 | 14 | import de.brightbyte.wikiword.schema.PropertyStoreSchema; |
16 | 15 | |
17 | 16 | public class DatabasePropertyStoreBuilder extends DatabaseLocalStoreBuilder implements PropertyStoreBuilder { |
18 | 17 | |
19 | | - protected DatabaseLocalConceptStoreBuilder conceptStore; |
20 | | - |
21 | 18 | protected RelationTable propertyTable; |
22 | 19 | protected Inserter propertyInserter; |
| 20 | + private LocalConceptStoreSchema conceptStoreSchema; |
23 | 21 | |
24 | 22 | /** |
25 | 23 | * Constructs a DatabaseWikiStore, soring information from/about the given Corpus |
— | — | @@ -28,10 +26,11 @@ |
29 | 27 | * Used to determin the table names (from Corpus.getDbPrefix) and to generate URIs. |
30 | 28 | * @param dbInfo database connection info, used to connect to the database |
31 | 29 | * @param tweaks a tweak set from which additional options can be taken (see description at the top). |
| 30 | + * @throws PersistenceException |
32 | 31 | */ |
33 | | - public DatabasePropertyStoreBuilder(Corpus corpus, DataSource dbInfo, TweakSet tweaks) throws SQLException { |
| 32 | + /*public DatabasePropertyStoreBuilder(Corpus corpus, DataSource dbInfo, TweakSet tweaks) throws SQLException, PersistenceException { |
34 | 33 | this(new PropertyStoreSchema(corpus, dbInfo, tweaks, true), tweaks); |
35 | | - } |
| 34 | + }*/ |
36 | 35 | |
37 | 36 | /** |
38 | 37 | * Constructs a DatabaseWikiStore, soring information from/about the given Corpus |
— | — | @@ -41,12 +40,13 @@ |
42 | 41 | * Used to determin the table names (from Corpus.getDbPrefix) and to generate URIs. |
43 | 42 | * @param db a database connection |
44 | 43 | * @param tweaks a tweak set from which additional options can be taken (see description at the top). |
| 44 | + * @throws PersistenceException |
45 | 45 | */ |
46 | | - public DatabasePropertyStoreBuilder(Corpus corpus, Connection db, TweakSet tweaks) throws SQLException { |
| 46 | + /*public DatabasePropertyStoreBuilder(Corpus corpus, Connection db, TweakSet tweaks) throws SQLException, PersistenceException { |
47 | 47 | this(new PropertyStoreSchema(corpus, db, tweaks, true), tweaks); |
48 | | - } |
| 48 | + }*/ |
49 | 49 | |
50 | | - public DatabasePropertyStoreBuilder(DatabaseLocalConceptStoreBuilder conceptStore, TweakSet tweaks) throws SQLException { |
| 50 | + public DatabasePropertyStoreBuilder(DatabaseLocalConceptStoreBuilder conceptStore, TweakSet tweaks) throws SQLException, PersistenceException { |
51 | 51 | this(conceptStore, |
52 | 52 | new PropertyStoreSchema(conceptStore.getCorpus(), |
53 | 53 | conceptStore.getDatabaseAccess().getConnection(), |
— | — | @@ -63,37 +63,41 @@ |
64 | 64 | * @param db empty DatabaseSchema, wrapping a database connection. Will be configured with the appropriate table defitions |
65 | 65 | * @param tweaks a tweak set from which additional options can be taken (see description at the top). |
66 | 66 | * @throws SQLException |
| 67 | + * @throws PersistenceException |
67 | 68 | */ |
68 | | - protected DatabasePropertyStoreBuilder(PropertyStoreSchema database, TweakSet tweaks) throws SQLException { |
| 69 | + /*protected DatabasePropertyStoreBuilder(PropertyStoreSchema database, TweakSet tweaks) throws SQLException, PersistenceException { |
69 | 70 | this( new DatabaseLocalConceptStoreBuilder(database.getCorpus(), database.getConnection(), tweaks), |
70 | 71 | database, tweaks); |
71 | | - } |
| 72 | + }*/ |
72 | 73 | |
73 | | - protected DatabasePropertyStoreBuilder(DatabaseLocalConceptStoreBuilder conceptStore, PropertyStoreSchema database, TweakSet tweaks) throws SQLException { |
| 74 | + protected DatabasePropertyStoreBuilder(DatabaseLocalConceptStoreBuilder conceptStore, PropertyStoreSchema database, TweakSet tweaks) throws SQLException, PersistenceException { |
74 | 75 | super(database, tweaks); |
75 | 76 | |
76 | | - this.conceptStore = conceptStore; |
| 77 | + //this.conceptStore = conceptStore; |
77 | 78 | |
78 | 79 | this.propertyInserter = configureTable("property", 128, 3*32); |
79 | 80 | this.propertyTable = (RelationTable)propertyInserter.getTable(); |
| 81 | + |
| 82 | + this.conceptStoreSchema = new LocalConceptStoreSchema(conceptStore.getCorpus(), |
| 83 | + conceptStore.getDatabaseAccess().getConnection(), |
| 84 | + tweaks, true); |
| 85 | + |
| 86 | + this.agenda = conceptStore.getAgenda(); |
80 | 87 | } |
81 | 88 | |
82 | 89 | @Override |
83 | 90 | protected void deleteDataFrom(int rcId, String op) throws PersistenceException { |
84 | | - conceptStore.deleteDataFrom(rcId, op); |
85 | 91 | deleteDataFrom(rcId, op, propertyTable, "concept"); |
86 | 92 | } |
87 | 93 | |
88 | 94 | @Override |
89 | | - public void prepare(boolean purge, boolean dropAll) throws PersistenceException { |
90 | | - super.prepare(purge, dropAll); |
91 | | - conceptStore.prepare(purge, dropAll); |
| 95 | + public void initialize(boolean purge, boolean dropAll) throws PersistenceException { |
| 96 | + super.initialize(purge, dropAll); |
92 | 97 | } |
93 | 98 | |
94 | 99 | @Override |
95 | 100 | public void flush() throws PersistenceException { |
96 | 101 | super.flush(); |
97 | | - conceptStore.flush(); |
98 | 102 | } |
99 | 103 | |
100 | 104 | protected int getConceptId(String title) throws SQLException { |
— | — | @@ -142,8 +146,11 @@ |
143 | 147 | } |
144 | 148 | |
145 | 149 | public void finishAliases() throws PersistenceException { |
| 150 | + |
146 | 151 | if (beginTask("finishAliases", "resolveRedirects:property")) { |
147 | | - int n = conceptStore.resolveRedirects(propertyTable, "concept_name", "concept", AliasScope.REDIRECT, 3); |
| 152 | + RelationTable aliasTable = (RelationTable)conceptStoreSchema.getTable("alias"); |
| 153 | + |
| 154 | + int n = resolveRedirects(aliasTable, propertyTable, "concept_name", "concept", AliasScope.REDIRECT, 3); |
148 | 155 | endTask("finishAliases", "resolveRedirects:property", n+" entries"); |
149 | 156 | } |
150 | 157 | } |