r64319 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64318‎ | r64319 | r64320 >
Date:22:20, 28 March 2010
Author:daniel
Status:deferred
Tags:
Comment:
use ConceptQuerySpec for dynamic query building
Modified paths:
  • /trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/disambig/StoredMeaningFetcher.java (modified) (history)
  • /trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/model/GlobalConcept.java (modified) (history)
  • /trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/query/QueryConsole.java (modified) (history)
  • /trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/store/DatabaseGlobalConceptStore.java (modified) (history)
  • /trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/store/DatabaseLocalConceptStore.java (modified) (history)
  • /trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/store/DatabaseWikiWordConceptStore.java (modified) (history)
  • /trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/store/GlobalConceptStore.java (modified) (history)
  • /trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/store/LocalConceptStore.java (modified) (history)
  • /trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/store/StatisticsStore.java (modified) (history)
  • /trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/store/WikiWordConceptStore.java (modified) (history)

Diff [purge]

Index: trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/disambig/StoredMeaningFetcher.java
@@ -4,27 +4,27 @@
55
66 import de.brightbyte.data.cursor.DataSet;
77 import de.brightbyte.util.PersistenceException;
8 -import de.brightbyte.wikiword.ConceptType;
98 import de.brightbyte.wikiword.model.LocalConcept;
109 import de.brightbyte.wikiword.store.LocalConceptStore;
 10+import de.brightbyte.wikiword.store.WikiWordConceptStore.ConceptQuerySpec;
