r53048 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53047‎ | r53048 | r53049 >
Date:13:22, 10 July 2009
Author:daniel
Status:deferred
Tags:
Comment:
store resource name in about table
Modified paths:
  • /trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/schema/LocalConceptStoreSchema.java (modified) (history)
  • /trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/builder/ConceptImporter.java (modified) (history)
  • /trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseLocalConceptStoreBuilder.java (modified) (history)
  • /trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DebugLocalConceptStoreBuilder.java (modified) (history)
  • /trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/LocalConceptStoreBuilder.java (modified) (history)

Diff [purge]

Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/builder/ConceptImporter.java
@@ -270,7 +270,7 @@
271271 out.info("storing category redirect "+rcName+" -> "+redir);
272272 storeAlias(analyzerPage, rcId);
273273 } else {
274 - int conceptId = store.storeAbout(rcId, name);
 274+ int conceptId = store.storeAbout(rcId, rcName, name);
275275
276276 List<WikiTextAnalyzer.WikiLink> links = analyzerPage.getLinks();
277277 linkTracker.step(links.size());
@@ -477,7 +477,7 @@
478478 String tgtConcept = link.getPage().toString();
479479
480480 if (!name.equals(tgtConcept)) {
481 - conceptId = store.storeAbout(rcId, name);
 481+ conceptId = store.storeAbout(rcId, rcName, name);
482482 storeConceptAlias(rcId, conceptId, name, -1, tgtConcept, AliasScope.REDIRECT);
483483 } else {
484484 out.debug("skipping redirect to category with the same name");
@@ -491,7 +491,7 @@
492492 warn(rcId, "bad redirect (self-link)", "page "+name, null);
493493 }
494494 else {
495 - conceptId = store.storeAbout(rcId, name);
 495+ conceptId = store.storeAbout(rcId, rcName, name);
496496 storePageTerms(rcId, analyzerPage.getTitleTerms(), -1, link.getPage().toString(), ExtractionRule.TERM_FROM_REDIRECT );
497497 storeConceptAlias(rcId, conceptId, name, -1, link.getPage().toString(), AliasScope.REDIRECT);
498498
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseLocalConceptStoreBuilder.java
@@ -303,7 +303,7 @@
304304 */
305305 public int storeResourceAbout(String name, ResourceType ptype, Date time, int conceptId, String conceptName) throws PersistenceException {
306306 int rcId = storeResource(name, ptype, time);
307 - storeAbout(rcId, conceptId, conceptName);
 307+ storeAbout(rcId, name, conceptId, conceptName);
308308 return rcId;
309309 }
310310
@@ -355,7 +355,7 @@
356356 id = conceptInserter.getLastId();
357357 }
358358
359 - if (rcId>=0) storeAbout(rcId, id, name);
 359+ if (rcId>=0) storeAbout(rcId, name, id, name); //XXX: really here? do prior to calling this method?!
360360
361361 return id;
362362 } catch (SQLException e) {
@@ -484,14 +484,14 @@
485485 /**
486486 * @see de.brightbyte.wikiword.store.builder.LocalConceptStoreBuilder#storeAbout(int, String)
487487 */
488 - public int storeAbout(int rcId, String conceptName) throws PersistenceException {
489 - return storeAbout(rcId, -1, conceptName);
 488+ public int storeAbout(int rcId, String rcName, String conceptName) throws PersistenceException {
 489+ return storeAbout(rcId, rcName, -1, conceptName);
490490 }
491491
492492 /**
493493 * @see de.brightbyte.wikiword.store.builder.LocalConceptStoreBuilder#storeAbout(int, int, String)
494494 */
495 - public int storeAbout(int rcId, int concept, String conceptName) throws PersistenceException {
 495+ public int storeAbout(int rcId, String rcName, int concept, String conceptName) throws PersistenceException {
496496 try {
497497 if (rcId<0) throw new IllegalArgumentException("bad resource id "+rcId);
498498 conceptName = checkName(rcId, conceptName, "concept name (resource #{0})", rcId);
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/LocalConceptStoreBuilder.java
@@ -55,11 +55,11 @@
5656 throws PersistenceException;
5757
5858 /* returns concept ID, of known; -1 otherwise */
59 - public abstract int storeAbout(int resource, String conceptName)
 59+ public abstract int storeAbout(int resource, String rcName, String conceptName)
6060 throws PersistenceException;
6161
6262 /* returns concept ID, of known; -1 otherwise */
63 - public abstract int storeAbout(int resource, int concept, String conceptName)
 63+ public abstract int storeAbout(int resource, String rcName, int concept, String conceptName)
6464 throws PersistenceException;
6565
6666 //public abstract void storeConceptReference(int rcId, int source,
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DebugLocalConceptStoreBuilder.java
@@ -509,7 +509,7 @@
510510
511511 public int storeResourceAbout(String name, ResourceType ptype, Date time, int conceptId, String conceptName) {
512512 int resourceId = storeResource(name, ptype, time);
513 - storeAbout(resourceId, conceptId, conceptName);
 513+ storeAbout(resourceId, name, conceptId, conceptName);
514514 return resourceId;
515515 }
516516
@@ -712,13 +712,13 @@
713713 return 0;
714714 }
715715
716 - public int storeAbout(int resource, String conceptName) {
717 - trace("+ storeAbout: resource = "+resource+", conceptName = "+conceptName);
 716+ public int storeAbout(int resource, String rcName, String conceptName) {
 717+ trace("+ storeAbout: resource = "+resource+", resourceName = "+rcName+", conceptName = "+conceptName);
718718 return -1;
719719 }
720720
721 - public int storeAbout(int resource, int concept, String conceptName) {
722 - trace("+ storeAbout: resource = "+resource+", concept = "+concept+", conceptName = "+conceptName);
 721+ public int storeAbout(int resource, String rcName, int concept, String conceptName) {
 722+ trace("+ storeAbout: resource = "+resource+", resourceName = "+rcName+", concept = "+concept+", conceptName = "+conceptName);
723723 return -1;
724724 }
725725
Index: trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/schema/LocalConceptStoreSchema.java
@@ -104,6 +104,7 @@
105105 aboutTable = new RelationTable(this, "about", getDefaultTableAttributes());
106106 //aliasTable.addField( new DatabaseField(this, "id", "INT", "AUTO_INCREMENT", false, KeyType.PRIMARY) );
107107 aboutTable.addField( new ReferenceField(this, "resource", "INT", null, true, null, "resource", "id", null ) );
 108+ aboutTable.addField( new ReferenceField(this, "resource_name", getTextType(255), null, true, KeyType.INDEX, "resource", "name", null ) );
108109 aboutTable.addField( new ReferenceField(this, "concept", "INT", null, false, KeyType.INDEX, "concept", "id", null ) );
109110 aboutTable.addField( new ReferenceField(this, "concept_name", getTextType(255), null, true, KeyType.INDEX, "concept", "name", null ) );
110111 aboutTable.addKey( new DatabaseKey(this, KeyType.PRIMARY, "about", new String[] {"resource", "concept"}) );

Status & tagging log