//if ($curr_word == "" || strtolower($curr_word) != strtolower($w)) // $curr_word = $w; if ($i % 1000 == 0) { print strftime("%H:%M:%S") . " -- word {$i}...<br>"; flush(); } $i++; $word_id = $db->f('word_id'); #print $db->f('meaning_id')."\n"; $synset = getSynsetWithUsage($db->f('meaning_id')); $syn_line = getLine($synset, $w, ''); $generic_line = ""; # superordinate concepts: if ($min_depth != -1) { #startTimer(); $depth = sizeof(getSuperordinateSynsets($db2, $db->f('meaning_id'))); if ($i % 1000 == 0) { #print "getSuperordinateSynsets: "; #endTimer(); #print "<br>"; } if ($depth >= $min_depth) { $generic_synset = getSynsetWithUsage($db->f('super_id')); if (sizeof($generic_synset) > 0) { $generic_line = getLine($generic_synset, $w, $generic_term); $generic_line = substr($generic_line, 1); # cut off "-" #print $syn_line.$generic_line."<br>"; } } }
function printSubordinateSynsets($db, $inner_db, $id, $top_id) { $open_ids = array(); array_push($open_ids, $top_id); if (array_key_exists('id', $_GET)) { foreach (getSuperordinateSynsets($inner_db, $_GET['id']) as $tmp_id) { array_push($open_ids, $tmp_id); } } print "\t<ul class=\"tree\">\n"; $sub_ids = getSubordinateSynsets($db, $id); $i = 0; $openall = 0; if (array_key_exists('openall', $_GET) && $_GET['openall'] == 1) { $openall = 1; } foreach ($sub_ids as $sub_id) { $open = 0; if ($openall == 1) { $open = 1; } $has_sub_synsets = 1; if (sizeof(getSubordinateSynsets($db, $sub_id)) == 0) { $has_sub_synsets = 0; } $anchor = ""; if (array_key_exists('id', $_GET) && $_GET['id'] == $sub_id) { $open = 1; $anchor = '<a name="position"></a>'; } else { if (array_search($sub_id, $open_ids)) { $open = 1; } } print "\t<li>{$anchor}"; if (!$has_sub_synsets) { print "<tt>[ ]</tt> "; } else { if ($open) { print "<a class=\"openplus\" href=\"tree.php?id={$id}#position\"><tt>[-]</tt></a> "; } else { print "<a class=\"openplus\" href=\"tree.php?id={$sub_id}#position\" " . "title=\"" . T_("Show subordinate meanings") . "\"><tt>[+]</tt></a> "; } } print "<a href=\"synset.php?id={$sub_id}\">"; if ($open) { print "<b>" . getJoinedSynset($sub_id) . "</b>"; } else { print getJoinedSynset($sub_id); } print "</a>\n"; if ($open) { printSubordinateSynsets($db, $inner_db, $sub_id, $top_id); } print "\t</li>\n"; $i++; } if ($i == 0 && $openall == 0) { // shouldn't happen - there's no such link print "\t<li>" . T_("No subordinate meanings defined yet") . "</li>\n"; } print "\t</ul>\n"; }
<?php include "../../include/phplib/prepend.php3"; page_open(array("sess" => "Thesaurus_Session", "auth" => "Thesaurus_Auth")); $db = new DB_Thesaurus(); $db_tmp = new DB_Thesaurus(); include "../../include/tool.php"; if ($auth->auth['uname'] != 'admin') { print "Access denied."; return; } $title = "OpenThesaurus admin interface: Loose synsets"; include "../../include/top.php"; print "<p>Searching synsets which have a superordinate synset but\nwhich are not below the top synset...</p>"; $query = sprintf("SELECT id FROM meanings WHERE hidden = 0"); $db->query($query); $i = 1; print "Checking " . $db->nf() . " meanings:<br />\n"; while ($db->next_record()) { $synsets = getSuperordinateSynsets($db_tmp, $db->f('id')); if (sizeof($synsets) > 0) { $top_id = $synsets[sizeof($synsets) - 1]; if (sizeof($synsets) > 0 && $top_id != TOP_SYNSET_ID) { print "{$i}. <a href=\"../synset.php?id=" . $db->f('id') . "\">" . join(', ', getSynset($db->f('id'), 3)) . "</a> is a " . "<a href=\"../synset.php?id=" . $top_id . "\">" . join(', ', getSynset($top_id, 3)) . "</a><br />\n"; $i++; } } } print "<hr />\n"; page_close();