Definition at line 176 of file SimilarityTableSetRepositoryInMonet.h. References Impala::FileNameBase(), Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Get1(), Impala::Persistency::SimilarityTableSetLocator::GetConceptSet(), Impala::Persistency::RepositoryInMonetDB::GetConnection(), Impala::Persistency::SimilarityTableSetLocator::GetContainer(), Impala::Persistency::Locator::GetDataSet(), Impala::Persistency::SimilarityTableSetLocator::GetFeature(), Impala::Core::Database::RawDataSet::GetFileId(), Impala::Persistency::SimilarityTableSetLocator::GetModel(), Impala::Core::Table::SimilarityTableSet::GetName(), Impala::Core::Table::SimilarityTableSet::GetQuidTable(), Impala::Core::VideoSet::VideoSet::GetQuidVideo(), Impala::Core::Table::SimilarityTableSet::GetSimTable(), ILOG_ERROR, ILOG_INFO, Impala::MakeString(), Impala::QUID_CLASS_FRAME, Impala::QuidClass(), Impala::QuidId(), RepMonet(), Impala::Core::Table::Table::Size(), and Impala::Timer::SplitTime(). Referenced by SaveSims(). 00178 { 00179 typedef SimilarityTableSet::SimTableType SimTableType; 00180 00181 Connection* conn = RepMonet().GetConnection(loc); 00182 00183 Core::VideoSet::VideoSet* vidSet = VideoSetRepository().Get(loc); 00184 int fileIdx = vidSet->GetFileId(loc.GetContainer()); 00185 Quid vidQuid = vidSet->GetQuidVideo(fileIdx, false); 00186 00187 SimTableType* simTable = simSet->GetSimTable(tableIdx); 00188 QuidTable* quidTab = simSet->GetQuidTable(); 00189 int bulkSize = 100000; 00190 Timer timer; 00191 for (int i=0 ; i<simTable->Size() ; i+=bulkSize) 00192 { 00193 int left = simTable->Size() - i; 00194 int nr = (left > bulkSize) ? bulkSize : left; 00195 String q = "copy " + MakeString(nr) + 00196 " records into i_bulk_score from stdin using delimiters ' ';\n"; 00197 for (int j=i ; j<i+nr ; j++) 00198 { 00199 Quid frameQuid = quidTab->Get1(j); 00200 if (QuidClass(frameQuid) != QUID_CLASS_FRAME) 00201 ILOG_ERROR("Quid is not a frame"); 00202 int frameNr = QuidId(frameQuid); 00203 00204 q += MakeString(vidQuid) + " " + MakeString(frameNr) + " " 00205 + MakeString(simTable->Get1(j)) + "\n"; 00206 } 00207 conn->Query(q, false, false); 00208 ILOG_INFO("Did bulk at " << timer.SplitTime()); 00209 } 00210 00211 String vidSetBase = FileNameBase(loc.GetDataSet()); 00212 String conceptSetBase = FileNameBase(loc.GetConceptSet()); 00213 String model = loc.GetModel(); 00214 String feature = loc.GetFeature(); 00215 String concept = simSet->GetName(tableIdx); 00216 00217 String q = "select i_add_feature('" + feature + "');"; 00218 ILOG_INFO("q = [" + q + "]"); 00219 conn->Query(q, false, false); 00220 00221 q = "select i_add_model('" + vidSetBase + "', '" + 00222 conceptSetBase + "', '" + concept + "', '" + model + 00223 "', '" + feature + "');"; 00224 ILOG_INFO("q = [" + q + "]"); 00225 conn->Query(q, false, false); 00226 00227 // a model is also a set with itself as element 00228 q = "select i_add_model_sets('" + vidSetBase + "', '" + 00229 conceptSetBase + "', '" + concept + "', '" + model + 00230 "', '" + feature + "');"; 00231 ILOG_INFO("q = [" + q + "]"); 00232 conn->Query(q, false, false); 00233 q = "select i_add_model_to_set('" + vidSetBase + "', '" + 00234 conceptSetBase + "', '" + concept + "', '" + model + 00235 "', '" + feature + "', '" + feature + "');"; 00236 ILOG_INFO("q = [" + q + "]"); 00237 conn->Query(q, false, false); 00238 00239 conn->Query("insert into score (fragment_id, model_sets_id, file_id, \ 00240 confidence) \ 00241 select fr.fragment_id, mss.model_sets_id, f.file_id, \ 00242 bs.confidence \ 00243 from video_sets vss, video_set vs, keyword_sets kss, \ 00244 keyword_set ks, keyword k, model_sets_name msn, \ 00245 model_sets mss, model_ref mr, \ 00246 file f, fragment fr, i_bulk_score bs \ 00247 where vss.set_name = '" + vidSetBase + "' and \ 00248 kss.set_name = '" + conceptSetBase + "' and \ 00249 kss.video_sets_id = vss.video_sets_id and \ 00250 msn.set_name = '" + feature + "' and \ 00251 mss.model_sets_name_id = msn.model_sets_name_id and \ 00252 k.keyword_name = '" + concept + "' and \ 00253 ks.keyword_sets_id = kss.keyword_sets_id and \ 00254 ks.keyword_id = k.keyword_id and \ 00255 mr.model_name = '" + model + "' and \ 00256 mr.keyword_set_id = ks.keyword_set_id and \ 00257 mr.model_ref_id = mss.model_ref_id and \ 00258 vs.video_sets_id = vss.video_sets_id and \ 00259 f.file_id = vs.file_id and \ 00260 bs.quid = f.quid and \ 00261 fr.media_id = f.media_id and \ 00262 fr.fragment_start = bs.fragment_start and \ 00263 fr.fragment_length = 1 and \ 00264 fr.keyframe = false \ 00265 order by bs.fragment_start;", false, false); 00266 ILOG_INFO("Did insert select at " << timer.SplitTime()); 00267 conn->Query("delete from i_bulk_score;", false, false); 00268 ILOG_INFO("Done in " << timer.SplitTime()); 00269 }
Here is the call graph for this function:
|