Index: trunk/extensions/FreqPatternTagCloud/FreqPatternTagCloud.body.php |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | * Frequent Pattern Tag Cloud Plug-in |
5 | 5 | * Special page |
6 | 6 | * |
7 | | - * @author Tobias Beck, University of Heidelberg |
| 7 | + * @author Tobias Beck (TB), University of Heidelberg |
8 | 8 | * @author Andreas Fay, University of Heidelberg |
9 | 9 | * @version 1.0 |
10 | 10 | */ |
— | — | @@ -129,7 +129,8 @@ |
130 | 130 | public static function getSearchSuggestions( $currentSearchValue ) { |
131 | 131 | $dbr = wfGetDB( DB_SLAVE ); |
132 | 132 | |
133 | | - // Get possible attribute values |
| 133 | + // Get possible attribute values |
| 134 | + // TB: Include attribute values from table smw_atts2 |
134 | 135 | $res = $dbr->query( |
135 | 136 | "(SELECT DISTINCT vals.smw_title AS val, atts.smw_title AS att |
136 | 137 | FROM ".$dbr->tableName("smw_ids")." vals, ".$dbr->tableName("smw_ids")." atts, ".$dbr->tableName("smw_rels2")." rels |
— | — | @@ -141,8 +142,18 @@ |
142 | 143 | AND LENGTH(atts.smw_iw) = 0 |
143 | 144 | AND vals.smw_title LIKE '%".mysql_real_escape_string($currentSearchValue)."%' |
144 | 145 | ORDER BY vals.smw_title |
145 | | - LIMIT 20) UNION ( |
146 | | - SELECT smw_title AS val, '".mysql_real_escape_string(wfMsg("fptc-categoryname"))."' AS att |
| 146 | + LIMIT 14) |
| 147 | + UNION ( |
| 148 | + SELECT DISTINCT vals.value_xsd AS val, atts.smw_title AS att |
| 149 | + FROM ".$dbr->tableName("smw_atts2")." AS vals, ".$dbr->tableName("smw_ids")." AS atts |
| 150 | + WHERE vals.p_id = atts.smw_id |
| 151 | + AND atts.smw_namespace = 102 |
| 152 | + AND LENGTH(atts.smw_iw) = 0 |
| 153 | + AND value_xsd LIKE '%".mysql_real_escape_string($currentSearchValue)."%' |
| 154 | + ORDER BY value_xsd |
| 155 | + LIMIT 14) |
| 156 | + UNION ( |
| 157 | + SELECT smw_title AS val, '".mysql_real_escape_string(wfMsg("fptc-categoryname"))."' AS att |
147 | 158 | FROM ".$dbr->tableName("smw_ids")." |
148 | 159 | WHERE smw_title LIKE '%".mysql_real_escape_string($currentSearchValue)."%' |
149 | 160 | AND smw_namespace = 14 |
— | — | @@ -247,7 +258,8 @@ |
248 | 259 | |
249 | 260 | // Context menu |
250 | 261 | $wgOut->addHTML( |
251 | | - '<ul id="fptc_contextMenu" class="contextMenu"> |
| 262 | + '<div id="fptc_baseAttribute" style="display:none">' . $attribute . '</div> |
| 263 | + <ul id="fptc_contextMenu" class="contextMenu"> |
252 | 264 | <li class="browse"> |
253 | 265 | <a href="#browse">' . wfMsg( 'fptc-context-menu-browse' ) . '</a> |
254 | 266 | </li> |
— | — | @@ -284,32 +296,39 @@ |
285 | 297 | private function printTag( Tag $tag, $attribute ) { |
286 | 298 | global $wgOut; |
287 | 299 | |
288 | | - $wgOut->addHTML( |
| 300 | + if ($attribute == wfMsg( 'fptc-categoryname' )) { |
| 301 | + $wgOut->addHTML( |
289 | 302 | sprintf( |
290 | | - '<div class="fptc_tag" style="font-size:%dpx;">%s</div>', |
291 | | - $this->fontSizeMin + ( $this->fontSizeMax - $this->fontSizeMin ) * $tag->getRate(), |
292 | | - $attribute == wfMsg( 'fptc-categoryname' ) |
293 | | - ? $wgOut->parseInline( |
| 303 | + '<div class="fptc_tag" style="font-size:%dpx;">', |
| 304 | + $this->fontSizeMin + ( $this->fontSizeMax - $this->fontSizeMin ) * $tag->getRate()) . |
| 305 | + $this->sandboxParse( |
| 306 | + // $wgOut->parseInline( |
294 | 307 | sprintf( |
295 | 308 | '[[:%s:%s|%s]]', |
296 | 309 | self::CATEGORY_PAGE, |
297 | 310 | $tag->getValue(), |
298 | 311 | $tag->getValue() |
299 | 312 | ) |
300 | | - ) |
301 | | - : $wgOut->parseInline( |
302 | | - sprintf( |
303 | | - '[[:%s:%s/%s/%s|%s]]', |
304 | | - self::SPECIALPAGE_PREFIX, |
305 | | - self::ATTRIBUTE_VALUE_INDEX_SPECIALPAGE, |
306 | | - $attribute, |
307 | | - $tag->getValue(), |
308 | | - $tag->getValue() |
309 | | - ) |
310 | | - ) |
311 | | - ) |
312 | | - ); |
| 313 | + ) . '</div>'); |
| 314 | + } else { |
| 315 | + $wgOut->addHTML( |
| 316 | + sprintf('<div class="fptc_tag" style="font-size:%dpx;">', |
| 317 | + $this->fontSizeMin + ( $this->fontSizeMax - $this->fontSizeMin ) * $tag->getRate()) . |
| 318 | + html::element( 'a', array('href' => |
| 319 | + SpecialPage::getTitleFor( self::ATTRIBUTE_VALUE_INDEX_SPECIALPAGE)->getLinkURL( |
| 320 | + array('property' => $attribute, 'value' => $tag->getValue()))), $tag->getValue()) . |
| 321 | + '</div>' |
| 322 | + ); |
| 323 | + } |
313 | 324 | } |
| 325 | + |
| 326 | + private function sandboxParse($wikiText) { |
| 327 | + global $wgTitle, $wgUser; |
| 328 | + $myParser = new Parser(); |
| 329 | + $myParserOptions = ParserOptions::newFromUser($wgUser); |
| 330 | + $result = $myParser->parse($wikiText, $wgTitle, $myParserOptions); |
| 331 | + return $result->getText(); |
| 332 | + } |
314 | 333 | |
315 | 334 | /** |
316 | 335 | * Prints the result of the search for attribute <code>attribute</code> to |
— | — | @@ -343,6 +362,7 @@ |
344 | 363 | '<a href=' . $possibleAttribute . '>' . |
345 | 364 | $possibleAttribute . '</a>' |
346 | 365 | ); |
| 366 | + |
347 | 367 | if ( $w < count( $proposal->getProposal() ) ) { |
348 | 368 | $wgOut->addHTML( ', ' ); |
349 | 369 | } |
Index: trunk/extensions/FreqPatternTagCloud/includes/computation/FrequentPatternApriori.php |
— | — | @@ -21,55 +21,58 @@ |
22 | 22 | return array(); |
23 | 23 | } |
24 | 24 | else { |
25 | | - // Get all 1-frequent itemsets |
26 | | - foreach ($items as $item) { |
27 | | - $freq = 0; |
28 | | - foreach ($transactions as $transaction) { |
29 | | - if (in_array($item, $transaction)) { |
30 | | - $freq++; |
31 | | - } |
32 | | - } |
33 | | - |
34 | | - if ((float)$freq / $numTransactions >= $minSupport) { |
35 | | - $allFrequentItemsets[] = new FrequentItemset(array($item), (float)$freq / $numTransactions); |
36 | | - } |
37 | | - } |
38 | | - |
39 | | - // Now compute all k-frequent itemsets |
40 | | - $freqK_1Itemsets = $allFrequentItemsets; |
41 | | - while (count($freqK_1Itemsets) > 0) { |
42 | | - $freqKItemsets = $this->generateCandidates($freqK_1Itemsets); |
43 | | - |
44 | | - $freqK_1Itemsets = array(); |
45 | | - |
46 | | - // Check support for each candidate |
47 | | - foreach ($freqKItemsets as $freqItemset) { |
| 25 | + // Get all 1-frequent itemsets |
| 26 | + foreach ($items as $item) { |
| 27 | + set_time_limit(0); |
48 | 28 | $freq = 0; |
49 | 29 | foreach ($transactions as $transaction) { |
50 | | - $inArray = true; |
51 | | - foreach ($freqItemset->getItems() as $item) { |
52 | | - if (!in_array($item, $transaction)) { |
53 | | - $inArray = false; |
54 | | - break; |
55 | | - } |
56 | | - } |
57 | | - |
58 | | - if ($inArray) { |
| 30 | + if (in_array($item, $transaction)) { |
59 | 31 | $freq++; |
60 | 32 | } |
61 | 33 | } |
62 | 34 | |
63 | 35 | if ((float)$freq / $numTransactions >= $minSupport) { |
64 | | - $freqItemset->setSupport((float)$freq / $numTransactions); |
65 | | - $freqK_1Itemsets[] = $allFrequentItemsets[] = $freqItemset; |
66 | | - } else { |
67 | | - unset($freqItemset); |
| 36 | + $allFrequentItemsets[] = new FrequentItemset(array($item), (float)$freq / $numTransactions); |
68 | 37 | } |
69 | 38 | } |
| 39 | + |
| 40 | + // Now compute all k-frequent itemsets |
| 41 | + $freqK_1Itemsets = $allFrequentItemsets; |
| 42 | + while (count($freqK_1Itemsets) > 0) { |
| 43 | + $freqKItemsets = $this->generateCandidates($freqK_1Itemsets); |
| 44 | + |
| 45 | + $freqK_1Itemsets = array(); |
| 46 | + |
| 47 | + // Check support for each candidate |
| 48 | + foreach ($freqKItemsets as $freqItemset) { |
| 49 | + set_time_limit(0); |
| 50 | + $freq = 0; |
| 51 | + foreach ($transactions as $transaction) { |
| 52 | + set_time_limit(0); |
| 53 | + $inArray = true; |
| 54 | + foreach ($freqItemset->getItems() as $item) { |
| 55 | + if (!in_array($item, $transaction)) { |
| 56 | + $inArray = false; |
| 57 | + break; |
| 58 | + } |
| 59 | + } |
| 60 | + |
| 61 | + if ($inArray) { |
| 62 | + $freq++; |
| 63 | + } |
| 64 | + } |
| 65 | + |
| 66 | + if ((float)$freq / $numTransactions >= $minSupport) { |
| 67 | + $freqItemset->setSupport((float)$freq / $numTransactions); |
| 68 | + $freqK_1Itemsets[] = $allFrequentItemsets[] = $freqItemset; |
| 69 | + } else { |
| 70 | + unset($freqItemset); |
| 71 | + } |
| 72 | + } |
| 73 | + } |
| 74 | + |
| 75 | + return $allFrequentItemsets; |
70 | 76 | } |
71 | | - |
72 | | - return $allFrequentItemsets; |
73 | | - } |
74 | 77 | } |
75 | 78 | |
76 | 79 | |
— | — | @@ -85,6 +88,7 @@ |
86 | 89 | $freqItemsetA = $freqK_1Itemsets[$a]; |
87 | 90 | |
88 | 91 | for ($b = $a + 1; $b < count($freqK_1Itemsets); $b++) { |
| 92 | + set_time_limit(0); |
89 | 93 | $freqItemsetB = $freqK_1Itemsets[$b]; |
90 | 94 | |
91 | 95 | // Check whether they have i=k-2 items in common |
Index: trunk/extensions/FreqPatternTagCloud/includes/computation/FrequentPatternAlgorithm.php |
— | — | @@ -26,7 +26,8 @@ |
27 | 27 | $numerator = 0; |
28 | 28 | $denominator = 0; |
29 | 29 | foreach ($transactions as $transaction) { |
30 | | - // For each occurrence of the assumption -> increase denominator |
| 30 | + set_time_limit(0); |
| 31 | + // For each occurence of the assumption -> increase denominator |
31 | 32 | // If the conclusion occurs too -> increase numerator |
32 | 33 | |
33 | 34 | // Check if transaction contains assumption |
— | — | @@ -84,7 +85,8 @@ |
85 | 86 | $count = count($itemset); |
86 | 87 | $members = pow(2,$count); |
87 | 88 | $powerset = array(); |
88 | | - for ($i = 0; $i < $members; $i++) { |
| 89 | + for ($i = 0; $i < $members; $i++) { |
| 90 | + set_time_limit(0); |
89 | 91 | $b = sprintf("%0".$count."b",$i); |
90 | 92 | $out = array(); |
91 | 93 | for ($j = 0; $j < $count; $j++) { |
— | — | @@ -122,6 +124,7 @@ |
123 | 125 | |
124 | 126 | // Generate subset A of X where X is frequent itemset such that A => (X-A) |
125 | 127 | foreach ($this->computePowerSet($itemset->getItems()) as $subsetOfX) { |
| 128 | + set_time_limit(0); |
126 | 129 | if (count($subsetOfX) == 0 || $subsetOfX == $itemset->getItems()) { |
127 | 130 | // Ignore empty set and identity |
128 | 131 | continue; |
Index: trunk/extensions/FreqPatternTagCloud/includes/TagCloud.php |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | * Frequent Pattern Tag Cloud Plug-in |
6 | 6 | * TagCloud |
7 | 7 | * |
8 | | - * @author Tobias Beck, University of Heidelberg |
| 8 | + * @author Tobias Beck (TB), University of Heidelberg |
9 | 9 | * @author Andreas Fay, University of Heidelberg |
10 | 10 | * @version 1.0 |
11 | 11 | */ |
— | — | @@ -94,9 +94,12 @@ |
95 | 95 | $res = $dbr->query("SELECT SUM(cat_pages) |
96 | 96 | FROM ".$dbr->tableName("category")); |
97 | 97 | } else { |
98 | | - $res = $dbr->query("SELECT COUNT(1) |
99 | | - FROM ".$dbr->tableName("smw_rels2")." |
100 | | - WHERE p_id = ".mysql_real_escape_string($this->_attributeId)); |
| 98 | + // TB: Select only relevant tags in table smw_atts2 through JOIN with table smw_ids |
| 99 | + $res = $dbr->query("SELECT SUM(num) |
| 100 | + FROM ((SELECT COUNT(1) num FROM ".$dbr->tableName("smw_rels2")." WHERE p_id = ".mysql_real_escape_string($this->_attributeId).") |
| 101 | + UNION (SELECT COUNT(1) num FROM ".$dbr->tableName("smw_atts2")." AS a |
| 102 | + INNER JOIN ".$dbr->tableName("smw_ids")." AS i ON i.smw_id = a.p_id |
| 103 | + WHERE (i.smw_namespace <> 102 OR length(i.smw_iw) = 0) AND p_id = ".mysql_real_escape_string($this->_attributeId).")) t"); |
101 | 104 | } |
102 | 105 | |
103 | 106 | $row = $res->fetchRow(); |
— | — | @@ -116,11 +119,17 @@ |
117 | 120 | AND LENGTH(smw_iw) = 0 |
118 | 121 | ORDER BY smw_title"); |
119 | 122 | } else { |
| 123 | + // TB: Get tags also from table smw_atts2 |
120 | 124 | $res = $dbr->query("SELECT smw_id, smw_title, (SELECT COUNT(1) FROM ".$dbr->tableName("smw_rels2")." WHERE o_id = smw_id AND p_id = ".mysql_real_escape_string($this->_attributeId).")/$numValues AS rate |
121 | | - FROM ".$dbr->tableName("smw_ids")." |
122 | | - WHERE smw_namespace = 0 |
123 | | - AND LENGTH(smw_iw) = 0 |
124 | | - AND smw_id <> ".mysql_real_escape_string($this->_attributeId)." |
| 125 | + FROM ".$dbr->tableName("smw_ids")." |
| 126 | + WHERE smw_namespace = 0 |
| 127 | + AND LENGTH(smw_iw) = 0 |
| 128 | + AND smw_id <> ".mysql_real_escape_string($this->_attributeId)." |
| 129 | + UNION |
| 130 | + SELECT 'atts2', a.value_xsd as smw_title, (SELECT COUNT(1) FROM ".$dbr->tableName("smw_atts2")." WHERE value_xsd = a.value_xsd AND p_id = ".mysql_real_escape_string($this->_attributeId).")/$numValues AS rate |
| 131 | + FROM ".$dbr->tableName("smw_atts2")." AS a INNER JOIN |
| 132 | + ".$dbr->tableName("smw_ids")." AS i ON i.smw_id = a.p_id |
| 133 | + WHERE (i.smw_namespace <> 102 OR length(i.smw_iw) = 0) AND p_id = ".mysql_real_escape_string($this->_attributeId)." |
125 | 134 | ORDER BY smw_title"); |
126 | 135 | } |
127 | 136 | |
Index: trunk/extensions/FreqPatternTagCloud/includes/FrequentPattern.php |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | * Frequent Pattern Tag Cloud Plug-in |
6 | 6 | * Frequent pattern functions |
7 | 7 | * |
8 | | - * @author Tobias Beck, University of Heidelberg |
| 8 | + * @author Tobias Beck (TB), University of Heidelberg |
9 | 9 | * @author Andreas Fay, University of Heidelberg |
10 | 10 | * @version 1.0 |
11 | 11 | */ |
— | — | @@ -80,6 +80,10 @@ |
81 | 81 | $res = $dbr->query("SELECT GROUP_CONCAT(DISTINCT o_id) |
82 | 82 | FROM ".$dbr->tableName("smw_rels2")." |
83 | 83 | WHERE p_id = ".mysql_real_escape_string($attributeId)." |
| 84 | + GROUP BY p_id |
| 85 | + UNION SELECT GROUP_CONCAT(DISTINCT value_xsd) |
| 86 | + FROM ".$dbr->tableName("smw_atts2")." |
| 87 | + WHERE p_id = ".mysql_real_escape_string($attributeId)." |
84 | 88 | GROUP BY p_id"); |
85 | 89 | } |
86 | 90 | $row = $res->fetchRow(); |
— | — | @@ -94,9 +98,15 @@ |
95 | 99 | AND ids.smw_namespace = 14 |
96 | 100 | GROUP BY catlinks.cl_from"); |
97 | 101 | } else { |
| 102 | + // TB: Table smw_rels2 and smw_atts2 are independent because s_id appears only in one of both tables at a time |
98 | 103 | $res = $dbr->query("SELECT GROUP_CONCAT(o_id) |
99 | 104 | FROM ".$dbr->tableName("smw_rels2")." |
100 | 105 | WHERE p_id = ".mysql_real_escape_string($attributeId)." |
| 106 | + GROUP BY s_id |
| 107 | + UNION SELECT GROUP_CONCAT(value_xsd) |
| 108 | + FROM ".$dbr->tableName("smw_atts2")." As a |
| 109 | + INNER JOIN ".$dbr->tableName("smw_ids")." AS i ON i.smw_id = a.p_id |
| 110 | + WHERE (i.smw_namespace <> 102 OR length(i.smw_iw) = 0) AND p_id = ".mysql_real_escape_string($attributeId)." |
101 | 111 | GROUP BY s_id"); |
102 | 112 | } |
103 | 113 | $transactions = array(); |
— | — | @@ -116,12 +126,12 @@ |
117 | 127 | |
118 | 128 | foreach ($rule->getAssumption() as $item) { |
119 | 129 | $dbw->query("INSERT INTO ".$dbw->tableName("fptc_items")." (o_id, rule_id, item_order) |
120 | | - VALUES (".mysql_real_escape_string($item).", ".mysql_real_escape_string($ruleId).", 0)"); |
| 130 | + VALUES ('".mysql_real_escape_string($item)."', ".mysql_real_escape_string($ruleId).", 0)"); |
121 | 131 | } |
122 | 132 | |
123 | 133 | foreach ($rule->getConclusion() as $item) { |
124 | 134 | $dbw->query("INSERT INTO ".$dbw->tableName("fptc_items")." (o_id, rule_id, item_order) |
125 | | - VALUES (".mysql_real_escape_string($item).", ".mysql_real_escape_string($ruleId).", 1)"); |
| 135 | + VALUES ('".mysql_real_escape_string($item)."', ".mysql_real_escape_string($ruleId).", 1)"); |
126 | 136 | } |
127 | 137 | } |
128 | 138 | |
— | — | @@ -166,7 +176,8 @@ |
167 | 177 | $attributeId = $row[0]; |
168 | 178 | $res->free(); |
169 | 179 | |
170 | | - // Get id of assumption |
| 180 | + // Get id of assumption from table smw_ids |
| 181 | + // TB: Or name of assumtion from table smw_atts2 |
171 | 182 | if (wfMsg("fptc-categoryname") == $attribute) { |
172 | 183 | $res = $dbr->query("SELECT smw_id |
173 | 184 | FROM ".$dbr->tableName("smw_ids")." |
— | — | @@ -174,11 +185,15 @@ |
175 | 186 | AND smw_namespace = 14 |
176 | 187 | AND LENGTH(smw_iw) = 0"); |
177 | 188 | } else { |
178 | | - $res = $dbr->query("SELECT smw_id |
179 | | - FROM ".$dbr->tableName("smw_ids")." |
180 | | - WHERE smw_title = '".mysql_real_escape_string($assumption)."' |
181 | | - AND smw_namespace = 0 |
182 | | - AND LENGTH(smw_iw) = 0"); |
| 189 | + $res = $dbr->query("(SELECT smw_id |
| 190 | + FROM ".$dbr->tableName("smw_ids")." |
| 191 | + WHERE smw_title = '".mysql_real_escape_string($assumption)."' |
| 192 | + AND smw_namespace = 0 |
| 193 | + AND LENGTH(smw_iw) = 0) |
| 194 | + UNION |
| 195 | + (SELECT a.value_xsd FROM ".$dbr->tableName("smw_atts2")." AS a INNER JOIN ".$dbr->tableName("smw_ids")." AS i ON i.smw_id = a.p_id |
| 196 | + WHERE (i.smw_namespace <> 102 OR length(i.smw_iw) = 0) AND a.value_xsd = '".mysql_real_escape_string($assumption)."') |
| 197 | + ORDER BY smw_id desc"); |
183 | 198 | } |
184 | 199 | $row = $res->fetchRow(); |
185 | 200 | $assumptionId = $row[0]; |
— | — | @@ -189,18 +204,23 @@ |
190 | 205 | FROM ".$dbr->tableName("fptc_associationrules")." rules, ".$dbr->tableName("fptc_items")." items |
191 | 206 | WHERE rules.rule_id = items.rule_id |
192 | 207 | AND item_order = 0 |
193 | | - AND o_id = ".mysql_real_escape_string($assumptionId)." |
| 208 | + AND o_id = '".mysql_real_escape_string($assumptionId)."' |
194 | 209 | AND NOT EXISTS( SELECT 1 FROM ".$dbr->tableName("fptc_items")." WHERE rule_id = rules.rule_id AND item_order = 0 AND o_id != items.o_id ) |
195 | 210 | ORDER BY rule_support DESC, rule_confidence DESC"); |
196 | 211 | $conclusions = array(); |
197 | 212 | while ($row = $res->fetchRow()) { |
198 | 213 | // Get conclusions |
199 | | - $resItems = $dbr->query("SELECT smw_title |
| 214 | + $resItems = $dbr->query("(SELECT smw_title |
200 | 215 | FROM ".$dbr->tableName("smw_ids")." ids, ".$dbr->tableName("fptc_items")." items |
201 | 216 | WHERE ids.smw_id = items.o_id |
202 | 217 | AND item_order = 1 |
203 | | - AND rule_id = ".mysql_real_escape_string($row['rule_id'])); |
204 | | - |
| 218 | + AND rule_id = ".mysql_real_escape_string($row['rule_id']).") |
| 219 | + UNION |
| 220 | + (SELECT value_xsd AS smw_title FROM ".$dbr->tableName("smw_atts2")." atts2, ".$dbr->tableName("fptc_items")." items |
| 221 | + WHERE atts2.value_xsd = items.o_id |
| 222 | + AND item_order = 1 |
| 223 | + AND rule_id = ".mysql_real_escape_string($row['rule_id']).")"); |
| 224 | + |
205 | 225 | // Only consider rules with single conclusion |
206 | 226 | if ($resItems->numRows() > 1) { |
207 | 227 | continue; |
— | — | @@ -217,6 +237,7 @@ |
218 | 238 | |
219 | 239 | /** |
220 | 240 | * Shows all rules (for debugging purposes) |
| 241 | + * TB: Attention, attribute types which are saved in table smw_atts2 are not yet considered here |
221 | 242 | * |
222 | 243 | * @return void |
223 | 244 | * @throws SQLException |
Index: trunk/extensions/FreqPatternTagCloud/javascripts/main.js |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | * Frequent Pattern Tag Cloud Plug-in |
4 | 4 | * Main javascript |
5 | 5 | * |
6 | | - * @author Tobias Beck, University of Heidelberg |
| 6 | + * @author Tobias Beck (TB), University of Heidelberg |
7 | 7 | * @author Andreas Fay, University of Heidelberg |
8 | 8 | * @version 1.0 |
9 | 9 | */ |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | } |
30 | 30 | }); |
31 | 31 | |
32 | | - var attribute = $j("#fptc_attributeName").val(); |
| 32 | + var attribute = $j("#fptc_baseAttribute").text(); |
33 | 33 | |
34 | 34 | // Context menu for tag cloud |
35 | 35 | $j(".fptc_tag a").contextMenu({ |
— | — | @@ -46,9 +46,14 @@ |
47 | 47 | } |
48 | 48 | }, function(action, el, pos, menu) { |
49 | 49 | if (action == "browse") { |
50 | | - window.location = el.attr("href"); |
| 50 | + window.location = el.attr("href"); |
51 | 51 | } else if (action == "browse_similar_tag") { |
52 | | - window.location = el.attr("href").replace(new RegExp(encodeURI(el.text())), menu.attr("title")); |
| 52 | + // TB: Changes due to the support of all attribute types |
| 53 | + var newDirName = menu.attr("title"); |
| 54 | + var oldDirName = el.text(); |
| 55 | + // Construct the corresponding URL |
| 56 | + // window.location = el.attr("href").replace(new RegExp(encodeURI(el.text())), menu.attr("title")); |
| 57 | + window.location = el.attr("href").replace(oldDirName, newDirName); |
53 | 58 | } |
54 | 59 | }); |
55 | 60 | |
— | — | @@ -62,4 +67,4 @@ |
63 | 68 | }); |
64 | 69 | } |
65 | 70 | }); |
66 | | -}); |
\ No newline at end of file |
| 71 | +}); |
Index: trunk/extensions/FreqPatternTagCloud/javascripts/jquery.parseJSON.js |
— | — | @@ -0,0 +1,36 @@ |
| 2 | +jQuery( document ).ready( function( $ ) { |
| 3 | + |
| 4 | +/** |
| 5 | + * Frequent Pattern Tag Cloud Plug-in |
| 6 | + * Addition of parseJSON for older jQuery versions |
| 7 | + * |
| 8 | + * @author Tobias Beck, University of Heidelberg |
| 9 | + * @author Andreas Fay, University of Heidelberg |
| 10 | + * @version 1.0 |
| 11 | + */ |
| 12 | + |
| 13 | +/** |
| 14 | + * Enable parseJSON |
| 15 | + */ |
| 16 | + if (!$j.parseJSON) { ( function() { |
| 17 | + $j.extend({ |
| 18 | + parseJSON: function( data ) { |
| 19 | + if ( typeof data !== "string" || !data ) { |
| 20 | + return null; |
| 21 | + } |
| 22 | + data = jQuery.trim( data ); |
| 23 | + if ( /^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@") |
| 24 | + .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]") |
| 25 | + .replace(/(?:^|:|,)(?:\s*\[)+/g, "")) ) { |
| 26 | + return window.JSON && window.JSON.parse ? |
| 27 | + window.JSON.parse( data ) : |
| 28 | + (new Function("return " + data))(); |
| 29 | + } else { |
| 30 | + jQuery.error( "Invalid JSON: " + data ); |
| 31 | + } |
| 32 | + } |
| 33 | + }); |
| 34 | + |
| 35 | + })(jQuery); |
| 36 | +} |
| 37 | +}); |
Property changes on: trunk/extensions/FreqPatternTagCloud/javascripts/jquery.parseJSON.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 38 | + native |
Index: trunk/extensions/FreqPatternTagCloud/freqpatterntagcloud.sql |
— | — | @@ -8,7 +8,7 @@ |
9 | 9 | CREATE INDEX /*i*/p_id ON /*_*/fptc_associationrules (p_id); |
10 | 10 | |
11 | 11 | CREATE TABLE IF NOT EXISTS /*_*/fptc_items ( |
12 | | - `o_id` INT(8) NOT NULL, |
| 12 | + `o_id` varbinary(255) NOT NULL, |
13 | 13 | `rule_id` INT NOT NULL, |
14 | 14 | `item_order` TINYINT(1) NOT NULL, |
15 | 15 | PRIMARY KEY ( `o_id` , `rule_id` ) |