本文整理汇总了C++中soprano::QueryResultIterator::current方法的典型用法代码示例。如果您正苦于以下问题:C++ QueryResultIterator::current方法的具体用法?C++ QueryResultIterator::current怎么用?C++ QueryResultIterator::current使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类soprano::QueryResultIterator
的用法示例。
在下文中一共展示了QueryResultIterator::current方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: kDebug
void Nepomuk::DbpediaAnnotationPlugin::slotQueryFinished( Soprano::Util::AsyncResult* result )
{
m_currentResult = 0;
kDebug() << result->lastError();
Soprano::QueryResultIterator it = result->queryResultIterator();
while ( it.next() ) {
kDebug() << it.current();
}
// TODO: create annotations either as new pimo things that are related to the resource or as
// being the resource (ie. an occurrence of resource().pimoThing())
emitFinished();
}
示例2: while
QList<CachedRowEntry> EventQuery::processQueryResults(const QString &query, const QUrl &uri)
{
Soprano::Model* model = Nepomuk2::ResourceManager::instance()->mainModel();
Soprano::QueryResultIterator it = model->executeQuery( query, Soprano::Query::QueryLanguageSparql );
// combine all search results again, so we get a just a single resource with a list of all authors and the list of types
// instead of many resources with all types again
QMap<QString, QStringList> resultList;
while( it.next() ) {
Soprano::BindingSet p = it.current();
// get either a new entry or what we have inserted beforehand
QStringList curEntry = resultList.value( p.value("r").toString(), QStringList());
// now set / add each queried value into the StringList
if (curEntry.isEmpty() ) {
curEntry << p.value("star").toString() << p.value("title").toString()
<< p.value("date").toString() << p.value("publication").toString() << p.value("r").toString();
}
else {
QString star = p.value("star").toString();
if(!star.isEmpty())
curEntry[Column_StarRate] = star;
QString title = p.value("title").toString();
if(!title.isEmpty())
curEntry[Column_Title] = title;
QString date = p.value("date").toString();
if( !date.isEmpty() )
curEntry[Column_Date] = date;
QString publication = p.value("publication").toString();
if(!publication.isEmpty() && !curEntry[Column_Publication] .contains(publication)) {
//create content for the HTMLDelegate looks a lot better when several entries are being displayed
curEntry[Column_Publication] = curEntry[Column_Publication].append("• ");
curEntry[Column_Publication] = curEntry[Column_Publication].append(publication);
curEntry[Column_Publication] = curEntry[Column_Publication].append("<br/>");
}
}
// and save the result back into the map
if(p.value("r").isEmpty()) {
Q_ASSERT(!uri.isEmpty());
resultList.insert(uri.toString(), curEntry);
}
else {
resultList.insert(p.value("r").toString(), curEntry);
}
}
// now create the cache entries from all returned search results
QList<CachedRowEntry> newCache;
QMapIterator<QString, QStringList> i(resultList);
while (i.hasNext()) {
i.next();
CachedRowEntry cre;
cre.uri = QUrl( i.key() );
cre.displayColums = createDisplayData(i.value());
cre.decorationColums = createDecorationData(i.value());
cre.resource = Nepomuk2::Resource::fromResourceUri( cre.uri );
cre.timestamp = QDateTime::currentDateTime();
cre.resourceType = 0; //Unused
newCache.append(cre);
}
return newCache;
}