<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/111274/">http://git.reviewboard.kde.org/r/111274/</a>
     </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On September 13th, 2013, 2:56 p.m. UTC, <b>Simeon Bird</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">The second version is I think not the right patch, it seems to be changes on top of v1.

Anyway, I have a potentially silly question: why is this information living here? Why don't you just make a subclass that lives in the query parser and is private to that with the two original methods in it? That way you avoid futzing around with void pointers, you add the methods you actually want, but they aren't public?</pre>
 </blockquote>







</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">When I click on "download diff", I get the correct patch, that only adds a few lines to term.cpp, term.h and term_p.h.

I cannot use a subclass of Term because Term is the base-class of ComparisonTerm, LiteralTerm, AndTerm, OrTerm, etc. If I want to use sub-classes, I have to sub-class all of them. Furthermore, the positional information is not private to the query parser (it has no use of this information). It is meant to be shared with the query builder widget, that uses it to display boxes around terms. Other users of the query parser may also want to use the positional information.</pre>
<br />










<p>- Denis</p>


<br />
<p>On September 12th, 2013, 4:52 p.m. UTC, Denis Steckelmacher wrote:</p>








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

<div>Review request for Nepomuk.</div>
<div>By Denis Steckelmacher.</div>


<p style="color: grey;"><i>Updated Sept. 12, 2013, 4:52 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;">This patch adds two fields to Nepomuk2::Query::Term: "position" and "length". By default, they are zero and everything works as before. This change is binary- and source-compatible.

The in-development Nepomuk query parser (GSoC 2013 project) uses these fields to map parsed terms to the original user query string. By traversing the parse tree (a tree of And, Or and Comparison terms), it is therefore possible to match every term with a piece of input, that can be highlighted accordingly. For instance, each ComparisonTerm can have a different color, its subTerm being rendered using a bold font (like in "sent to *Jimmy*").

This patch also makes the QuerySerializer serialize the positional information, for debug purposes. This information is not read-back by the deserializer, as the modification would be fairly intrusive, and there is no need to deserialize positional information if the original user query is lost.</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;">The query parser (https://github.com/steckdenis/nepomukqueryparser) is able to store positional information into terms, and this information is valid. The query "files related to mails sent by John, dated of last week" produces the following term tree:

<and position="0" length="55">
    <type position="0" length="5" uri="FileDataObject"/>
    <comparison position="6" length="30" property="relatedTo" comparator="=" inverted="false">
        <and position="0" length="35">
            <type position="17" length="5" uri="Message"/>
            <comparison position="23" length="12" property="messageFrom" comparator=":" inverted="false">
                <literal position="31" length="4" datatype="string">
                    John
                </literal>
            </comparison>
        </and>
    </comparison>
    <and position="46" length="9">
        <comparison position="46" length="9" property="fileLastModified" comparator="&gt;=" inverted="false">
            <literal position="46" length="9" datatype="dateTime">
                2013-06-16T22:00:00.002Z
            </literal>
        </comparison>
        <comparison position="46" length="9" property="fileLastModified" comparator="&lt;=" inverted="false">
            <literal position="46" length="9" datatype="dateTime">
                2013-06-23T20:00:00.002Z
            </literal>
        </comparison>
    </and>
</and></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>libnepomukcore/query/term.h <span style="color: grey">(114baa3)</span></li>

 <li>libnepomukcore/query/term.cpp <span style="color: grey">(cfb41f4)</span></li>

 <li>libnepomukcore/query/term_p.h <span style="color: grey">(6d92b48)</span></li>

</ul>

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







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








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