public function getVocabulary($tid)
 {
     global $conf;
     $sql = sprintf("SELECT c.vid FROM canonical AS c WHERE c.tid = %s LIMIT 0,1", $tid);
     $result = DatabaseBuddy::query($sql);
     $row = mysql_fetch_assoc($result);
     return $conf['vocab_names'][$row['vid']];
 }
Beispiel #2
0
 protected function term_query($word_arr)
 {
     global $conf;
     $vocab_names = $conf['vocab_names'];
     if (!empty($this->vocabularies) && !empty($word_arr)) {
         $imploded_words = implode("','", $word_arr);
         $unmatched = array_flip($word_arr);
         $sql = sprintf("SELECT l.name AS matchword, c.name AS name, l.vid, l.tid, COUNT(l.tid) AS count FROM lookup AS l JOIN canonical AS c ON c.tid = l.tid  WHERE l.vid IN (%s) AND BINARY l.name IN('%s') GROUP BY BINARY l.name", $this->vocabularies, $imploded_words);
         $result = DatabaseBuddy::query($sql);
         while ($row = mysql_fetch_assoc($result)) {
             if (array_key_exists($row['name'], $unmatched)) {
                 unset($unmatched[$row['name']]);
             }
             if (isset($row['synonym']) && array_key_exists($row['synonym'], $unmatched)) {
                 unset($unmatched[$row['synonym']]);
             }
             $this->matches[$vocab_names[$row['vid']]][$row['tid']] = array('navn' => $row['name'], 'match' => $row['matchword'], 'hits' => $row['count']);
         }
         $this->nonmatches = array_flip($unmatched);
     }
 }
Beispiel #3
0
 private function incrementWordCount($word)
 {
     $sql = sprintf("UPDATE unmatched SET count = count+1, updated = CURRENT_TIMESTAMP WHERE name ='%s';", $word);
     $result = DatabaseBuddy::query($sql);
 }
 private function fetchUris($tid)
 {
     global $conf;
     $sql = sprintf("SELECT dstid, uri FROM linked_data_sources WHERE tid = %s ORDER BY dstid ASC", $tid);
     $result = DatabaseBuddy::query($sql);
     $uris = array();
     while ($row = mysql_fetch_assoc($result)) {
         $uris[$conf['lod_sources'][$row['dstid']]] = $row['uri'];
     }
     return $uris;
 }