r50333 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50332‎ | r50333 | r50334 >
Date:13:57, 8 May 2009
Author:daniel
Status:deferred
Tags:
Comment:
generic property for name qualifiers
Modified paths:
  • /trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/builder/ConceptImporter.java (modified) (history)
  • /trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/builder/PropertyImporter.java (modified) (history)

Diff [purge]

Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/builder/PropertyImporter.java
@@ -62,6 +62,7 @@
6363 }
6464
6565 cid = storeConcept(rcId, name, ctype);
 66+ storeSuffixInfo(analyzerPage, rcId, cid, name);
6667 }
6768
6869 if (rcType == ResourceType.ARTICLE || rcType == ResourceType.SUPPLEMENT) {
@@ -129,6 +130,8 @@
130131 super.configure(args);
131132
132133 if (args.isSet("attach")) buildConcepts = false;
 134+
 135+ setStoreProperties(true);
133136 }
134137
135138 protected boolean getPurgeData() {
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/builder/ConceptImporter.java
@@ -126,6 +126,19 @@
127127 if (propertyStore!=null && storeProperties) ((IncrementalStoreBuilder)propertyStore).deleteDataAfter(delAfter, false); //FIXME: make sure we are not off by one!
128128 }
129129
 130+ protected void storeSuffixInfo(WikiPage analyzerPage, int rcId, int conceptId, String conceptName) throws PersistenceException {
 131+ CharSequence sfx = analyzerPage.getTitleSuffix();
 132+ if (sfx!=null) {
 133+ String qualifier = analyzer.normalizeTitle(sfx).toString();
 134+
 135+ if (analyzer.useSuffixAsCategory())
 136+ storeConceptBroader(rcId, conceptId, conceptName, qualifier, ExtractionRule.BROADER_FROM_SUFFIX);
 137+
 138+ if (storeProperties)
 139+ storeProperty(rcId, conceptId, conceptName, "qualifier", qualifier);
 140+ }
 141+ }
 142+
130143 protected void buildTermsForMissingConcepts() throws PersistenceException {
131144 if (!analyzer.isInitialized()) { //XXX: ugly hack!
132145 analyzer.initialize(Namespace.canonicalNamespaces, true);
@@ -140,10 +153,7 @@
141154 WikiPage analyzerPage = analyzer.makePage(0, r.getName(), "", false); //XXX: bypass analyzer page?
142155 storePageTerms(-1, r.getId(), analyzerPage); //FIXME: skip sections, foo#bar is not a good term!
143156
144 - if (analyzer.useSuffixAsCategory()) {
145 - CharSequence sfx = analyzerPage.getTitleSuffix();
146 - if (sfx!=null) storeConceptBroader(-1, r.getId(), r.getName(), analyzer.normalizeTitle(sfx).toString(), ExtractionRule.BROADER_FROM_SUFFIX);
147 - }
 157+ ConceptImporter.this.storeSuffixInfo(analyzerPage, -1, r.getId(), r.getName());
148158
149159 //NOTE: covered by DatabaseLocalConceptStoreBuilder.buildSectionBroader
150160 //CharSequence pfx = analyzerPage.getTitlePrefix();
@@ -285,10 +295,7 @@
286296
287297 //XXX: store interwiki-set inline for clustering ?
288298
289 - if (analyzer.useSuffixAsCategory()) {
290 - CharSequence sfx = analyzerPage.getTitleSuffix();
291 - if (sfx!=null) storeConceptBroader(rcId, conceptId, name, analyzer.normalizeTitle(sfx).toString(), ExtractionRule.BROADER_FROM_SUFFIX);
292 - }
 299+ storeSuffixInfo(analyzerPage, rcId, conceptId, name);
293300
294301 //NOTE: can't really happen here (only applicable for sections)
295302 //CharSequence pfx = analyzerPage.getTitlePrefix();
@@ -567,5 +574,37 @@
568575 storeConceptAlias(rcId, -1, supp.toString(), cid, name, AliasScope.SUPPLEMENT);
569576 }
570577 }
 578+
 579+ public boolean isStoreDefinitions() {
 580+ return storeDefinitions;
 581+ }
 582+
 583+ public void setStoreDefinitions(boolean storeDefinitions) {
 584+ this.storeDefinitions = storeDefinitions;
 585+ }
 586+
 587+ public boolean isStoreFlatText() {
 588+ return storeFlatText;
 589+ }
 590+
 591+ public void setStoreFlatText(boolean storeFlatText) {
 592+ this.storeFlatText = storeFlatText;
 593+ }
 594+
 595+ public boolean isStoreProperties() {
 596+ return storeProperties;
 597+ }
 598+
 599+ public void setStoreProperties(boolean storeProperties) {
 600+ this.storeProperties = storeProperties;
 601+ }
 602+
 603+ public boolean isStoreRawText() {
 604+ return storeRawText;
 605+ }
 606+
 607+ public void setStoreRawText(boolean storeRawText) {
 608+ this.storeRawText = storeRawText;
 609+ }
571610
572611 }

Status & tagging log