Definition at line 28 of file AnnotationTableRepositoryInMonet.h. References Impala::Core::Table::AnnotationTable::AddNegative(), Impala::Core::Table::AnnotationTable::AddPositive(), Impala::Core::Table::AnnotationTable::AddSkip(), Impala::FileNameBase(), Impala::Persistency::AnnotationTableLocator::GetConceptSet(), Impala::Persistency::RepositoryInMonetDB::GetConnection(), Impala::Persistency::Locator::GetDataSet(), Impala::Persistency::AnnotationTableLocator::GetKeyword(), Impala::Persistency::AnnotationTableLocator::GetQuidClass(), Impala::Core::VideoSet::VideoSet::GetQuidFrame(), ILOG_ERROR, mAnnotator, Impala::QUID_CLASS_FRAME, Impala::QuidId(), and RepMonet(). 00029 { 00030 if (loc.GetQuidClass() != QUID_CLASS_FRAME) 00031 { 00032 ILOG_ERROR("Only implemented for Frames"); 00033 return 0; 00034 } 00035 00036 Connection* conn = RepMonet().GetConnection(loc); 00037 00038 String vidSetBase = FileNameBase(loc.GetDataSet()); 00039 String query = 00040 "select f.quid, fr.fragment_start, a.relevance \ 00041 from fragment fr, file f, video_set vs, video_sets vss, \ 00042 keyword_sets kss, keyword_set ks, keyword k, annotator a, \ 00043 annotation a \ 00044 where vss.set_name = '" + vidSetBase + "' and \ 00045 vs.video_sets_id = vss.video_sets_id and \ 00046 f.file_id = vs.file_id and \ 00047 fr.media_id = f.media_id and \ 00048 fr.fragment_length = 1 and \ 00049 fr.keyframe = false and \ 00050 kss.set_name = '" + FileNameBase(loc.GetConceptSet()) + "' and \ 00051 kss.video_sets_id = vss.video_sets_id and \ 00052 ks.keyword_sets_id = kss.keyword_sets_id and \ 00053 ks.keyword_id = k.keyword_id and \ 00054 k.keyword_name = '" + loc.GetKeyword() + "' and \ 00055 a.annotator_name = '" + mAnnotator + "' and \ 00056 a.fragment_id = fr.fragment_id and \ 00057 a.keyword_id = k.keyword_id and \ 00058 a.approved = true \ 00059 order by f.quid, fr.fragment_start;"; 00060 00061 MapiHdl hdl = conn->QueryPartStart(query); 00062 if (hdl == 0) 00063 return 0; 00064 00065 Quid* quid = 0; 00066 int quidSize = 0; 00067 if (!conn->QueryPartFetchULL(hdl, 0, quid, quidSize)) 00068 return 0; 00069 00070 int* start = 0; 00071 int startSize = 0; 00072 if (!conn->QueryPartFetchInt(hdl, 1, start, startSize)) 00073 return 0; 00074 00075 double* rel = 0; 00076 int relSize; 00077 if (!conn->QueryPartFetchDouble(hdl, 2, rel, relSize)) 00078 return 0; 00079 00080 conn->QueryPartEnd(hdl); 00081 00082 Core::VideoSet::VideoSet* vidSet = VideoSetRepository().Get(loc); 00083 AnnotationTable* anno = new AnnotationTable(loc.GetKeyword(), quidSize); 00084 for (int i=0 ; i<quidSize ; i++) 00085 { 00086 int vidId = QuidId(quid[i]); 00087 Quid q = vidSet->GetQuidFrame(vidId, start[i], false); 00088 if (rel[i] == 1.0) 00089 anno->AddPositive(q); 00090 else if (rel[i] == 0.0) 00091 anno->AddNegative(q); 00092 else 00093 anno->AddSkip(q); 00094 } 00095 00096 delete quid; 00097 delete start; 00098 delete rel; 00099 return anno; 00100 }
Here is the call graph for this function:
|