[Nepomuk] Review Request: DataMangaement: Optimize createUri
Vishesh Handa
me at vhanda.in
Mon Sep 17 15:05:32 UTC 2012
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/106483/
-----------------------------------------------------------
Review request for Nepomuk and Sebastian Trueg.
Description
-------
Check if the uri exists by using virtuoso's internal iri_to_id, instead
of a complicated sparql query that takes a long time to execute.
We can save save roughly 100-200 msecs by not running the huge query.
Diffs
-----
services/storage/datamanagementmodel.cpp 4221a3c
Diff: http://git.reviewboard.kde.org/r/106483/diff/
Testing
-------
Yup. This was the rough test -
QString baseQuery = QString::fromLatin1("select iri_to_id( '%1', 0 )");
QStringList list;
list << "nepomuk:/res/a228f2ef-82bf-4979-9fdf-71b60714e82e";
list << "nepomuk-random-uadfadsfsdafasdfdafadsfdsafasdfkj4324";
foreach( QString uri, list ) {
QString query = baseQuery.arg( uri );
kDebug() << "Query: " << query;
Soprano::Model* model = Nepomuk2::ResourceManager::instance()->mainModel();
Soprano::QueryResultIterator it = model->executeQuery( query, Soprano::Query::QueryLanguageUser, QLatin1String("sql") );
if( it.next() ) {
if( it[0].literal().toString().isEmpty() )
kDebug() << "DOES NOT EXIST";
}
kDebug() << "------";
}
return;
Thanks,
Vishesh Handa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/nepomuk/attachments/20120917/3845b71e/attachment-0001.html>
More information about the Nepomuk
mailing list