Home || Visual Search || Applications || Architecture || Important Messages || OGL || Src

void Impala::Persistency::AnnotationTableRepositoryInMonet::Add ( const AnnotationTableLocator loc,
AnnotationTable tab 
) [inline]

Definition at line 103 of file AnnotationTableRepositoryInMonet.h.

References Impala::FileNameBase(), Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Get1(), Impala::Persistency::AnnotationTableLocator::GetConceptSet(), Impala::Persistency::RepositoryInMonetDB::GetConnection(), Impala::Persistency::Locator::GetDataSet(), Impala::Persistency::AnnotationTableLocator::GetKeyword(), Impala::Persistency::AnnotationTableLocator::GetQuidClass(), ILOG_ERROR, ILOG_INFO, Impala::Core::Table::AnnotationTable::IsNegative(), Impala::Core::Table::AnnotationTable::IsPositive(), Impala::MakeString(), mAnnotator, Impala::QUID_CLASS_FRAME, Impala::QuidId(), Impala::QuidObject(), RepMonet(), Impala::Core::Table::Table::Size(), and Impala::Timer::SplitTime().

00104     {
00105         if (loc.GetQuidClass() != QUID_CLASS_FRAME)
00106         {
00107             ILOG_ERROR("Only implemented for Frames");
00108             return;
00109         }
00110 
00111         Connection* conn = RepMonet().GetConnection(loc);
00112 
00113         String vidSetBase = FileNameBase(loc.GetDataSet());
00114         Core::VideoSet::VideoSet* vidSet = VideoSetRepository().Get(loc);
00115 
00116         conn->Query("select i_add_annotator('+" + mAnnotator + "', 'the boss', true);",
00117                     false, false);
00118 
00119         conn->Query("delete from i_bulk_annotation;", false, false);
00120         Timer timer;
00121         String keyword = loc.GetKeyword();
00122         ILOG_INFO("keyword " << keyword << " has " << tab->Size() << " annos");
00123         String date("2007/08/22-11:00:00");
00124         int nr = tab->Size();
00125         String q = "copy " + MakeString(nr) +
00126             " records into i_bulk_annotation from stdin using delimiters ' ';\n";
00127         for (int i=0 ; i<nr ; i++)
00128         {
00129             Quid frameQuid = tab->Get1(i);
00130             int vidId = QuidObject(frameQuid);
00131             Quid vidQuid = vidSet->GetQuidVideo(vidId, false);
00132             int frameNr = QuidId(frameQuid);
00133             Real64 relevance = 0.5; // skip, using Mpeg7 convention
00134             if (tab->IsPositive(i))
00135                 relevance = 1.0;
00136             else if (tab->IsNegative(i))
00137                 relevance = 0.0;
00138             Real64 confidence = 1.0;
00139             q += keyword + " " + MakeString(vidQuid) + " " + MakeString(frameNr)
00140                 + " " + MakeString(relevance) + " " + MakeString(confidence)
00141                 + " " + date + "\n";
00142         }
00143         conn->Query(q, false, false);
00144         ILOG_INFO("Did bulk in " << timer.SplitTime());
00145         conn->Query("insert into annotation (fragment_id, keyword_id, \
00146                                              annotator_id, \
00147                                              relevance, confidence, \
00148                                              annotation_date, approved) \
00149                      select fr.fragment_id, k.keyword_id, a.annotator_id, \
00150                             ba.relevance, ba.confidence, ba.annotation_date, \
00151                             a.approved \
00152                      from i_bulk_annotation ba, media m, fragment fr, \
00153                           video_sets vss,  keyword_sets kss, keyword_set ks, \
00154                           keyword k, annotator a \
00155                      where ba.quid = m.quid and \
00156                            m.media_id = fr.media_id and \
00157                            fr.fragment_start = ba.fragment_start and \
00158                            fr.fragment_length = 1 and \
00159                            fr.keyframe = false and \
00160                            vss.set_name = '" + vidSetBase + "' and \
00161                            kss.set_name = '" + FileNameBase(loc.GetConceptSet()) + "' and \
00162                            kss.video_sets_id = vss.video_sets_id and \
00163                            ks.keyword_sets_id = kss.keyword_sets_id and \
00164                            ks.keyword_id = k.keyword_id and \
00165                            k.keyword_name = ba.keyword_name and \
00166                            a.annotator_name = '" + mAnnotator + "' \
00167                      order by ba.quid, ba.fragment_start;", false, false);
00168         conn->Query("delete from i_bulk_annotation;", false, false);
00169     }

Here is the call graph for this function:


Generated on Thu Jan 13 09:22:31 2011 for ImpalaSrc by  doxygen 1.5.1