Exemple #1
0
 }
 if ($pos_id) {
     $query_lang_pos .= " and pos_id=" . (int) $pos_id;
 }
 if ($page_title) {
     $query_lang_pos .= " and page_title like '%{$page_title}%'";
 }
 $query_lang_pos .= " order by page_title, id";
 // LIMIT $limit
 //print $query_lang_pos;
 $result_lang_pos = $link_db->query_e($query_lang_pos, "Query failed in file <b>" . __FILE__ . "</b>, string <b>" . __LINE__ . "</b>");
 //print $link_db -> query_count($result_lang_pos);
 print "<table border=1>\n";
 $counter = 0;
 while ($counter < $limit && ($row = $result_lang_pos->fetch_object())) {
     $lang_pos = TLangPOS::getByID($row->id);
     // 2. get array of meanings
     $meaning_arr = $lang_pos->getMeaning();
     if (is_array($meaning_arr)) {
         foreach ($meaning_arr as $meaning_obj) {
             // 3. get array of relations
             $relation_arr = $meaning_obj->getRelation();
             if (is_array($relation_arr)) {
                 foreach ($relation_arr as $relation_obj) {
                     $relation_type = $relation_obj->getRelationType();
                     //print "<p>".$relation_type->getID();
                     // 4. filter by relation type
                     if ($relation_type_id && $relation_type->getID() != $relation_type_id) {
                         continue;
                     }
                     // 5. get relation word by $wiki_text_id
Exemple #2
0
print "lang_id_ru = {$lang_id_ru}<BR>";
$pos_id_noun = TPOS::getIDByName($pos_all, "noun");
$pos_id_noun_class = TPOS::getIDByName($pos_all, "noun class");
print "ID of part of speech \"noun\" = {$pos_id_noun}<BR>";
print "ID of part of speech \"noun class\" = {$pos_id_noun_class}<BR>";
$relation_type_id_hyponyms = TRelationType::getIDByName($relation_type_all, "hyponyms");
$relation_type_id_hypernyms = TRelationType::getIDByName($relation_type_all, "hypernyms");
print "ID of relation type \"hyponyms\" = {$relation_type_id_hyponyms}<BR>";
print "ID of relation type \"hypernyms\" = {$relation_type_id_hypernyms}<BR>";
print "<BR>";
$query_lang_pos = "SELECT id FROM lang_pos";
$result_lang_pos = mysqli_query($LINK_DB, $query_lang_pos) or die("Query failed (line 39) in list_hypo.php: " . mysqli_error() . ". Query: " . $query);
$counter = 0;
while ($row = mysqli_fetch_array($result_lang_pos)) {
    $lang_pos_id = $row['id'];
    $lang_pos = TLangPOS::getByID($lang_pos_id, $lang_all, $pos_all);
    // 1. filter by part of speech
    $pos_id = $lang_pos->pos->id;
    // [39] => Array ( [id] => 39 [name] => noun )
    if ($pos_id != $pos_id_noun && $pos_id != $pos_id_noun_class) {
        continue;
    }
    // print "lang_pos_id = $lang_pos_id<BR>";
    // print "pos_id = $pos_id<BR>";
    // print " ".$lang_pos->page->page_title."; ".$lang_pos->pos->name."<BR>";
    // 2. get meaning.id by lang_pos_id
    $query_meaning = "SELECT id FROM meaning WHERE lang_pos_id=" . $lang_pos_id;
    $result_meaning = mysqli_query($LINK_DB, $query_meaning) or die("Query failed (line 58) in list_hypo.php: " . mysqli_error() . ". Query: " . $query_meaning);
    while ($row_m = mysqli_fetch_array($result_meaning)) {
        $meaning_id = $row_m['id'];
        // 3. get relation by meaning_id