r68770 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68769‎ | r68770 | r68771 >
Date:12:59, 30 June 2010
Author:daniel
Status:deferred
Tags:
Comment:
fix the way concept types get agregated in the global thesaurus
Modified paths:
  • /trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/ConceptType.java (modified) (history)
  • /trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseGlobalConceptStoreBuilder.java (modified) (history)

Diff [purge]

Index: trunk/WikiWord/WikiWord/src/main/java/de/brightbyte/wikiword/ConceptType.java
@@ -117,9 +117,21 @@
118118 //this.uri = WikiWord.conceptTypeURI(this.getName());
119119 }
120120
121 - public static boolean isWeak(int t) {
122 - return (t==UNKNOWN.code || t==OTHER.code || t==ALIAS.code);
 121+ public boolean weakerThan(ConceptType t) {
 122+ return weakerThan(code, t.code);
123123 }
 124+
 125+ public static boolean weakerThan(int a, int b) {
 126+ if (a==UNKNOWN.code) {
 127+ return b != UNKNOWN.code;
 128+ } else if (a==ALIAS.code) {
 129+ return b != UNKNOWN.code && b != ALIAS.code;
 130+ } else if (a==OTHER.code) {
 131+ return b != UNKNOWN.code && b != ALIAS.code && b != OTHER.code;
 132+ }
 133+
 134+ return false;
 135+ }
124136
125137 public String getName() {
126138 return name;
Index: trunk/WikiWord/WikiWordBuilder/src/main/java/de/brightbyte/wikiword/store/builder/DatabaseGlobalConceptStoreBuilder.java
@@ -592,8 +592,8 @@
593593
594594 int type;
595595 if (leftType==rightType) type = rightType;
596 - else if (ConceptType.isWeak(leftType)) type = rightType;
597 - else if (ConceptType.isWeak(rightType)) type = leftType;
 596+ else if (ConceptType.weakerThan(leftType, rightType)) type = rightType;
 597+ else if (ConceptType.weakerThan(rightType, leftType)) type = leftType;
598598 else {
599599 storeWarning(-1, "conflicting concept types during merge",
600600 "concept "+leftName+" has type "+getConceptType(leftType)+", "

Status & tagging log