[prev in list] [next in list] [prev in thread] [next in thread] 

List:       nepomuk
Subject:    Re: [Nepomuk] Review Request: DataMangaement: Optimize createUri
From:       "Sebastian Trueg" <sebastian () trueg ! de>
Date:       2012-09-17 15:31:59
Message-ID: 20120917153159.17015.33261 () vidsolbach ! de
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/106483/#review19076
-----------------------------------------------------------

Ship it!


Nice!

- Sebastian Trueg


On Sept. 17, 2012, 3:05 p.m., Vishesh Handa wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/106483/
> -----------------------------------------------------------
> 
> (Updated Sept. 17, 2012, 3:05 p.m.)
> 
> 
> 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
> 
> 


[Attachment #5 (text/html)]

<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;">  <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://git.reviewboard.kde.org/r/106483/">http://git.reviewboard.kde.org/r/106483/</a>
  </td>
    </tr>
   </table>
   <br />



 <p>Ship it!</p>



 <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Nice!</pre>  <br />







<p>- Sebastian</p>


<br />
<p>On September 17th, 2012, 3:05 p.m., Vishesh Handa wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://git.reviewboard.kde.org/media/rb/images/review_request_box_top_bg.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;">  <tr>
  <td>

<div>Review request for Nepomuk and Sebastian Trueg.</div>
<div>By Vishesh Handa.</div>


<p style="color: grey;"><i>Updated Sept. 17, 2012, 3:05 p.m.</i></p>






<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">    Check if the uri exists by using virtuoso&#39;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.
</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Yup. This was the rough test -

    QString baseQuery = QString::fromLatin1(&quot;select iri_to_id( &#39;%1&#39;, 0 \
)&quot;);

    QStringList list;
    list &lt;&lt; &quot;nepomuk:/res/a228f2ef-82bf-4979-9fdf-71b60714e82e&quot;;
    list &lt;&lt; &quot;nepomuk-random-uadfadsfsdafasdfdafadsfdsafasdfkj4324&quot;;

    foreach( QString uri, list ) {
        QString query = baseQuery.arg( uri );
        kDebug() &lt;&lt; &quot;Query: &quot; &lt;&lt; query;

        Soprano::Model* model = \
                Nepomuk2::ResourceManager::instance()-&gt;mainModel();
        Soprano::QueryResultIterator it = model-&gt;executeQuery( query, \
Soprano::Query::QueryLanguageUser, QLatin1String(&quot;sql&quot;) );  if( it.next() ) \
{  if( it[0].literal().toString().isEmpty() )
                kDebug() &lt;&lt; &quot;DOES NOT EXIST&quot;;
        }
        kDebug() &lt;&lt; &quot;------&quot;;
    }
    return;</pre>
  </td>
 </tr>
</table>




<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>services/storage/datamanagementmodel.cpp <span style="color: \
grey">(4221a3c)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/106483/diff/" style="margin-left: \
3em;">View Diff</a></p>




  </td>
 </tr>
</table>








  </div>
 </body>
</html>



_______________________________________________
Nepomuk mailing list
Nepomuk@kde.org
https://mail.kde.org/mailman/listinfo/nepomuk


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic