Index: trunk/WikiWord/WikiWordBuilder/src/test/java/de/brightbyte/wikiword/builder/ValidateImport.java |
— | — | @@ -24,7 +24,8 @@ |
25 | 25 | import de.brightbyte.util.StringUtils; |
26 | 26 | import de.brightbyte.wikiword.CliApp; |
27 | 27 | import de.brightbyte.wikiword.TweakSet; |
28 | | -import de.brightbyte.wikiword.store.WikiWordStore; |
| 28 | +import de.brightbyte.wikiword.model.WikiWordConcept; |
| 29 | +import de.brightbyte.wikiword.store.builder.WikiWordConceptStoreBuilder; |
29 | 30 | |
30 | 31 | public class ValidateImport { |
31 | 32 | |
— | — | @@ -69,7 +70,7 @@ |
70 | 71 | protected String dbcheck = "--dummy-x"; //FIXME: set to "--dbcheck" to run consistency checks. but thes FAIL SPURIOUSLY! Something is wrong with db state. |
71 | 72 | |
72 | 73 | protected String[] languages; |
73 | | - |
| 74 | + |
74 | 75 | protected URL getResource(String name) { |
75 | 76 | if (baseDir!=null) { |
76 | 77 | File f = new File(baseDir, name); |
— | — | @@ -138,7 +139,7 @@ |
139 | 140 | out.println(msg); |
140 | 141 | } |
141 | 142 | |
142 | | - protected boolean launchApp(ImportApp<? extends WikiWordStore> app, ValidationMonitor monitor, String... argv) throws Exception { |
| 143 | + protected boolean launchApp(ImportApp<? extends WikiWordConceptStoreBuilder<? extends WikiWordConcept>> app, ValidationMonitor monitor, String... argv) throws Exception { |
143 | 144 | echo(""); |
144 | 145 | echo("============================================================"); |
145 | 146 | echo("== TESTING "+app.getClass(), (Object[])argv); |
— | — | @@ -148,7 +149,8 @@ |
149 | 150 | app.setKeepAlive(true); |
150 | 151 | app.setAgendaMonitor(monitor); |
151 | 152 | app.setTweaks(tweaks); |
152 | | - app.setDataSource(dataSource); |
| 153 | + //app.setConceptStoreFactory(conceptStoreFactory); |
| 154 | + //FIXME: somehow tell it what DB to use! |
153 | 155 | app.setOperation(ImportApp.Operation.FRESH); |
154 | 156 | app.launch(argv); |
155 | 157 | |
— | — | @@ -240,7 +242,7 @@ |
241 | 243 | |
242 | 244 | //-------------------- |
243 | 245 | tweaks.setTweak("dbstore.prefix", args.getOption("prefix", "TEST")); |
244 | | - |
| 246 | + |
245 | 247 | File dbf = CliApp.findConfigFile(args, "db"); |
246 | 248 | |
247 | 249 | if (dbf!=null) echo("Using database connection specified in "+dbf); |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/builder/ImportDump.java |
— | — | @@ -5,11 +5,11 @@ |
6 | 6 | import java.net.URL; |
7 | 7 | |
8 | 8 | import de.brightbyte.util.PersistenceException; |
9 | | -import de.brightbyte.wikiword.TweakSet; |
10 | 9 | import de.brightbyte.wikiword.analyzer.WikiTextAnalyzer; |
11 | | -import de.brightbyte.wikiword.store.builder.WikiWordStoreBuilder; |
| 10 | +import de.brightbyte.wikiword.model.WikiWordConcept; |
| 11 | +import de.brightbyte.wikiword.store.builder.WikiWordConceptStoreBuilder; |
12 | 12 | |
13 | | -public abstract class ImportDump<S extends WikiWordStoreBuilder> extends ImportApp<S> { |
| 13 | +public abstract class ImportDump<S extends WikiWordConceptStoreBuilder<? extends WikiWordConcept>> extends ImportApp<S> { |
14 | 14 | |
15 | 15 | public ImportDump(String agendaTask) { |
16 | 16 | super(agendaTask, false, true); |
— | — | @@ -62,7 +62,7 @@ |
63 | 63 | */ |
64 | 64 | |
65 | 65 | WikiTextAnalyzer analyzer = WikiTextAnalyzer.getWikiTextAnalyzer(getCorpus(), tweaks); |
66 | | - WikiWordImporter importer = newImporter(analyzer, store, tweaks); |
| 66 | + WikiWordImporter importer = newImporter(analyzer); |
67 | 67 | importer.setLogOutput(getLogOutput()); |
68 | 68 | importer.configure(args); |
69 | 69 | |
— | — | @@ -113,7 +113,7 @@ |
114 | 114 | section("-- dbstats --------------------------------------------------"); |
115 | 115 | dumpTableStats(); |
116 | 116 | |
117 | | - int w = getNumberOfWarnings(); //XXX: warnings per root-task! |
| 117 | + int w = conceptStore.getNumberOfWarnings(); //XXX: warnings per root-task! |
118 | 118 | if (w==0) info("no warnings"); |
119 | 119 | else warn("******* NOTE: "+w+" warnings collected! *******"); |
120 | 120 | } |
— | — | @@ -122,6 +122,6 @@ |
123 | 123 | //noop |
124 | 124 | } |
125 | 125 | |
126 | | - protected abstract WikiWordImporter newImporter(WikiTextAnalyzer analyzer, S store, TweakSet tweaks) throws PersistenceException; |
| 126 | + protected abstract WikiWordImporter newImporter(WikiTextAnalyzer analyzer) throws PersistenceException; |
127 | 127 | |
128 | 128 | } |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/builder/BuildThesaurus.java |
— | — | @@ -1,15 +1,8 @@ |
2 | 2 | package de.brightbyte.wikiword.builder; |
3 | 3 | |
4 | | -import java.sql.Connection; |
5 | | -import java.sql.SQLException; |
6 | 4 | import java.util.Arrays; |
7 | 5 | |
8 | | -import javax.sql.DataSource; |
9 | | - |
10 | | -import de.brightbyte.util.PersistenceException; |
11 | 6 | import de.brightbyte.wikiword.Corpus; |
12 | | -import de.brightbyte.wikiword.schema.GlobalConceptStoreSchema; |
13 | | -import de.brightbyte.wikiword.store.builder.DatabaseGlobalConceptStoreBuilder; |
14 | 7 | import de.brightbyte.wikiword.store.builder.GlobalConceptStoreBuilder; |
15 | 8 | |
16 | 9 | /** |
— | — | @@ -17,7 +10,7 @@ |
18 | 11 | * ImportDump can be invoked as a standalone program, use --help as a |
19 | 12 | * command line parameter for usage information. |
20 | 13 | */ |
21 | | -public class BuildThesaurus extends ImportApp<GlobalConceptStoreBuilder> { |
| 14 | +public class BuildThesaurus extends ImportApp { |
22 | 15 | |
23 | 16 | private Corpus[] languages; |
24 | 17 | |
— | — | @@ -35,7 +28,7 @@ |
36 | 29 | args.declare("languages", null, true, String.class, "languages to combine into the thesaurus. If omitted, all available data-sets will be used."); |
37 | 30 | } |
38 | 31 | |
39 | | - @Override |
| 32 | + /*@Override |
40 | 33 | protected GlobalConceptStoreBuilder createStore(DataSource db) throws PersistenceException {... |
41 | 34 | try { |
42 | 35 | String lang = args.getStringOption("languages", null); |
— | — | @@ -67,7 +60,7 @@ |
68 | 61 | } catch (SQLException e) { |
69 | 62 | throw new PersistenceException(e); |
70 | 63 | } |
71 | | - } |
| 64 | + }*/ |
72 | 65 | |
73 | 66 | |
74 | 67 | @Override |
— | — | @@ -76,13 +69,13 @@ |
77 | 70 | info("Using languages: "+Arrays.toString(languages)); |
78 | 71 | |
79 | 72 | if (agenda.beginTask("BuildThesaurus.run", "importConcepts")) { |
80 | | - ((GlobalConceptStoreBuilder)this.store).importConcepts(); |
| 73 | + ((GlobalConceptStoreBuilder)this.conceptStore).importConcepts(); |
81 | 74 | agenda.endTask("BuildThesaurus.run", "importConcepts"); |
82 | 75 | } |
83 | 76 | |
84 | 77 | section("-- buildGlobalConcepts --------------------------------------------------"); |
85 | 78 | if (agenda.beginTask("BuildThesaurus.run", "buildGlobalConcepts")) { |
86 | | - ((GlobalConceptStoreBuilder)this.store).buildGlobalConcepts(); |
| 79 | + ((GlobalConceptStoreBuilder)this.conceptStore).buildGlobalConcepts(); |
87 | 80 | agenda.endTask("BuildThesaurus.run", "buildGlobalConcepts"); |
88 | 81 | } |
89 | 82 | |
— | — | @@ -95,7 +88,7 @@ |
96 | 89 | */ |
97 | 90 | |
98 | 91 | section("-- statistics --------------------------------------------------"); |
99 | | - this.store.dumpTableStats(getLogOutput()); |
| 92 | + dumpTableStats(); |
100 | 93 | } |
101 | 94 | |
102 | 95 | public static void main(String[] argv) throws Exception { |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/builder/ImportConcepts.java |
— | — | @@ -1,14 +1,13 @@ |
2 | 2 | package de.brightbyte.wikiword.builder; |
3 | 3 | |
4 | | -import java.sql.SQLException; |
| 4 | +import java.io.IOException; |
5 | 5 | |
6 | | -import javax.sql.DataSource; |
7 | | - |
8 | 6 | import de.brightbyte.util.PersistenceException; |
9 | | -import de.brightbyte.wikiword.TweakSet; |
10 | 7 | import de.brightbyte.wikiword.analyzer.WikiTextAnalyzer; |
11 | | -import de.brightbyte.wikiword.store.builder.DatabaseLocalConceptStoreBuilder; |
| 8 | +import de.brightbyte.wikiword.store.WikiWordStoreFactory; |
12 | 9 | import de.brightbyte.wikiword.store.builder.LocalConceptStoreBuilder; |
| 10 | +import de.brightbyte.wikiword.store.builder.PropertyStoreBuilder; |
| 11 | +import de.brightbyte.wikiword.store.builder.TextStoreBuilder; |
13 | 12 | |
14 | 13 | /** |
15 | 14 | * This is the primary entry point to the first phase of a WikiWord analysis. |
— | — | @@ -17,14 +16,28 @@ |
18 | 17 | */ |
19 | 18 | public class ImportConcepts extends ImportDump<LocalConceptStoreBuilder> { |
20 | 19 | |
| 20 | + private PropertyStoreBuilder propertyStore; |
| 21 | + private TextStoreBuilder textStore; |
| 22 | + |
21 | 23 | public ImportConcepts() { |
22 | 24 | super("ImportDump"); |
23 | 25 | } |
24 | 26 | |
25 | 27 | @Override |
26 | | - protected ConceptImporter newImporter(WikiTextAnalyzer analyzer, LocalConceptStoreBuilder store, TweakSet tweaks) throws PersistenceException { |
27 | | - return new ConceptImporter(analyzer, store, tweaks); |
| 28 | + protected void createStores(WikiWordStoreFactory<? extends LocalConceptStoreBuilder> factory) throws IOException, PersistenceException { |
| 29 | + super.createStores(factory); |
| 30 | + |
| 31 | + textStore = conceptStore.getTextStoreBuilder(); |
| 32 | + registerStore(textStore); |
| 33 | + |
| 34 | + propertyStore = conceptStore.getPropertyStoreBuilder(); |
| 35 | + registerStore(propertyStore); |
28 | 36 | } |
| 37 | + |
| 38 | + @Override |
| 39 | + protected ConceptImporter newImporter(WikiTextAnalyzer analyzer) throws PersistenceException { |
| 40 | + return new ConceptImporter(analyzer, conceptStore, tweaks); |
| 41 | + } |
29 | 42 | |
30 | 43 | @Override |
31 | 44 | protected void afterImport() throws PersistenceException { |
— | — | @@ -32,15 +45,6 @@ |
33 | 46 | } |
34 | 47 | |
35 | 48 | @Override |
36 | | - protected LocalConceptStoreBuilder createStore(DataSource db) throws PersistenceException { |
37 | | - try { |
38 | | - return new DatabaseLocalConceptStoreBuilder(getCorpus(), db, tweaks); |
39 | | - } catch (SQLException e) { |
40 | | - throw new PersistenceException(e); |
41 | | - } |
42 | | - } |
43 | | - |
44 | | - @Override |
45 | 49 | protected boolean getDropWarnings() { |
46 | 50 | return true; |
47 | 51 | } |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/builder/WalkCats.java |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | import de.brightbyte.wikiword.store.builder.DatabaseWikiWordConceptStoreBuilder; |
5 | 5 | import de.brightbyte.wikiword.store.builder.WikiWordConceptStoreBuilder; |
6 | 6 | |
7 | | -public class WalkCats extends ImportApp<WikiWordConceptStoreBuilder> { |
| 7 | +public class WalkCats extends ImportApp { |
8 | 8 | |
9 | 9 | public WalkCats() { |
10 | 10 | super(null, true, true); |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/builder/BuildStatistics.java |
— | — | @@ -1,8 +1,10 @@ |
2 | 2 | package de.brightbyte.wikiword.builder; |
3 | 3 | |
4 | | -import javax.sql.DataSource; |
| 4 | +import java.io.IOException; |
5 | 5 | |
6 | 6 | import de.brightbyte.util.PersistenceException; |
| 7 | +import de.brightbyte.wikiword.model.WikiWordConcept; |
| 8 | +import de.brightbyte.wikiword.store.WikiWordStoreFactory; |
7 | 9 | import de.brightbyte.wikiword.store.builder.StatisticsStoreBuilder; |
8 | 10 | import de.brightbyte.wikiword.store.builder.WikiWordConceptStoreBuilder; |
9 | 11 | |
— | — | @@ -11,8 +13,10 @@ |
12 | 14 | * ImportDump can be invoked as a standalone program, use --help as a |
13 | 15 | * command line parameter for usage information. |
14 | 16 | */ |
15 | | -public class BuildStatistics extends ImportApp<StatisticsStoreBuilder> { |
| 17 | +public class BuildStatistics extends ImportApp<WikiWordConceptStoreBuilder<? extends WikiWordConcept>> { |
16 | 18 | |
| 19 | + protected StatisticsStoreBuilder statisticsStore; |
| 20 | + |
17 | 21 | public BuildStatistics() { |
18 | 22 | super("BuildStatistics", true, true); |
19 | 23 | } |
— | — | @@ -24,16 +28,19 @@ |
25 | 29 | |
26 | 30 | protected WikiWordConceptStoreBuilder<?> conceptStore; |
27 | 31 | |
| 32 | + |
28 | 33 | @Override |
29 | | - protected StatisticsStoreBuilder createStore(DataSource db) throws PersistenceException { |
30 | | - conceptStore = createConceptStoreBuilder(db); |
31 | | - return conceptStore.getStatisticsStoreBuilder();... |
| 34 | + protected void createStores(WikiWordStoreFactory<? extends WikiWordConceptStoreBuilder<? extends WikiWordConcept>> factory) throws IOException, PersistenceException { |
| 35 | + super.createStores(factory); |
| 36 | + |
| 37 | + statisticsStore = conceptStore.getStatisticsStoreBuilder(); |
| 38 | + registerStore(statisticsStore); |
32 | 39 | } |
33 | 40 | |
34 | 41 | @Override |
35 | 42 | protected void run() throws Exception { |
36 | 43 | section("-- buildstats --------------------------------------------------"); |
37 | | - this.store.buildStatistics(); |
| 44 | + this.statisticsStore.buildStatistics(); |
38 | 45 | |
39 | 46 | section("-- statistics --------------------------------------------------"); |
40 | 47 | conceptStore.getConceptStore().getStatisticsStore().dumpStatistics(getLogOutput()); |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/builder/ImportApp.java |
— | — | @@ -5,14 +5,14 @@ |
6 | 6 | |
7 | 7 | import java.io.IOException; |
8 | 8 | |
9 | | -import javax.sql.DataSource; |
10 | | - |
11 | 9 | import de.brightbyte.application.Agenda; |
12 | 10 | import de.brightbyte.application.Agenda.Monitor; |
13 | 11 | import de.brightbyte.io.Prompt; |
14 | 12 | import de.brightbyte.util.PersistenceException; |
15 | 13 | import de.brightbyte.wikiword.CliApp; |
16 | 14 | import de.brightbyte.wikiword.model.WikiWordConcept; |
| 15 | +import de.brightbyte.wikiword.store.WikiWordStore; |
| 16 | +import de.brightbyte.wikiword.store.WikiWordStoreFactory; |
17 | 17 | import de.brightbyte.wikiword.store.builder.DatabaseConceptStoreBuilders; |
18 | 18 | import de.brightbyte.wikiword.store.builder.WikiWordConceptStoreBuilder; |
19 | 19 | import de.brightbyte.wikiword.store.builder.WikiWordStoreBuilder; |
— | — | @@ -20,7 +20,7 @@ |
21 | 21 | /** |
22 | 22 | * This is the base class for entry points to WikiWord. |
23 | 23 | */ |
24 | | -public abstract class ImportApp<S extends WikiWordStoreBuilder> extends CliApp<S> { |
| 24 | +public abstract class ImportApp<S extends WikiWordConceptStoreBuilder<? extends WikiWordConcept>> extends CliApp<S> { |
25 | 25 | |
26 | 26 | protected static enum Operation { |
27 | 27 | FRESH, |
— | — | @@ -41,8 +41,10 @@ |
42 | 42 | this.useAgenda = agendaTask != null; |
43 | 43 | } |
44 | 44 | |
45 | | - protected WikiWordConceptStoreBuilder<? extends WikiWordConcept> createConceptStoreBuilder(DataSource db) throws PersistenceException { |
46 | | - return DatabaseConceptStoreBuilders.createConceptStoreBuilder(db, dataset, tweaks, allowLocalStore, allowGlobalStore); |
| 45 | + @SuppressWarnings("unchecked") |
| 46 | + @Override |
| 47 | + protected WikiWordStoreFactory<S> createConceptStoreFactory() throws IOException, PersistenceException { |
| 48 | + return new DatabaseConceptStoreBuilders.Factory(getConfiguredDataSource(), getConfiguredDataset(), tweaks, true, true); |
47 | 49 | } |
48 | 50 | |
49 | 51 | @Override |
— | — | @@ -67,19 +69,6 @@ |
68 | 70 | } |
69 | 71 | } |
70 | 72 | |
71 | | - @Override |
72 | | - protected S createStore() throws IOException, PersistenceException { |
73 | | - S store = super.createStore(); |
74 | | - store.setLogLevel(logLevel); |
75 | | - return store; |
76 | | - } |
77 | | - |
78 | | - @SuppressWarnings("unchecked") |
79 | | - @Override |
80 | | - protected S createStore(DataSource db) throws PersistenceException { |
81 | | - return (S)createConceptStoreBuilder(db); |
82 | | - } |
83 | | - |
84 | 73 | public void setAgendaMonitor(Agenda.Monitor monitor) { |
85 | 74 | this.agendaMonitor = monitor; |
86 | 75 | } |
— | — | @@ -240,7 +229,25 @@ |
241 | 230 | } |
242 | 231 | */ |
243 | 232 | } |
| 233 | + |
| 234 | + protected void initializeStores(boolean purge, boolean dropWarnings) throws PersistenceException { |
| 235 | + for (WikiWordStore store: stores) { |
| 236 | + ((WikiWordStoreBuilder)store).initialize(purge, dropWarnings); //XXX: ugly cast! |
| 237 | + } |
| 238 | + } |
244 | 239 | |
| 240 | + protected void optimizeStores() throws PersistenceException { |
| 241 | + for (WikiWordStore store: stores) { |
| 242 | + ((WikiWordStoreBuilder)store).optimize(); //XXX: ugly cast! |
| 243 | + } |
| 244 | + } |
| 245 | + |
| 246 | + protected void checkStores() throws PersistenceException { |
| 247 | + for (WikiWordStore store: stores) { |
| 248 | + ((WikiWordStoreBuilder)store).checkConsistency(); //XXX: ugly cast! |
| 249 | + } |
| 250 | + } |
| 251 | + |
245 | 252 | @Override |
246 | 253 | protected void execute() throws Exception { |
247 | 254 | boolean noimport = args.isSet("noimport"); |
— | — | @@ -250,17 +257,16 @@ |
251 | 258 | |
252 | 259 | if (!noimport) { |
253 | 260 | if (useAgenda) { |
254 | | - agenda = store.getAgenda(); |
| 261 | + agenda = conceptStore.getAgenda(); |
255 | 262 | initAgenda(agenda); |
256 | 263 | } |
257 | 264 | |
258 | 265 | if (operation == Operation.FRESH) { |
259 | 266 | section("-- purge --------------------------------------------------"); |
260 | | - store.initialize(true, getDropWarnings()); //FIXME: don't purge warning always... but when?! |
261 | | - ...all stores... |
| 267 | + initializeStores(true, getDropWarnings()); //FIXME: don't purge warning always... but when?! |
262 | 268 | } |
263 | 269 | else { |
264 | | - store.initialize(false, getDropWarnings()); |
| 270 | + initializeStores(false, getDropWarnings()); |
265 | 271 | } |
266 | 272 | |
267 | 273 | if (!useAgenda || agenda.beginTask("ImportApp.launch", agendaTask)) { |
— | — | @@ -271,26 +277,26 @@ |
272 | 278 | |
273 | 279 | if (dbstats) { |
274 | 280 | section("-- dbstats --------------------------------------------------"); |
275 | | - store.dumpTableStats(out); |
| 281 | + dumpTableStats(); |
276 | 282 | |
277 | | - int w = store.getNumberOfWarnings(); |
| 283 | + int w = conceptStore.getNumberOfWarnings(); |
278 | 284 | if (w==0) info("no warnings"); |
279 | 285 | else warn("WARNINGS: "+w); |
280 | 286 | } |
281 | 287 | |
282 | 288 | if (dbcheck) { |
283 | 289 | section("-- check --------------------------------------------------"); |
284 | | - store.checkConsistency(); |
| 290 | + checkStores(); |
285 | 291 | info("OK."); |
286 | 292 | |
287 | | - int w = store.getNumberOfWarnings(); |
| 293 | + int w = conceptStore.getNumberOfWarnings(); |
288 | 294 | if (w==0) info("no warnings"); |
289 | 295 | else warn("WARNINGS: "+w); |
290 | 296 | } |
291 | 297 | |
292 | 298 | if (optimize) { |
293 | 299 | section("-- optimize --------------------------------------------------"); |
294 | | - store.optimize(); |
| 300 | + optimizeStores(); |
295 | 301 | } |
296 | 302 | } |
297 | 303 | |
— | — | @@ -298,10 +304,6 @@ |
299 | 305 | return false; |
300 | 306 | } |
301 | 307 | |
302 | | - public void checkConsistency() throws PersistenceException { |
303 | | - store.checkConsistency(); |
304 | | - } |
305 | | - |
306 | 308 | public int getExitCode() { |
307 | 309 | return exitCode; |
308 | 310 | } |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/builder/ExtractText.java |
— | — | @@ -1,31 +1,34 @@ |
2 | 2 | package de.brightbyte.wikiword.builder; |
3 | 3 | |
4 | | -import java.io.BufferedOutputStream; |
5 | | -import java.io.File; |
6 | | -import java.io.FileOutputStream; |
7 | 4 | import java.io.IOException; |
8 | | -import java.io.OutputStream; |
9 | | -import java.sql.SQLException; |
10 | 5 | |
11 | | -import javax.sql.DataSource; |
12 | | - |
13 | 6 | import de.brightbyte.util.PersistenceException; |
14 | | -import de.brightbyte.wikiword.TweakSet; |
15 | 7 | import de.brightbyte.wikiword.analyzer.WikiTextAnalyzer; |
16 | | -import de.brightbyte.wikiword.store.builder.DatabaseTextStoreBuilder; |
17 | | -import de.brightbyte.wikiword.store.builder.PlainTextOutput; |
| 8 | +import de.brightbyte.wikiword.store.WikiWordStoreFactory; |
| 9 | +import de.brightbyte.wikiword.store.builder.LocalConceptStoreBuilder; |
18 | 10 | import de.brightbyte.wikiword.store.builder.TextStoreBuilder; |
19 | 11 | |
20 | | -public class ExtractText extends ImportDump<TextStoreBuilder> { |
| 12 | +public class ExtractText extends ImportDump<LocalConceptStoreBuilder> { |
21 | 13 | |
| 14 | + private TextStoreBuilder textStore; |
| 15 | + |
22 | 16 | public ExtractText() { |
23 | 17 | super("ExtractText"); |
24 | 18 | } |
25 | 19 | |
| 20 | + |
26 | 21 | @Override |
27 | | - protected TextImporter newImporter(WikiTextAnalyzer analyzer, TextStoreBuilder store, TweakSet tweaks) { |
28 | | - return new TextImporter(analyzer, (TextStoreBuilder)store, tweaks); |
| 22 | + protected void createStores(WikiWordStoreFactory<? extends LocalConceptStoreBuilder> factory) throws IOException, PersistenceException { |
| 23 | + super.createStores(factory); |
| 24 | + |
| 25 | + textStore = conceptStore.getTextStoreBuilder(); |
| 26 | + registerStore(textStore); |
29 | 27 | } |
| 28 | + |
| 29 | + @Override |
| 30 | + protected TextImporter newImporter(WikiTextAnalyzer analyzer) { |
| 31 | + return new TextImporter(analyzer, textStore, tweaks); |
| 32 | + } |
30 | 33 | |
31 | 34 | @Override |
32 | 35 | protected void declareOptions() { |
— | — | @@ -38,7 +41,7 @@ |
39 | 42 | "guessed from, the <wiki-or-dump> parameter)"); |
40 | 43 | } |
41 | 44 | |
42 | | - @Override |
| 45 | + /*@Override |
43 | 46 | protected TextStoreBuilder createStore() throws IOException, PersistenceException {... |
44 | 47 | if (args.isSet("stream")) { |
45 | 48 | String n = args.getOption("stream", null); |
— | — | @@ -67,7 +70,7 @@ |
68 | 71 | } catch (SQLException e) { |
69 | 72 | throw new PersistenceException(e); |
70 | 73 | } |
71 | | - } |
| 74 | + }*/ |
72 | 75 | |
73 | 76 | public static void main(String[] argv) throws Exception { |
74 | 77 | ExtractText app = new ExtractText(); |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/builder/BuildConceptInfo.java |
— | — | @@ -1,21 +1,33 @@ |
2 | 2 | package de.brightbyte.wikiword.builder; |
3 | 3 | |
4 | | -import javax.sql.DataSource; |
| 4 | +import java.io.IOException; |
5 | 5 | |
6 | 6 | import de.brightbyte.util.PersistenceException; |
7 | 7 | import de.brightbyte.wikiword.model.WikiWordConcept; |
| 8 | +import de.brightbyte.wikiword.store.WikiWordStoreFactory; |
8 | 9 | import de.brightbyte.wikiword.store.builder.ConceptInfoStoreBuilder; |
| 10 | +import de.brightbyte.wikiword.store.builder.WikiWordConceptStoreBuilder; |
9 | 11 | |
10 | 12 | /** |
11 | 13 | * This is the primary entry point to the first phase of a WikiWord analysis. |
12 | 14 | * ImportDump can be invoked as a standalone program, use --help as a |
13 | 15 | * command line parameter for usage information. |
14 | 16 | */ |
15 | | -public class BuildConceptInfo extends ImportApp<ConceptInfoStoreBuilder<? extends WikiWordConcept>> { |
| 17 | +public class BuildConceptInfo extends ImportApp<WikiWordConceptStoreBuilder<? extends WikiWordConcept>> { |
16 | 18 | |
| 19 | + protected ConceptInfoStoreBuilder infoStore; |
| 20 | + |
17 | 21 | public BuildConceptInfo() { |
18 | 22 | super("BuildConceptInfo", true, true); |
19 | 23 | } |
| 24 | + |
| 25 | + @Override |
| 26 | + protected void createStores(WikiWordStoreFactory<? extends WikiWordConceptStoreBuilder<? extends WikiWordConcept>> factory) throws IOException, PersistenceException { |
| 27 | + super.createStores(factory); |
| 28 | + |
| 29 | + infoStore = conceptStore.getConceptInfoStoreBuilder(); |
| 30 | + registerStore(infoStore); |
| 31 | + } |
20 | 32 | |
21 | 33 | @Override |
22 | 34 | protected void declareOptions() { |
— | — | @@ -27,14 +39,9 @@ |
28 | 40 | } |
29 | 41 | |
30 | 42 | @Override |
31 | | - protected ConceptInfoStoreBuilder<? extends WikiWordConcept> createStore(DataSource db) throws PersistenceException { |
32 | | - return createConceptStoreBuilder(db).getConceptInfoStoreBuilder(); ... |
33 | | - } |
34 | | - |
35 | | - @Override |
36 | 43 | protected void run() throws Exception { |
37 | 44 | section("-- build info --------------------------------------------------"); |
38 | | - this.store.buildConceptInfo(); |
| 45 | + this.infoStore.buildConceptInfo(); |
39 | 46 | } |
40 | 47 | |
41 | 48 | public static void main(String[] argv) throws Exception { |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/builder/ExtractProperties.java |
— | — | @@ -1,27 +1,35 @@ |
2 | 2 | package de.brightbyte.wikiword.builder; |
3 | 3 | |
4 | | -import java.sql.SQLException; |
| 4 | +import java.io.IOException; |
5 | 5 | |
6 | | -import javax.sql.DataSource; |
7 | | - |
8 | 6 | import de.brightbyte.util.PersistenceException; |
9 | | -import de.brightbyte.wikiword.TweakSet; |
10 | 7 | import de.brightbyte.wikiword.analyzer.WikiTextAnalyzer; |
11 | | -import de.brightbyte.wikiword.store.builder.DatabaseLocalConceptStoreBuilder; |
| 8 | +import de.brightbyte.wikiword.store.WikiWordStoreFactory; |
12 | 9 | import de.brightbyte.wikiword.store.builder.LocalConceptStoreBuilder; |
| 10 | +import de.brightbyte.wikiword.store.builder.PropertyStoreBuilder; |
13 | 11 | |
14 | 12 | public class ExtractProperties extends ImportDump<LocalConceptStoreBuilder> { |
15 | 13 | |
| 14 | + private PropertyStoreBuilder propertyStore; |
| 15 | + |
16 | 16 | public ExtractProperties() { |
17 | 17 | super("ExtractProperties"); |
18 | 18 | } |
19 | 19 | |
20 | 20 | @Override |
21 | | - protected PropertyImporter newImporter(WikiTextAnalyzer analyzer, LocalConceptStoreBuilder store, TweakSet tweaks) throws PersistenceException { |
22 | | - return new PropertyImporter(analyzer, store, tweaks); |
| 21 | + protected void createStores(WikiWordStoreFactory<? extends LocalConceptStoreBuilder> factory) throws IOException, PersistenceException { |
| 22 | + super.createStores(factory); |
| 23 | + |
| 24 | + propertyStore = conceptStore.getPropertyStoreBuilder(); |
| 25 | + registerStore(propertyStore); |
23 | 26 | } |
24 | 27 | |
25 | 28 | @Override |
| 29 | + protected PropertyImporter newImporter(WikiTextAnalyzer analyzer) throws PersistenceException { |
| 30 | + return new PropertyImporter(analyzer, conceptStore, tweaks); |
| 31 | + } |
| 32 | + |
| 33 | + @Override |
26 | 34 | protected void declareOptions() { |
27 | 35 | super.declareOptions(); |
28 | 36 | |
— | — | @@ -57,15 +65,6 @@ |
58 | 66 | } |
59 | 67 | */ |
60 | 68 | |
61 | | - @Override |
62 | | - protected LocalConceptStoreBuilder createStore(DataSource db) throws PersistenceException { |
63 | | - try { |
64 | | - return new DatabaseLocalConceptStoreBuilder(getCorpus(), db, tweaks); |
65 | | - } catch (SQLException e) { |
66 | | - throw new PersistenceException(e); |
67 | | - } |
68 | | - } |
69 | | - |
70 | 69 | public static void main(String[] argv) throws Exception { |
71 | 70 | ExtractProperties app = new ExtractProperties(); |
72 | 71 | app.launch(argv); |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseConceptStoreBuilders.java |
— | — | @@ -11,9 +11,32 @@ |
12 | 12 | import de.brightbyte.wikiword.TweakSet; |
13 | 13 | import de.brightbyte.wikiword.model.WikiWordConcept; |
14 | 14 | import de.brightbyte.wikiword.schema.WikiWordStoreSchema; |
| 15 | +import de.brightbyte.wikiword.store.WikiWordStoreFactory; |
15 | 16 | |
16 | 17 | public class DatabaseConceptStoreBuilders { |
17 | 18 | |
| 19 | + public static class Factory<C extends WikiWordConcept> implements WikiWordStoreFactory<DatabaseWikiWordConceptStoreBuilder<C>> { |
| 20 | + private DataSource db; |
| 21 | + private DatasetIdentifier dataset; |
| 22 | + private TweakSet tweaks; |
| 23 | + private boolean allowCorpus; |
| 24 | + private boolean allowThesaurus; |
| 25 | + |
| 26 | + public Factory(DataSource db, DatasetIdentifier dataset, TweakSet tweaks, boolean allowCorpus, boolean allowThesaurus) { |
| 27 | + super(); |
| 28 | + this.db = db; |
| 29 | + this.dataset = dataset; |
| 30 | + this.tweaks = tweaks; |
| 31 | + this.allowCorpus = allowCorpus; |
| 32 | + this.allowThesaurus = allowThesaurus; |
| 33 | + } |
| 34 | + |
| 35 | + @SuppressWarnings("unchecked") |
| 36 | + public DatabaseWikiWordConceptStoreBuilder<C> newStore() throws PersistenceException { |
| 37 | + return (DatabaseWikiWordConceptStoreBuilder<C>)createConceptStoreBuilder(db, dataset, tweaks, allowCorpus, allowThesaurus); |
| 38 | + } |
| 39 | + } |
| 40 | + |
18 | 41 | public static DatabaseWikiWordConceptStoreBuilder<? extends WikiWordConcept> createConceptStoreBuilder(DataSource db, DatasetIdentifier dataset, TweakSet tweaks, boolean allowCorpus, boolean allowThesaurus) throws PersistenceException { |
19 | 42 | //XXX: UGLY HACK! |
20 | 43 | try { |
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/WikiWordConceptStoreBuilder.java |
— | — | @@ -4,8 +4,9 @@ |
5 | 5 | import de.brightbyte.wikiword.model.WikiWordConcept; |
6 | 6 | import de.brightbyte.wikiword.model.WikiWordConceptReference; |
7 | 7 | import de.brightbyte.wikiword.store.WikiWordConceptStore; |
| 8 | +import de.brightbyte.wikiword.store.WikiWordConceptStoreBase; |
8 | 9 | |
9 | | -public interface WikiWordConceptStoreBuilder<T extends WikiWordConcept> extends WikiWordStoreBuilder { |
| 10 | +public interface WikiWordConceptStoreBuilder<T extends WikiWordConcept> extends WikiWordStoreBuilder, WikiWordConceptStoreBase { |
10 | 11 | |
11 | 12 | public StatisticsStoreBuilder getStatisticsStoreBuilder() throws PersistenceException; |
12 | 13 | public ConceptInfoStoreBuilder<T> getConceptInfoStoreBuilder() throws PersistenceException; |
Index: trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/ConsoleApp.java |
— | — | @@ -7,11 +7,9 @@ |
8 | 8 | |
9 | 9 | import de.brightbyte.io.Prompt; |
10 | 10 | import de.brightbyte.util.PersistenceException; |
11 | | -import de.brightbyte.wikiword.model.WikiWordConcept; |
12 | | -import de.brightbyte.wikiword.model.WikiWordConceptReference; |
13 | | -import de.brightbyte.wikiword.store.WikiWordConceptStore; |
| 11 | +import de.brightbyte.wikiword.store.WikiWordConceptStoreBase; |
14 | 12 | |
15 | | -public abstract class ConsoleApp<C extends WikiWordConcept> extends CliApp< WikiWordConceptStore<C, WikiWordConceptReference<C>> > { |
| 13 | +public abstract class ConsoleApp<S extends WikiWordConceptStoreBase> extends CliApp<S> { |
16 | 14 | |
17 | 15 | protected Prompt prompt; |
18 | 16 | |
Index: trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/CliApp.java |
— | — | @@ -5,6 +5,8 @@ |
6 | 6 | import java.io.File; |
7 | 7 | import java.io.IOException; |
8 | 8 | import java.io.PrintStream; |
| 9 | +import java.util.ArrayList; |
| 10 | +import java.util.Collection; |
9 | 11 | import java.util.List; |
10 | 12 | import java.util.Map; |
11 | 13 | |
— | — | @@ -20,15 +22,16 @@ |
21 | 23 | import de.brightbyte.util.PersistenceException; |
22 | 24 | import de.brightbyte.util.SystemUtils; |
23 | 25 | import de.brightbyte.wikiword.rdf.WikiWordIdentifiers; |
24 | | -import de.brightbyte.wikiword.store.DatabaseConceptStores; |
25 | 26 | import de.brightbyte.wikiword.store.DatabaseWikiWordStore; |
26 | | -import de.brightbyte.wikiword.store.WikiWordConceptStore; |
| 27 | +import de.brightbyte.wikiword.store.WikiWordConceptStoreBase; |
27 | 28 | import de.brightbyte.wikiword.store.WikiWordLocalStore; |
| 29 | +import de.brightbyte.wikiword.store.WikiWordStore; |
| 30 | +import de.brightbyte.wikiword.store.WikiWordStoreFactory; |
28 | 31 | |
29 | 32 | /** |
30 | 33 | * This is the base class for entry points to WikiWord. |
31 | 34 | */ |
32 | | -public abstract class CliApp<S extends WikiWordConceptStore> { |
| 35 | +public abstract class CliApp<S extends WikiWordConceptStoreBase> { |
33 | 36 | |
34 | 37 | public static final String VERSION_INFO = "WikiWord by Daniel Kinzler, brightbyte.de, 2007-2008"; |
35 | 38 | public static final String LICENSE_INFO = "Developed at the University of Leipzig. Free Software, GNU GPL"; |
— | — | @@ -40,6 +43,7 @@ |
41 | 44 | protected int logLevel; |
42 | 45 | protected int exitCode; |
43 | 46 | |
| 47 | + protected List<WikiWordStore> stores = new ArrayList<WikiWordStore>(); |
44 | 48 | protected S conceptStore; |
45 | 49 | //protected DatasetIdentifier dataset; |
46 | 50 | //protected DataSource dataSource; |
— | — | @@ -50,7 +54,9 @@ |
51 | 55 | |
52 | 56 | protected boolean allowLocalStore; |
53 | 57 | protected boolean allowGlobalStore; |
54 | | - |
| 58 | + |
| 59 | + protected WikiWordStoreFactory<? extends S> conceptStoreFactory; |
| 60 | + |
55 | 61 | public CliApp(boolean allowGlobal, boolean allowLocal) { //TODO: agenda-params?! |
56 | 62 | args = new Arguments(); |
57 | 63 | out = new LogOutput(); |
— | — | @@ -59,6 +65,14 @@ |
60 | 66 | allowLocalStore = allowLocal; |
61 | 67 | } |
62 | 68 | |
| 69 | + protected void registerStore(WikiWordStore store) { |
| 70 | + stores.add(store); |
| 71 | + } |
| 72 | + |
| 73 | + protected Collection<WikiWordStore> getStores() { |
| 74 | + return stores; |
| 75 | + } |
| 76 | + |
63 | 77 | public boolean isKeepAlive() { |
64 | 78 | return keepAlive; |
65 | 79 | } |
— | — | @@ -279,7 +293,9 @@ |
280 | 294 | DatasetIdentifier dataset = getConfiguredDataset(); |
281 | 295 | section("*** DATASET: "+dataset.getQName()+" ***"); |
282 | 296 | |
283 | | - createStores(); |
| 297 | + if (conceptStoreFactory==null) conceptStoreFactory= createConceptStoreFactory(); |
| 298 | + |
| 299 | + createStores(conceptStoreFactory); |
284 | 300 | if (conceptStore==null) throw new RuntimeException("createStores() failed to initialize conceptStore"); |
285 | 301 | |
286 | 302 | exitCode = 23; |
— | — | @@ -330,14 +346,26 @@ |
331 | 347 | } |
332 | 348 | } |
333 | 349 | |
| 350 | + protected abstract WikiWordStoreFactory<S> createConceptStoreFactory() throws IOException, PersistenceException; |
| 351 | + |
334 | 352 | protected void openStores() throws PersistenceException { |
335 | | - conceptStore.open(); |
| 353 | + for (WikiWordStore store: stores) { |
| 354 | + store.open(); |
| 355 | + } |
336 | 356 | } |
337 | 357 | |
338 | 358 | protected void closeStores(boolean flush) throws PersistenceException { |
339 | | - conceptStore.close(flush); |
| 359 | + for (WikiWordStore store: stores) { |
| 360 | + store.close(flush); |
| 361 | + } |
340 | 362 | } |
341 | | - |
| 363 | + |
| 364 | + protected void dumpTableStats() throws PersistenceException { |
| 365 | + for (WikiWordStore store: stores) { |
| 366 | + store.dumpTableStats(getLogOutput()); |
| 367 | + } |
| 368 | + } |
| 369 | + |
342 | 370 | protected void prepareApp() throws Exception { |
343 | 371 | // noop |
344 | 372 | } |
— | — | @@ -346,32 +374,16 @@ |
347 | 375 | run(); |
348 | 376 | } |
349 | 377 | |
350 | | - public void setDataSource(DataSource dataSource) { |
351 | | - this.dataSource = dataSource; |
| 378 | + protected DataSource getConfiguredDataSource() throws IOException, PersistenceException { |
| 379 | + File dbf = getDatabaseFile(); |
| 380 | + return new DatabaseConnectionInfo(dbf); |
352 | 381 | } |
353 | 382 | |
354 | | - protected DataSource getDataSource() throws IOException, PersistenceException { |
355 | | - |
| 383 | + protected void createStores(WikiWordStoreFactory<? extends S> factory) throws IOException, PersistenceException { |
| 384 | + conceptStore = factory.newStore(); |
| 385 | + registerStore(conceptStore); |
356 | 386 | } |
357 | | - protected DataSource getDataSource() throws IOException, PersistenceException { |
358 | | - //TODO: make this more abstract. we may not be storing into a DB at all! |
359 | | - if (dataSource==null) { |
360 | | - File dbf = getDatabaseFile(); |
361 | | - dataSource = new DatabaseConnectionInfo(dbf); |
362 | | - } |
363 | | - } |
364 | 387 | |
365 | | - protected void createStores() throws IOException, PersistenceException { |
366 | | - conceptStore = createConceptStore(); |
367 | | - } |
368 | | - |
369 | | - @SuppressWarnings("unchecked") |
370 | | - protected S createConceptStore(DataSource db) throws PersistenceException { |
371 | | - DatasetIdentifier ds = getDataset(); |
372 | | - S store = (S)DatabaseConceptStores.createConceptStore(db, ds, tweaks, allowLocalStore, allowGlobalStore); |
373 | | - return store; |
374 | | - } |
375 | | - |
376 | 388 | protected File getDatabaseFile() { |
377 | 389 | File f = findConfigFile(args, "db"); |
378 | 390 | |
— | — | @@ -479,9 +491,12 @@ |
480 | 492 | //noop |
481 | 493 | } |
482 | 494 | |
483 | | - |
484 | 495 | public void setTweaks(TweakSet tweaks) { |
485 | 496 | this.tweaks = tweaks; |
486 | 497 | } |
| 498 | + |
| 499 | + public void setConceptStoreFactory(WikiWordStoreFactory<? extends S> conceptStoreFactory) { |
| 500 | + this.conceptStoreFactory = conceptStoreFactory; |
| 501 | + } |
487 | 502 | |
488 | 503 | } |
Index: trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/store/DatabaseConceptStores.java |
— | — | @@ -15,6 +15,28 @@ |
16 | 16 | |
17 | 17 | public class DatabaseConceptStores { |
18 | 18 | |
| 19 | + public static class Factory<S extends DatabaseWikiWordConceptStore<? extends WikiWordConcept, ? extends WikiWordConceptReference<? extends WikiWordConcept>>> implements WikiWordStoreFactory<S> { |
| 20 | + private DataSource db; |
| 21 | + private DatasetIdentifier dataset; |
| 22 | + private TweakSet tweaks; |
| 23 | + private boolean allowCorpus; |
| 24 | + private boolean allowThesaurus; |
| 25 | + |
| 26 | + public Factory(DataSource db, DatasetIdentifier dataset, TweakSet tweaks, boolean allowCorpus, boolean allowThesaurus) { |
| 27 | + super(); |
| 28 | + this.db = db; |
| 29 | + this.dataset = dataset; |
| 30 | + this.tweaks = tweaks; |
| 31 | + this.allowCorpus = allowCorpus; |
| 32 | + this.allowThesaurus = allowThesaurus; |
| 33 | + } |
| 34 | + |
| 35 | + @SuppressWarnings("unchecked") |
| 36 | + public S newStore() throws PersistenceException { |
| 37 | + return (S)createConceptStore(db, dataset, tweaks, allowCorpus, allowThesaurus); |
| 38 | + } |
| 39 | + |
| 40 | + } |
19 | 41 | |
20 | 42 | public static DatabaseWikiWordConceptStore<? extends WikiWordConcept, ? extends WikiWordConceptReference<? extends WikiWordConcept>> createConceptStore(DataSource db, DatasetIdentifier dataset, TweakSet tweaks, boolean allowCorpus, boolean allowThesaurus) throws PersistenceException { |
21 | 43 | //XXX: UGLY HACK! |
Index: trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/store/WikiWordConceptStoreBase.java |
— | — | @@ -0,0 +1,5 @@ |
| 2 | +package de.brightbyte.wikiword.store; |
| 3 | + |
| 4 | +public interface WikiWordConceptStoreBase extends WikiWordStore { |
| 5 | + //marker |
| 6 | +} |
Index: trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/store/WikiWordConceptStore.java |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | import de.brightbyte.wikiword.model.WikiWordConceptReference; |
9 | 9 | |
10 | 10 | |
11 | | -public interface WikiWordConceptStore<T extends WikiWordConcept, R extends WikiWordConceptReference<T>> extends WikiWordStore { |
| 11 | +public interface WikiWordConceptStore<T extends WikiWordConcept, R extends WikiWordConceptReference<T>> extends WikiWordConceptStoreBase { |
12 | 12 | |
13 | 13 | public DataSet<? extends R> listAllConcepts() throws PersistenceException; |
14 | 14 | |
Index: trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/store/WikiWordStoreFactory.java |
— | — | @@ -0,0 +1,7 @@ |
| 2 | +package de.brightbyte.wikiword.store; |
| 3 | + |
| 4 | +import de.brightbyte.util.PersistenceException; |
| 5 | + |
| 6 | +public interface WikiWordStoreFactory<S extends WikiWordStore> { |
| 7 | + public S newStore() throws PersistenceException; |
| 8 | +} |
Index: trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/query/QueryConsole.java |
— | — | @@ -11,8 +11,6 @@ |
12 | 12 | import java.util.List; |
13 | 13 | import java.util.Map; |
14 | 14 | |
15 | | -import javax.sql.DataSource; |
16 | | - |
17 | 15 | import de.brightbyte.data.cursor.DataSet; |
18 | 16 | import de.brightbyte.rdf.RdfException; |
19 | 17 | import de.brightbyte.util.PersistenceException; |
— | — | @@ -25,12 +23,13 @@ |
26 | 24 | import de.brightbyte.wikiword.model.WikiWordConcept; |
27 | 25 | import de.brightbyte.wikiword.model.WikiWordConceptReference; |
28 | 26 | import de.brightbyte.wikiword.rdf.RdfOutput; |
| 27 | +import de.brightbyte.wikiword.store.DatabaseConceptStores; |
29 | 28 | import de.brightbyte.wikiword.store.GlobalConceptStore; |
30 | 29 | import de.brightbyte.wikiword.store.LocalConceptStore; |
31 | 30 | import de.brightbyte.wikiword.store.WikiWordConceptStore; |
32 | | -import de.brightbyte.wikiword.store.WikiWordStore; |
| 31 | +import de.brightbyte.wikiword.store.WikiWordStoreFactory; |
33 | 32 | |
34 | | -public class QueryConsole extends ConsoleApp<WikiWordConcept> { |
| 33 | +public class QueryConsole extends ConsoleApp<WikiWordConceptStore> { |
35 | 34 | |
36 | 35 | public QueryConsole() { |
37 | 36 | super(true, true); |
— | — | @@ -321,11 +320,11 @@ |
322 | 321 | } |
323 | 322 | |
324 | 323 | protected GlobalConceptStore getGlobalConceptStore() { |
325 | | - return (GlobalConceptStore)conceptStore; |
| 324 | + return (GlobalConceptStore)(Object)conceptStore; //XXX: FUGLY! generic my ass. |
326 | 325 | } |
327 | 326 | |
328 | 327 | protected LocalConceptStore getLocalConceptStore() { |
329 | | - return (LocalConceptStore)conceptStore; |
| 328 | + return (LocalConceptStore)(Object)conceptStore; //XXX: FUGLY! generic my ass. |
330 | 329 | } |
331 | 330 | |
332 | 331 | public void dumpStats() throws PersistenceException { |
— | — | @@ -391,4 +390,8 @@ |
392 | 391 | q.launch(argv); |
393 | 392 | } |
394 | 393 | |
| 394 | + @Override |
| 395 | + protected WikiWordStoreFactory<WikiWordConceptStore> createConceptStoreFactory() throws IOException, PersistenceException { |
| 396 | + return new DatabaseConceptStores.Factory(getConfiguredDataSource(), getConfiguredDataset(), tweaks, true, true); |
| 397 | + } |
395 | 398 | } |
Index: trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/rdf/ExportRdf.java |
— | — | @@ -29,15 +29,19 @@ |
30 | 30 | import de.brightbyte.wikiword.Corpus; |
31 | 31 | import de.brightbyte.wikiword.DatasetIdentifier; |
32 | 32 | import de.brightbyte.wikiword.ExtractionRule; |
| 33 | +import de.brightbyte.wikiword.model.WikiWordConcept; |
| 34 | +import de.brightbyte.wikiword.model.WikiWordConceptReference; |
33 | 35 | import de.brightbyte.wikiword.schema.GlobalConceptStoreSchema; |
34 | 36 | import de.brightbyte.wikiword.schema.LocalConceptStoreSchema; |
35 | 37 | import de.brightbyte.wikiword.schema.StatisticsStoreSchema; |
36 | 38 | import de.brightbyte.wikiword.schema.WikiWordConceptStoreSchema; |
37 | 39 | import de.brightbyte.wikiword.schema.WikiWordStoreSchema; |
| 40 | +import de.brightbyte.wikiword.store.DatabaseConceptStores; |
38 | 41 | import de.brightbyte.wikiword.store.DatabaseGlobalConceptStore; |
39 | 42 | import de.brightbyte.wikiword.store.DatabaseLocalConceptStore; |
40 | 43 | import de.brightbyte.wikiword.store.DatabaseWikiWordConceptStore; |
41 | 44 | import de.brightbyte.wikiword.store.WikiWordConceptStore; |
| 45 | +import de.brightbyte.wikiword.store.WikiWordStoreFactory; |
42 | 46 | import de.brightbyte.wikiword.store.DatabaseWikiWordConceptStore.DatabaseStatisticsStore; |
43 | 47 | |
44 | 48 | public class ExportRdf<V, R extends V, A, W> extends CliApp<WikiWordConceptStore> { |
— | — | @@ -961,6 +965,12 @@ |
962 | 966 | this.plainSkos = plainSkos; |
963 | 967 | } |
964 | 968 | |
| 969 | + |
| 970 | + @Override |
| 971 | + protected WikiWordStoreFactory<WikiWordConceptStore> createConceptStoreFactory() throws IOException, PersistenceException { |
| 972 | + return new DatabaseConceptStores.Factory(getConfiguredDataSource(), getConfiguredDataset(), tweaks, true, true); |
| 973 | + } |
| 974 | + |
965 | 975 | public static void main(String[] argv) throws Exception { |
966 | 976 | ExportRdf app = new ExportRdf(); |
967 | 977 | app.launch(argv); |