1111
1212 public class StoredMeaningFetcher implements MeaningFetcher<LocalConcept> {
1313 protected LocalConceptStore store;
14 - protected ConceptType type;
 14+ protected ConceptQuerySpec spec;
1515
1616 public StoredMeaningFetcher(LocalConceptStore store) {
1717 this(store, null);
1818 }
1919
20 - public StoredMeaningFetcher(LocalConceptStore store, ConceptType type) {
 20+ public StoredMeaningFetcher(LocalConceptStore store, ConceptQuerySpec type) {
2121 if (store==null) throw new NullPointerException();
2222
2323 this.store = store;
24 - this.type = type;
 24+ this.spec = type;
2525 }
2626
2727 public List<LocalConcept> getMeanings(String term) throws PersistenceException {
28 - DataSet<LocalConcept> m = store.getMeanings(term, type); //FIXME: filter/cut-off rules, sort order! //XXX: relevance value?
 28+ DataSet<LocalConcept> m = store.getMeanings(term, spec); //FIXME: filter/cut-off rules, sort order! //XXX: relevance value?
2929 return m.load();
3030 }
3131
Index: trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/store/StatisticsStore.java
@@ -21,7 +21,7 @@
2222 * it's interpreted as a percentage of the total number of concepts.
2323 * @return a random concept from the range specified by the top argument.
2424 */
25 - public T pickRandomConcept(int top)
 25+ public T pickRandomConcept(int top, WikiWordConceptStore.ConceptQuerySpec spec)
2626 throws PersistenceException;
2727
2828 }
Index: trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/store/DatabaseLocalConceptStore.java
@@ -116,10 +116,10 @@
117117 */
118118 }
119119
120 - protected String meaningWhere(String term, ConceptType t) {
 120+ protected String meaningWhere(String term, ConceptQuerySpec spec) {
121121 String sql = " JOIN "+meaningTable.getSQLName()+" as M ON C.id = M.concept ";
122122 sql += " WHERE M.term_text = "+database.quoteString(term)+" ";
123 - if (t!=null) sql += " AND C.type = "+t.getCode()+" ";
 123+ if (spec!=null && spec.getRequireType()!=null) sql += " AND C.type = "+spec.getRequireType().getCode()+" ";
124124 sql += " ORDER BY freq DESC";
125125 return sql;
126126 }
@@ -145,30 +145,24 @@
146146 return corpus;
147147 }
148148
149 - public DataSet<LocalConcept> listMeanings(String term) throws PersistenceException {
150 - return this.listMeanings(term, null);
151 - }
152 -
 149+ /*
153150 public DataSet<LocalConcept> listMeanings(String term, ConceptType t)
154151 throws PersistenceException {
155152
156 - String sql = referenceSelect("M.freq") + meaningWhere(term, t);
 153+ String sql = conceptSelect("M.freq") + meaningWhere(term, t);
157154
158155 return new QueryDataSet<LocalConcept>(database, getRowConceptFactory(), "listMeanings", sql, false);
159156 }
160 -
161 - public LocalConcept getConceptByName(String name) throws PersistenceException {
162 - return ((DatabaseLocalConceptInfoStore)getConceptInfoStore()).getConceptByName(name);
 157+ */
 158+
 159+ public LocalConcept getConceptByName(String name, ConceptQuerySpec spec) throws PersistenceException {
 160+ return ((DatabaseLocalConceptInfoStore)getConceptInfoStore()).getConceptByName(name, spec);
163161 }
164162
165 - public DataSet<LocalConcept> getMeanings(String term) throws PersistenceException {
166 - return ((DatabaseLocalConceptInfoStore)getConceptInfoStore()).getMeanings(term);
 163+ public DataSet<LocalConcept> getMeanings(String term, ConceptQuerySpec spec) throws PersistenceException {
 164+ return ((DatabaseLocalConceptInfoStore)getConceptInfoStore()).getMeanings(term, spec);
167165 }
168166
169 - public DataSet<LocalConcept> getMeanings(String term, ConceptType t) throws PersistenceException {
170 - return ((DatabaseLocalConceptInfoStore)getConceptInfoStore()).getMeanings(term, t);
171 - }
172 -
173167 public TermReference pickRandomTerm(int top) throws PersistenceException {
174168 return ((LocalStatisticsStore<LocalConcept>)getStatisticsStore()).pickRandomTerm(top);
175169 }
@@ -269,30 +263,56 @@
270264 }
271265
272266 @Override
273 - protected String conceptSelect(String card, String relev, boolean useDistrib) {
274 - String distribJoin = !useDistrib ? "" : " JOIN " + database.getSQLTableName("degree", true) + " as DT ON DT.concept = C.id";
 267+ protected String conceptSelect(ConceptQuerySpec spec, String card, String relev) {
 268+ boolean useDistrib = (relev!=null || (spec!=null && spec.getIncludeStatistics())) && areStatsComplete();
275269
276 - String sql = "SELECT C.id as cId, C.name as cName, C.type as cType, " +
277 - " "+card+" as qFreq, "+relev+" as qConf, " +
278 - " R.id as rcId, R.name as rcName, R.type as rcType, " +
279 - " F.definition as fDefinition, " +
280 - " I.inlinks as rInlinks, I.outlinks as rOutlinks, " +
281 - " I.broader as rBroader, I.narrower as rNarrower, I.langlinks as rLanglinks, " +
282 - " I.similar as rSimilar, I.related as rRelated, " +
283 - " D.terms as dTerms" +
284 - " FROM "+conceptTable.getSQLName()+" as C "+
285 - distribJoin+
286 - " LEFT JOIN "+aboutTable.getSQLName()+" as A ON A.concept = C.id "+
287 - " LEFT JOIN "+resourceTable.getSQLName()+" as R ON R.id = A.resource "+
288 - " LEFT JOIN "+definitionTable.getSQLName()+" as F ON F.concept = C.id "+
289 - " LEFT JOIN "+conceptInfoTable.getSQLName()+" as I ON I.concept = C.id "+
290 - " LEFT JOIN "+conceptDescriptionTable.getSQLName()+" as D ON D.concept = C.id ";
 270+ String fields = "C.id as cId, C.name as cName, C.type as cType";
 271+ String tables = ""+conceptTable.getSQLName()+" as C ";
291272
 273+ if (useDistrib) {
 274+ tables += " JOIN " + database.getSQLTableName("degree", true) + " as DT ON DT.concept = C.id ";
 275+ if (relev==null) relev = "DT.idf";
 276+ } else {
 277+ relev = "-1";
 278+ }
 279+
 280+ if (relev==null) relev = "-1";
 281+ if (card==null) card = "-1";
 282+
 283+ fields += ", "+card+" as qFreq, "+relev+" as qConf ";
 284+
 285+ if (spec!=null && spec.getIncludeResource()) {
 286+ fields += ", R.id as rcId, R.name as rcName, R.type as rcType ";
 287+ tables += " LEFT JOIN "+aboutTable.getSQLName()+" as A ON A.concept = C.id "+
 288+ " LEFT JOIN "+resourceTable.getSQLName()+" as R ON R.id = A.resource ";
 289+ }
 290+
 291+ if (spec!=null && spec.getIncludeDefinition()) {
 292+ fields += ", F.definition as fDefinition ";
 293+
 294+ tables += " LEFT JOIN "+definitionTable.getSQLName()+" as F ON F.concept = C.id ";
 295+ }
 296+
 297+ if (spec!=null && spec.getIncludeRelations()) {
 298+ fields += ", I.inlinks as rInlinks, I.outlinks as rOutlinks, " +
 299+ " I.broader as rBroader, I.narrower as rNarrower, I.langlinks as rLanglinks, " +
 300+ " I.similar as rSimilar, I.related as rRelated ";
 301+
 302+ tables += " LEFT JOIN "+conceptInfoTable.getSQLName()+" as I ON I.concept = C.id ";
 303+ }
 304+
 305+ if (spec!=null && spec.getIncludeTerms()) {
 306+ fields += ", D.terms as dTerms";
 307+
 308+ tables += " LEFT JOIN "+conceptDescriptionTable.getSQLName()+" as D ON D.concept = C.id ";
 309+ }
 310+
 311+ String sql = "SELECT " + fields + " FROM " + tables;
292312 return sql;
293313 }
294314
295315 @Override
296 - protected LocalConcept newConcept(Map<String, Object> m) throws PersistenceException {
 316+ protected LocalConcept newConcept(Map<String, Object> m, ConceptQuerySpec spec) throws PersistenceException {
297317 int id = asInt(m.get("cId"));
298318 String name = asString(m.get("cName"));
299319 ConceptType type = corpus.getConceptTypes().getType(asInt(m.get("cType")));
@@ -304,60 +324,61 @@
305325 String rcName = asString(m.get("rcName"));
306326 ResourceType rcType = m.get("rcType") != null ? ResourceType.getType(asInt(m.get("rcType"))) : null;
307327
308 - String definition = asString(m.get("fDefinition"));
309 -
310328 LocalConcept concept = new LocalConcept(getCorpus(), id, null, name);
311329 concept.setCardinality(cardinality);
312330 concept.setRelevance(relevance);
 331+ concept.setType(type);
313332
314 - LocalConcept[] inlinks = LocalConcept.parseList( asString(m.get("rInlinks")), getConceptFactory(), ((ConceptInfoStoreSchema)database).inLinksReferenceListEntry );
315 - LocalConcept[] outlinks = LocalConcept.parseList( asString(m.get("rOutlinks")), getConceptFactory(), ((ConceptInfoStoreSchema)database).outLinksReferenceListEntry );
316 - LocalConcept[] broader = LocalConcept.parseList( asString(m.get("rBroader")), getConceptFactory(), ((ConceptInfoStoreSchema)database).broaderReferenceListEntry );
317 - LocalConcept[] narrower = LocalConcept.parseList( asString(m.get("rNarrower")), getConceptFactory(), ((ConceptInfoStoreSchema)database).narrowerReferenceListEntry );
318 - LocalConcept[] langlinks = LocalConcept.parseList( asString(m.get("rLanglinks")), getConceptFactory(), ((ConceptInfoStoreSchema)database).langlinkReferenceListEntry );
319 - LocalConcept[] similar = LocalConcept.parseList( asString(m.get("rSimilar")), getConceptFactory(), ((ConceptInfoStoreSchema)database).similarReferenceListEntry );
320 - LocalConcept[] related = LocalConcept.parseList( asString(m.get("rRelated")), getConceptFactory(), ((ConceptInfoStoreSchema)database).relatedReferenceListEntry );
321 - TermReference[] terms = TermReference.parseList( asString(m.get("dTerms")), getConceptFactory(), ((ConceptInfoStoreSchema)database).termReferenceListEntry );
 333+ if (spec!=null && spec.getIncludeRelations()) {
 334+ LocalConcept[] inlinks = LocalConcept.parseList( asString(m.get("rInlinks")), getConceptFactory(), ((ConceptInfoStoreSchema)database).inLinksReferenceListEntry );
 335+ LocalConcept[] outlinks = LocalConcept.parseList( asString(m.get("rOutlinks")), getConceptFactory(), ((ConceptInfoStoreSchema)database).outLinksReferenceListEntry );
 336+ LocalConcept[] broader = LocalConcept.parseList( asString(m.get("rBroader")), getConceptFactory(), ((ConceptInfoStoreSchema)database).broaderReferenceListEntry );
 337+ LocalConcept[] narrower = LocalConcept.parseList( asString(m.get("rNarrower")), getConceptFactory(), ((ConceptInfoStoreSchema)database).narrowerReferenceListEntry );
 338+ LocalConcept[] langlinks = LocalConcept.parseList( asString(m.get("rLanglinks")), getConceptFactory(), ((ConceptInfoStoreSchema)database).langlinkReferenceListEntry );
 339+ LocalConcept[] similar = LocalConcept.parseList( asString(m.get("rSimilar")), getConceptFactory(), ((ConceptInfoStoreSchema)database).similarReferenceListEntry );
 340+ LocalConcept[] related = LocalConcept.parseList( asString(m.get("rRelated")), getConceptFactory(), ((ConceptInfoStoreSchema)database).relatedReferenceListEntry );
 341+
 342+ ConceptRelations<LocalConcept> relations = new ConceptRelations<LocalConcept>(broader, narrower, inlinks, outlinks, similar, related, langlinks);
 343+ concept.setRelations(relations);
 344+ }
322345
323 - WikiWordResource resource = rcId <= 0 ? null : new WikiWordResource(corpus, rcId, rcName, rcType);
 346+ if (spec!=null && spec.getIncludeResource()) {
 347+ WikiWordResource resource = rcId <= 0 ? null : new WikiWordResource(corpus, rcId, rcName, rcType);
 348+ concept.setResource(resource);
 349+ }
324350
325 - concept.setResource(resource);
326 - concept.setType(type);
327 - concept.setDefinition(definition);
328 - concept.setTerms(terms);
 351+ if (spec!=null && spec.getIncludeDefinition()) {
 352+ String definition = asString(m.get("fDefinition"));
 353+ concept.setDefinition(definition);
 354+ }
329355
330 - ConceptRelations<LocalConcept> relations = new ConceptRelations<LocalConcept>(broader, narrower, inlinks, outlinks, similar, related, langlinks);
331 - concept.setRelations(relations);
 356+ if (spec!=null && spec.getIncludeTerms()) {
 357+ TermReference[] terms = TermReference.parseList( asString(m.get("dTerms")), getConceptFactory(), ((ConceptInfoStoreSchema)database).termReferenceListEntry );
 358+ concept.setTerms(terms);
 359+ }
332360
333361 return concept;
334362 }
335363
336364
337 - public DataSet<LocalConcept> getMeanings(String term)
 365+ public DataSet<LocalConcept> getMeanings(String term, ConceptQuerySpec spec)
338366 throws PersistenceException {
 367+ String sql = conceptSelect(spec, "M.freq") + meaningWhere(term, spec);
339368
340 - return getMeanings(term, null);
 369+ return new QueryDataSet<LocalConcept>(database, new ConceptFactory(spec), "getMeanins", sql, false);
341370 }
342371
343 - public DataSet<LocalConcept> getMeanings(String term, ConceptType t)
344 - throws PersistenceException {
345 -
346 - String sql = conceptSelect("M.freq") + meaningWhere(term, t);
347 -
348 - return new QueryDataSet<LocalConcept>(database, new ConceptFactory(), "getMeanins", sql, false);
349 - }
350 -
351372
352 - public LocalConcept getConceptByName(String name) throws PersistenceException {
 373+ public LocalConcept getConceptByName(String name, ConceptQuerySpec spec) throws PersistenceException {
353374
354 - String sql = conceptSelect("-1") + " WHERE C.name = "+database.quoteString(name);
 375+ String sql = conceptSelect(spec, "-1") + " WHERE C.name = "+database.quoteString(name);
355376
356377 try {
357378 ResultSet row = executeQuery("getConcept", sql);
358379 if (!row.next()) throw new PersistenceException("no concept found with name = "+name);
359380
360381 Map<String, Object> data = DatabaseSchema.rowMap(row);
361 - LocalConcept c = newConcept(data);
 382+ LocalConcept c = newConcept(data, spec);
362383
363384 return c;
364385 } catch (SQLException e) {
Index: trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/store/DatabaseWikiWordConceptStore.java
@@ -6,9 +6,7 @@
77
88 import java.sql.ResultSet;
99 import java.sql.SQLException;
10 -import java.util.ArrayList;
1110 import java.util.HashMap;
12 -import java.util.List;
1311 import java.util.Map;
1412
1513 import de.brightbyte.data.cursor.DataSet;
@@ -22,7 +20,6 @@
2321 import de.brightbyte.util.PersistenceException;
2422 import de.brightbyte.wikiword.ConceptType;
2523 import de.brightbyte.wikiword.Corpus;
26 -import de.brightbyte.wikiword.DatasetIdentifier;
2724 import de.brightbyte.wikiword.TweakSet;
2825 import de.brightbyte.wikiword.model.WikiWordConcept;
2926 import de.brightbyte.wikiword.schema.ConceptInfoStoreSchema;
@@ -36,8 +33,15 @@
3734
3835
3936 private class RowConceptFactory implements DatabaseDataSet.Factory<T> {
 37+ private ConceptQuerySpec spec;
 38+
 39+ public RowConceptFactory(ConceptQuerySpec spec) {
 40+ super();
 41+ this.spec = spec;
 42+ }
 43+
4044 public T newInstance(ResultSet row) throws SQLException, PersistenceException {
41 - return newConcept(row);
 45+ return newConcept(row, spec);
4246 }
4347 }
4448
@@ -56,7 +60,7 @@
5761 }
5862 }
5963
60 - private RowConceptFactory rowConceptFactory = new RowConceptFactory();
 64+ private RowConceptFactory rowConceptFactory = new RowConceptFactory(null);
6165 private ConceptFactory conceptFactory = new ConceptFactory();
6266
6367 protected EntityTable conceptTable;
@@ -91,7 +95,7 @@
9296 return conceptFactory;
9397 }
9498
95 - protected T newConcept(ResultSet row) throws SQLException, PersistenceException {
 99+ protected T newConcept(ResultSet row, ConceptQuerySpec spec) throws SQLException, PersistenceException {
96100 int id = row.getInt("cId");
97101 String name = asString(row.getObject("cName"));
98102 int type = row.getInt("cType");
@@ -101,7 +105,7 @@
102106 return newConcept(id, name, getConceptType(type), card, relev);
103107 }
104108
105 - protected T newConcept(Map m) throws PersistenceException {
 109+ protected T newConcept(Map m, ConceptQuerySpec spec) throws PersistenceException {
106110 int id = asInt(m.get("cId"));
107111 String name = asString(m.get("cName"));
108112 int type = asInt(m.get("cType"));
@@ -114,12 +118,14 @@
115119 protected abstract T newConcept(int id, String name, ConceptType type, int card, double relevance) throws PersistenceException;
116120 protected abstract T[] newConceptArray(int n) ;
117121
118 - protected String referenceSelect(String card) {
119 - if (areStatsComplete()) return referenceSelect(card, "DT.idf", true);
120 - else return referenceSelect(card, "-1", false);
 122+ protected String conceptSelect(ConceptQuerySpec spec, String card) {
 123+ if (areStatsComplete()) return conceptSelect(spec, card, "DT.idf");
 124+ else return conceptSelect(spec, card, null);
121125 }
122126
123 - protected String referenceSelect(String card, String relev, boolean useDistrib) {
 127+ protected String conceptSelect(ConceptQuerySpec spec, String card, String relev) {
 128+ boolean useDistrib = (relev!=null || (spec!=null && spec.getIncludeStatistics())) && areStatsComplete();
 129+
124130 if (card!=null) card = ", "+card;
125131
126132 String sql = "SELECT C.id as cId, C.name as cName, C.type as cType " +
@@ -142,32 +148,28 @@
143149 }
144150 }
145151
146 - public DataSet<? extends T> getConcepts(int[] ids) throws PersistenceException {
147 - return getConceptInfoStore().getConcepts(ids);
 152+ public DataSet<? extends T> getConcepts(int[] ids, ConceptQuerySpec spec) throws PersistenceException {
 153+ return getConceptInfoStore().getConcepts(ids, spec);
148154 }
149155
150 - public T getConcept(int id) throws PersistenceException {
151 - return getConceptInfoStore().getConcept(id);
 156+ public T getConcept(int id, ConceptQuerySpec spec) throws PersistenceException {
 157+ return getConceptInfoStore().getConcept(id, spec);
152158 }
153159
154 - public T getRandomConcept(int top) throws PersistenceException {
155 - T r = pickRandomConcept(top);
156 - return getConcept(r.getId());
 160+ public T getRandomConcept(int top, ConceptQuerySpec spec) throws PersistenceException {
 161+ T r = getStatisticsStore().pickRandomConcept(top, spec);
 162+ return getConcept(r.getId(), spec);
157163 }
158164
159 - public DataSet<T> getAllConcepts() throws PersistenceException {
 165+ public DataSet<T> getAllConcepts(ConceptQuerySpec spec) throws PersistenceException {
160166 try {
161 - String sql = referenceSelect("-1");
 167+ String sql = conceptSelect(spec, "-1");
162168 return new ChunkedQueryDataSet<T>(database, getRowConceptFactory(), "getAllConcepts", "query", sql, null, null, conceptTable, "id", queryChunkSize);
163169 } catch (SQLException e) {
164170 throw new PersistenceException(e);
165171 }
166172 }
167173
168 - public T pickRandomConcept(int top) throws PersistenceException {
169 - return getStatisticsStore().pickRandomConcept(top);
170 - }
171 -
172174 public int getNumberOfConcepts() throws PersistenceException {
173175 if (numberOfConcepts<0) {
174176 String sql = "select count(*) from "+conceptTable.getSQLName();
@@ -344,7 +346,7 @@
345347 }
346348 }
347349
348 - public T pickRandomConcept(int top)
 350+ public T pickRandomConcept(int top, ConceptQuerySpec spec)
349351 throws PersistenceException {
350352
351353 if (!areStatsComplete()) throw new IllegalStateException("satistics need to be built before accessing node degree!");
@@ -354,13 +356,13 @@
355357
356358 int r = (int)Math.floor(Math.random() * top) +1;
357359
358 - String sql = referenceSelect("DT.in_degree", "DT.idf", true)
 360+ String sql = conceptSelect(spec, "DT.in_degree", "DT.idf")
359361 + " WHERE in_rank = "+r;
360362
361363 try {
362364 T pick = null;
363365 ResultSet rs = executeQuery("pickRandomConcept", sql);
364 - if (rs.next()) pick = newConcept(rs);
 366+ if (rs.next()) pick = newConcept(rs, spec);
365367 rs.close();
366368 return pick;
367369 } catch (SQLException e) {
@@ -378,10 +380,17 @@
379381
380382
381383 protected class ConceptFactory implements DatabaseDataSet.Factory<C> {
 384+ private ConceptQuerySpec spec;
 385+
 386+ public ConceptFactory(ConceptQuerySpec spec) {
 387+ super();
 388+ this.spec = spec;
 389+ }
 390+
382391 public C newInstance(ResultSet row) throws SQLException, PersistenceException {
383392 Map<String, Object> m = DatabaseSchema.rowMap(row);
384393
385 - return newConcept(m);
 394+ return newConcept(m, spec);
386395 }
387396 }
388397
@@ -395,24 +404,24 @@
396405 conceptInfoTable = (EntityTable)database.getTable("concept_info");
397406 }
398407
399 - protected String conceptSelect(String card) {
400 - if (areStatsComplete()) return conceptSelect(card, "DT.idf", true);
401 - else return conceptSelect(card, "-1", false);
 408+ protected String conceptSelect(ConceptQuerySpec spec, String card) {
 409+ if (areStatsComplete()) return conceptSelect(spec, card, "DT.idf");
 410+ else return conceptSelect(spec, card, "-1");
402411 }
403412
404 - protected abstract String conceptSelect(String card, String relev, boolean useDistrib);
 413+ protected abstract String conceptSelect(ConceptQuerySpec spec, String card, String relev);
405414
406 - public C getConcept(int id)
 415+ public C getConcept(int id, ConceptQuerySpec spec)
407416 throws PersistenceException {
408417
409 - String sql = conceptSelect("-1") + " WHERE C.id = "+id;
 418+ String sql = conceptSelect(spec, "-1") + " WHERE C.id = "+id;
410419
411420 try {
412421 ResultSet row = executeQuery("getConcept", sql);
413422 if (!row.next()) throw new PersistenceException("no concept found with id = "+id);
414423
415424 Map<String, Object> data = DatabaseSchema.rowMap(row);
416 - C c = newConcept(data);
 425+ C c = newConcept(data, spec);
417426
418427 return c;
419428 } catch (SQLException e) {
@@ -420,30 +429,30 @@
421430 }
422431 }
423432
424 - public DataSet<C> getAllConcepts()
 433+ public DataSet<C> getAllConcepts(ConceptQuerySpec spec)
425434 throws PersistenceException {
426435
427436 try {
428 - String sql = conceptSelect("-1");
429 - return new ChunkedQueryDataSet<C>(database, new ConceptFactory(), "getAllConcepts", "query", sql, null, null, conceptTable, "id", queryChunkSize);
 437+ String sql = conceptSelect(spec, "-1");
 438+ return new ChunkedQueryDataSet<C>(database, new ConceptFactory(spec), "getAllConcepts", "query", sql, null, null, conceptTable, "id", queryChunkSize);
430439 } catch (SQLException e) {
431440 throw new PersistenceException(e);
432441 }
433442 }
434443
435 - public DataSet<C> getConcepts(int[] ids)
 444+ public DataSet<C> getConcepts(int[] ids, ConceptQuerySpec spec)
436445 throws PersistenceException {
437446
438447 try {
439 - String sql = conceptSelect("-1");
 448+ String sql = conceptSelect(spec, "-1");
440449 sql += " WHERE C.id IN " + database.encodeSet(ids);
441 - return new QueryDataSet<C>(database, new ConceptFactory(), "getConcepts", sql, false);
 450+ return new QueryDataSet<C>(database, new ConceptFactory(spec), "getConcepts", sql, false);
442451 } catch (SQLException e) {
443452 throw new PersistenceException(e);
444453 }
445454 }
446455
447 - protected abstract C newConcept(Map<String, Object> data) throws PersistenceException;
 456+ protected abstract C newConcept(Map<String, Object> data, ConceptQuerySpec spec) throws PersistenceException;
448457
449458 }
450459
Index: trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/store/DatabaseGlobalConceptStore.java
@@ -124,12 +124,14 @@
125125 return sql;
126126 }
127127
 128+ /*
128129 public DataSet<GlobalConcept> listMeanings(String lang, String term)
129130 throws PersistenceException {
130131
131 - String sql = referenceSelect("M.freq") + meaningsSQL(lang, term);
 132+ String sql = conceptSelect("M.freq") + meaningsSQL(lang, term);
132133 return new QueryDataSet<GlobalConcept>(database, getRowConceptFactory(), "listMeanings", sql, false);
133134 }
 135+ */
134136
135137 protected void registerLocalStore(DatabaseLocalConceptStore store) throws PersistenceException {
136138 trace("registered local store for "+store.getCorpus().getLanguage());
@@ -210,12 +212,12 @@
211213 }
212214 }
213215
214 - public DataSet<GlobalConcept> getMeanings(String lang, String term) throws PersistenceException {
215 - return ((DatabaseGlobalConceptInfoStore)getConceptInfoStore()).getMeanings(lang, term);
 216+ public DataSet<GlobalConcept> getMeanings(String lang, String term, ConceptQuerySpec spec) throws PersistenceException {
 217+ return ((DatabaseGlobalConceptInfoStore)getConceptInfoStore()).getMeanings(lang, term, spec);
216218 }
217219
218 - public List<LocalConcept> getLocalConcepts(int id) throws PersistenceException {
219 - return ((DatabaseGlobalConceptInfoStore)getConceptInfoStore()).getLocalConcepts(id);
 220+ public List<LocalConcept> getLocalConcepts(int id, ConceptQuerySpec spec) throws PersistenceException {
 221+ return ((DatabaseGlobalConceptInfoStore)getConceptInfoStore()).getLocalConcepts(id, spec);
220222 }
221223
222224 /////////////////////////////////////////////////////////////////////////////////////////////
@@ -236,23 +238,42 @@
237239 }
238240
239241 @Override
240 - protected String conceptSelect(String card, String relev, boolean useDistrib) {
241 - String distribJoin = !useDistrib ? "" : " JOIN " + database.getSQLTableName("degree", true) + " as DT ON DT.concept = C.id";
242 -
243 - return "SELECT C.id as cId, C.name as cName, " +
244 - "C.language_bits as cLangBits, C.language_count as cLangCount, " +
245 - "C.type as cType, " +
246 - " "+card+" as qFreq, "+relev+" as qConf, " +
247 - " I.inlinks as rInlinks, I.outlinks as rOutlinks, " +
248 - " I.broader as rBroader, I.narrower as rNarrower, " +
249 - " I.similar as rSimilar, I.related as rRelated, I.langlinks as rLanglinks " +
250 - " FROM "+conceptTable.getSQLName()+" as C "+
251 - distribJoin+
252 - " LEFT JOIN "+conceptInfoTable.getSQLName()+" as I ON I.concept = C.id ";
 242+ protected String conceptSelect(ConceptQuerySpec spec, String card, String relev) {
 243+ boolean useDistrib = (relev!=null || (spec!=null && spec.getIncludeStatistics())) && areStatsComplete();
 244+
 245+ String fields = "C.id as cId, C.name as cName, C.type as cType, " +
 246+ "C.language_bits as cLangBits, C.language_count as cLangCount ";
 247+
 248+ String tables = ""+conceptTable.getSQLName()+" as C ";
 249+
 250+ if (useDistrib) {
 251+ tables += " JOIN " + database.getSQLTableName("degree", true) + " as DT ON DT.concept = C.id ";
 252+ if (relev==null) relev = "DT.idf";
 253+ } else {
 254+ relev = "-1";
 255+ }
 256+
 257+ if (relev==null) relev = "-1";
 258+ if (card==null) card = "-1";
 259+
 260+ fields += ", "+card+" as qFreq, "+relev+" as qConf ";
 261+
 262+ if (spec!=null && spec.getIncludeRelations()) {
 263+ fields += ", I.inlinks as rInlinks, I.outlinks as rOutlinks, " +
 264+ " I.broader as rBroader, I.narrower as rNarrower, I.langlinks as rLanglinks, " +
 265+ " I.similar as rSimilar, I.related as rRelated ";
 266+
 267+ tables += " LEFT JOIN "+conceptInfoTable.getSQLName()+" as I ON I.concept = C.id ";
 268+ }
 269+
 270+ //TODO: include features!
 271+
 272+ String sql = "SELECT " + fields + " FROM " + tables;
 273+ return sql;
253274 }
254275
255276 @Override
256 - protected GlobalConcept newConcept(Map<String, Object> m) throws PersistenceException {
 277+ protected GlobalConcept newConcept(Map<String, Object> m, ConceptQuerySpec spec) throws PersistenceException {
257278 try {
258279 int id = asInt(m.get("cId"));
259280 int langBits = asInt(m.get("cLangBits"));
@@ -266,27 +287,32 @@
267288 Corpus[] languages = ((GlobalConceptStoreSchema)DatabaseGlobalConceptStore.this.database).getLanguages(langBits);
268289
269290 GlobalConcept concept = new GlobalConcept(getDatasetIdentifier(), id, type);
 291+ concept.setName(name);
 292+ concept.setLanguages(languages);
 293+ concept.setType(type);
270294 concept.setCardinality(cardinality);
271295 concept.setRelevance(relevance);
272296
273 - GlobalConcept[] inlinks = GlobalConcept.parseList( asString(m.get("rInlinks")), getConceptFactory(), ((ConceptInfoStoreSchema)database).inLinksReferenceListEntry );
274 - GlobalConcept[] outlinks = GlobalConcept.parseList( asString(m.get("rOutlinks")), getConceptFactory(), ((ConceptInfoStoreSchema)database).outLinksReferenceListEntry );
275 - GlobalConcept[] broader = GlobalConcept.parseList( asString(m.get("rBroader")), getConceptFactory(), ((ConceptInfoStoreSchema)database).broaderReferenceListEntry );
276 - GlobalConcept[] narrower = GlobalConcept.parseList( asString(m.get("rNarrower")), getConceptFactory(), ((ConceptInfoStoreSchema)database).narrowerReferenceListEntry );
277 - GlobalConcept[] langlinks = GlobalConcept.parseList( asString(m.get("rLanglinks")), getConceptFactory(), ((ConceptInfoStoreSchema)database).langlinkReferenceListEntry );
278 - GlobalConcept[] similar = GlobalConcept.parseList( asString(m.get("rSimilar")), getConceptFactory(), ((ConceptInfoStoreSchema)database).similarReferenceListEntry );
279 - GlobalConcept[] related = GlobalConcept.parseList( asString(m.get("rRelated")), getConceptFactory(), ((ConceptInfoStoreSchema)database).relatedReferenceListEntry );
 297+ if (spec!=null && spec.getIncludeRelations()) {
 298+ GlobalConcept[] inlinks = GlobalConcept.parseList( asString(m.get("rInlinks")), getConceptFactory(), ((ConceptInfoStoreSchema)database).inLinksReferenceListEntry );
 299+ GlobalConcept[] outlinks = GlobalConcept.parseList( asString(m.get("rOutlinks")), getConceptFactory(), ((ConceptInfoStoreSchema)database).outLinksReferenceListEntry );
 300+ GlobalConcept[] broader = GlobalConcept.parseList( asString(m.get("rBroader")), getConceptFactory(), ((ConceptInfoStoreSchema)database).broaderReferenceListEntry );
 301+ GlobalConcept[] narrower = GlobalConcept.parseList( asString(m.get("rNarrower")), getConceptFactory(), ((ConceptInfoStoreSchema)database).narrowerReferenceListEntry );
 302+ GlobalConcept[] langlinks = GlobalConcept.parseList( asString(m.get("rLanglinks")), getConceptFactory(), ((ConceptInfoStoreSchema)database).langlinkReferenceListEntry );
 303+ GlobalConcept[] similar = GlobalConcept.parseList( asString(m.get("rSimilar")), getConceptFactory(), ((ConceptInfoStoreSchema)database).similarReferenceListEntry );
 304+ GlobalConcept[] related = GlobalConcept.parseList( asString(m.get("rRelated")), getConceptFactory(), ((ConceptInfoStoreSchema)database).relatedReferenceListEntry );
 305+
 306+ ConceptRelations<GlobalConcept> relations = new ConceptRelations<GlobalConcept>(broader, narrower, inlinks, outlinks, similar, related, langlinks);
 307+ concept.setRelations(relations);
 308+ }
280309
281 - ConceptRelations<GlobalConcept> relations = new ConceptRelations<GlobalConcept>(broader, narrower, inlinks, outlinks, similar, related, langlinks);
282 - concept.setRelations(relations);
283 -
284310 return concept;
285311 } catch (SQLException e) {
286312 throw new PersistenceException(e);
287313 }
288314 }
289315
290 - protected LocalConcept getLocalConcept(int id, DatabaseLocalConceptStore store) throws PersistenceException {
 316+ protected LocalConcept getLocalConcept(int id, ConceptQuerySpec spec, DatabaseLocalConceptStore store) throws PersistenceException {
291317 String lang = store.getCorpus().getLanguage();
292318 String sql = "select local_concept"
293319 +" from "+originTable.getSQLName()
@@ -297,13 +323,13 @@
298324 Integer localId = asInt(database.executeSingleValueQuery("getConceptDescription", sql));
299325 if (localId==null) throw new PersistenceException("concept #"+id+" has no description in language "+lang);
300326
301 - return store.getConceptInfoStore().getConcept(localId);
 327+ return store.getConceptInfoStore().getConcept(localId, spec);
302328 } catch (SQLException e) {
303329 throw new PersistenceException(e);
304330 }
305331 }
306332
307 - public List<LocalConcept> getLocalConcepts(int id) throws PersistenceException {
 333+ public List<LocalConcept> getLocalConcepts(int id, ConceptQuerySpec spec) throws PersistenceException {
308334 List<LocalConcept> m = new ArrayList<LocalConcept>();
309335
310336 String sql = "select lang, local_concept"
@@ -315,7 +341,7 @@
316342 while (res.next()) {
317343 String lang = asString(res.getObject("lang"));
318344 DatabaseLocalConceptStore store = getLocalConceptStore(lang);
319 - LocalConcept c = getLocalConcept(id, store);
 345+ LocalConcept c = getLocalConcept(id, spec, store);
320346 m.add(c);
321347 }
322348
@@ -326,11 +352,11 @@
327353 }
328354 }
329355
330 - public DataSet<GlobalConcept> getMeanings(String lang, String term)
 356+ public DataSet<GlobalConcept> getMeanings(String lang, String term, ConceptQuerySpec spec)
331357 throws PersistenceException {
332358
333 - String sql = conceptSelect("M.freq") + meaningsSQL(lang, term);
334 - return new QueryDataSet<GlobalConcept>(database, new ConceptFactory(), "getMeanings", sql, false);
 359+ String sql = conceptSelect(spec, "M.freq") + meaningsSQL(lang, term);
 360+ return new QueryDataSet<GlobalConcept>(database, new ConceptFactory(spec), "getMeanings", sql, false);
335361 }
336362 }
337363
Index: trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/store/LocalConceptStore.java
@@ -2,9 +2,9 @@
33
44 import de.brightbyte.data.cursor.DataSet;
55 import de.brightbyte.util.PersistenceException;
6 -import de.brightbyte.wikiword.ConceptType;
76 import de.brightbyte.wikiword.model.LocalConcept;
87 import de.brightbyte.wikiword.model.TermReference;
 8+import de.brightbyte.wikiword.store.WikiWordConceptStore.ConceptQuerySpec;
99
1010
1111 /**
@@ -12,15 +12,8 @@
1313 */
1414 public interface LocalConceptStore extends WikiWordConceptStore<LocalConcept>, WikiWordLocalStore {
1515
16 - /*
17 - public abstract DataSet<ConceptReference> getBroaderConcepts() throws PersistenceException;
18 - public abstract DataSet<ConceptReference> getNarrowerConcepts() throws PersistenceException;
19 - */
20 -
21 - public abstract DataSet<LocalConcept> getMeanings(String term, ConceptType t) throws PersistenceException;
 16+ public abstract DataSet<LocalConcept> getMeanings(String term, ConceptQuerySpec spec) throws PersistenceException;
2217
23 - public abstract DataSet<LocalConcept> getMeanings(String term) throws PersistenceException;
24 -
2518 public int getNumberOfTerms() throws PersistenceException;
2619
2720 public abstract DataSet<TermReference> getAllTerms() throws PersistenceException;
@@ -41,6 +34,6 @@
4235 public TermReference pickRandomTerm(int top)
4336 throws PersistenceException;
4437
45 - public LocalConcept getConceptByName(String name) throws PersistenceException;
 38+ public LocalConcept getConceptByName(String name, ConceptQuerySpec spec) throws PersistenceException;
4639
4740 }
Index: trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/store/WikiWordConceptStore.java
@@ -7,8 +7,64 @@
88
99
1010 public interface WikiWordConceptStore<T extends WikiWordConcept> extends WikiWordConceptStoreBase {
 11+
 12+ public static class ConceptQuerySpec {
 13+ private boolean includeRelations;
 14+ private boolean includeStatistics;
 15+ private boolean includeResource;
 16+ private boolean includeTerms;
 17+ private ConceptType requireType;
 18+ private boolean includeDefinition;
 19+
 20+ public boolean getIncludeRelations() {
 21+ return includeRelations;
 22+ }
 23+ public void setIncludeRelations(boolean includeRelations) {
 24+ this.includeRelations = includeRelations;
 25+ }
 26+
 27+ public ConceptType getRequireType() {
 28+ return requireType;
 29+ }
 30+
 31+ public void setRequireType(ConceptType requireType) {
 32+ this.requireType = requireType;
 33+ }
 34+
 35+ public boolean getIncludeStatistics() {
 36+ return includeStatistics;
 37+ }
 38+
 39+ public void setIncludeStatistics(boolean includeStatistics) {
 40+ this.includeStatistics = includeStatistics;
 41+ }
 42+
 43+ public boolean getIncludeDefinition() {
 44+ return includeDefinition;
 45+ }
 46+
 47+ public void setIncludeDefinition(boolean includeDefinition) {
 48+ this.includeDefinition = includeDefinition;
 49+ }
 50+
 51+ public boolean getIncludeResource() {
 52+ return includeResource;
 53+ }
 54+
 55+ public void setIncludeResource(boolean includeResource) {
 56+ this.includeResource = includeResource;
 57+ }
 58+
 59+ public boolean getIncludeTerms() {
 60+ return includeTerms;
 61+ }
 62+
 63+ public void setIncludeTerms(boolean includeTerms) {
 64+ this.includeTerms = includeTerms;
 65+ }
 66+ }
1167
12 - public DataSet<? extends T> getAllConcepts() throws PersistenceException;
 68+ public DataSet<? extends T> getAllConcepts(ConceptQuerySpec spec) throws PersistenceException;
1369
1470 public ConceptType getConceptType(int type) throws PersistenceException;
1571
@@ -17,21 +73,11 @@
1874 public FeatureStore<T, Integer> getFeatureStore() throws PersistenceException;
1975 public ProximityStore<T, Integer> getProximityStore() throws PersistenceException;
2076
21 - public T getConcept(int id) throws PersistenceException;
 77+ public T getConcept(int id, ConceptQuerySpec spec) throws PersistenceException;
2278
23 - public DataSet<? extends T> getConcepts(int[] ids) throws PersistenceException;
 79+ public DataSet<? extends T> getConcepts(int[] ids, ConceptQuerySpec spec) throws PersistenceException;
2480
2581 /**
26 - * Returns a WikiWordConceptReference for a random concept from the top-n
27 - * concepts with repect to in-degree.
28 - * @param top the maximum rank of the concept to be returned. If top is 0,
29 - * any concept from the full range may be returned. If it is negative,
30 - * it's interpreted as a percentage of the total number of concepts.
31 - * @return a random concept from the range specified by the top argument.
32 - */
33 - public T pickRandomConcept(int top) throws PersistenceException;
34 -
35 - /**
3682 * Returns a WikiWordConcept for a random concept from the top-n
3783 * concepts with repect to in-degree.
3884 * @param top the maximum rank of the concept to be returned. If top is 0,
@@ -39,7 +85,7 @@
4086 * it's interpreted as a percentage of the total number of concepts.
4187 * @return a random concept from the range specified by the top argument.
4288 */
43 - public T getRandomConcept(int top) throws PersistenceException;
 89+ public T getRandomConcept(int top, ConceptQuerySpec spec) throws PersistenceException;
4490
4591 /**
4692 * Returns the number of concepts in the store. Since the content of a concept
Index: trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/store/GlobalConceptStore.java
@@ -14,10 +14,8 @@
1515 */
1616 public interface GlobalConceptStore extends WikiWordConceptStore<GlobalConcept> {
1717
18 - public DataSet<GlobalConcept> getAllConcepts() throws PersistenceException;
19 -
2018 //TODO: relevance limit? order?
21 - public DataSet<GlobalConcept> getMeanings(String lang, String term) throws PersistenceException;
 19+ public DataSet<GlobalConcept> getMeanings(String lang, String term, ConceptQuerySpec spec) throws PersistenceException;
2220
2321 //public abstract ResultSet queryTermRefersTo() throws PersistenceException;
2422
@@ -28,7 +26,7 @@
2927
3028 public LocalConceptStore getLocalConceptStore(Corpus corpus) throws PersistenceException;
3129
32 - public List<LocalConcept> getLocalConcepts(int id) throws PersistenceException;
 30+ public List<LocalConcept> getLocalConcepts(int id, ConceptQuerySpec spec) throws PersistenceException;
3331
3432 public Corpus[] getLanguages() throws PersistenceException;
3533 }
Index: trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/model/GlobalConcept.java
@@ -6,11 +6,13 @@
77
88 import de.brightbyte.util.PersistenceException;
99 import de.brightbyte.wikiword.ConceptType;
 10+import de.brightbyte.wikiword.Corpus;
1011 import de.brightbyte.wikiword.DatasetIdentifier;
1112
1213
1314 public class GlobalConcept extends WikiWordConcept {
14 - protected Map<String, LocalConcept> concepts;
 15+ private Map<String, LocalConcept> concepts;
 16+ private Corpus[] languages;
1517
1618 public GlobalConcept(DatasetIdentifier dataset, int id, ConceptType type) {
1719 super(dataset, id, type);
@@ -20,15 +22,25 @@
2123 return concepts;
2224 }
2325
 26+ public Corpus[] getLanguages() throws PersistenceException {
 27+ return languages;
 28+ }
 29+
2430 public LocalConcept getLocalConcept(String lang) throws PersistenceException {
2531 if (concepts==null) return null;
2632 return concepts.get(lang);
2733 }
2834
2935 public void setConcepts(Map<String, LocalConcept> concepts) {
 36+ if (this.concepts!=null) throw new IllegalStateException("property already initialized");
3037 this.concepts = concepts;
3138 }
3239
 40+ public void setLanguages(Corpus[] languages) {
 41+ if (this.languages!=null) throw new IllegalStateException("property already initialized");
 42+ this.languages = languages;
 43+ }
 44+
3345 public void setConcepts(List<LocalConcept> concepts) {
3446 Map<String, LocalConcept> m = new HashMap<String, LocalConcept>();
3547
Index: trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/query/QueryConsole.java
@@ -35,13 +35,27 @@
3636 import de.brightbyte.wikiword.store.LocalConceptStore;
3737 import de.brightbyte.wikiword.store.ProximityStore;
3838 import de.brightbyte.wikiword.store.WikiWordConceptStore;
 39+import de.brightbyte.wikiword.store.WikiWordConceptStore.ConceptQuerySpec;
3940
4041 public class QueryConsole extends ConsoleApp<WikiWordConceptStore> {
4142
4243 protected Disambiguator disambiguator;
 44+ protected ConceptQuerySpec minimalConceptSpec;
 45+ protected ConceptQuerySpec resolvedConceptSpec;
 46+ protected ConceptQuerySpec detailedConceptSpec;
4347
4448 public QueryConsole() {
4549 super(true, true);
 50+
 51+ minimalConceptSpec = new ConceptQuerySpec();
 52+ resolvedConceptSpec = new ConceptQuerySpec();
 53+ resolvedConceptSpec.setIncludeDefinition(true);
 54+ resolvedConceptSpec.setIncludeResource(true);
 55+
 56+ detailedConceptSpec = new ConceptQuerySpec();
 57+ detailedConceptSpec.setIncludeDefinition(true);
 58+ detailedConceptSpec.setIncludeResource(true);
 59+ detailedConceptSpec.setIncludeRelations(true);
4660 }
4761
4862 protected static class ConsoleOutput {
@@ -231,7 +245,7 @@
232246 String n = r.getName();
233247
234248 if (n==null && c < maxAutoResolve) {
235 - WikiWordConcept x = ((WikiWordConceptStore)conceptStore).getConcept(id);
 249+ WikiWordConcept x = ((WikiWordConceptStore)conceptStore).getConcept(id, resolvedConceptSpec);
236250 r = x;
237251 a = r;
238252 }
@@ -415,27 +429,27 @@
416430 }
417431
418432 public void listConcepts(ConsoleOutput out) throws PersistenceException {
419 - DataSet<? extends LocalConcept> meanings = getLocalConceptStore().getAllConcepts();
 433+ DataSet<? extends LocalConcept> meanings = getLocalConceptStore().getAllConcepts(minimalConceptSpec);
420434 out.writeConcepts(meanings);
421435 }
422436
423437 public void listMeaningsLocal(String term, ConsoleOutput out) throws PersistenceException {
424 - DataSet<LocalConcept> meanings = getLocalConceptStore().getMeanings(term);
 438+ DataSet<LocalConcept> meanings = getLocalConceptStore().getMeanings(term, resolvedConceptSpec);
425439 out.writeConcepts(meanings);
426440 }
427441
428442 public void listMeaningsGlobal(String lang, String term, ConsoleOutput out) throws PersistenceException {
429 - DataSet<GlobalConcept> meanings = getGlobalConceptStore().getMeanings(lang, term);
 443+ DataSet<GlobalConcept> meanings = getGlobalConceptStore().getMeanings(lang, term, resolvedConceptSpec);
430444 out.writeConcepts(meanings);
431445 }
432446
433447 public void showConcept(int id, ConsoleOutput out) throws PersistenceException {
434 - WikiWordConcept c = conceptStore.getConcept(id);
 448+ WikiWordConcept c = conceptStore.getConcept(id, detailedConceptSpec);
435449 out.writeConcept(c);
436450 }
437451
438452 public void showConcept(int id, String lang, ConsoleOutput out) throws PersistenceException {
439 - GlobalConcept c = getGlobalConceptStore().getConcept(id);
 453+ GlobalConcept c = getGlobalConceptStore().getConcept(id, detailedConceptSpec);
440454 out.writeConcept(c);
441455
442456 LocalConcept lc = c.getLocalConcept(lang);
@@ -452,7 +466,7 @@
453467 public void showConcept(String lang, int id, ConsoleOutput out) throws PersistenceException {
454468 LocalConceptStore lstore = getGlobalConceptStore().getLocalConceptStore(Corpus.forName(getStoreDataset().getCollection(), lang, tweaks));
455469
456 - LocalConcept lc = lstore.getConcept(id);
 470+ LocalConcept lc = lstore.getConcept(id, detailedConceptSpec);
457471 if (out.getOutput() instanceof ConceptDumper) {
458472 ((ConceptDumper)out.getOutput()).setMaxAutoResolve(0);
459473 }

Status & tagging log