Hey Sebastian<br><br><div class="gmail_quote">On Tue, May 25, 2010 at 11:18 PM, Sebastian Trüg <span dir="ltr">&lt;<a href="mailto:trueg@kde.org">trueg@kde.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi Vishesh,<br>
<br>
no, I do not want to keep determineUri. That is the whole point. And why<br>
is it buggy?<br>
<br></blockquote><div><br>Minor things. <br><br>1. If I call Resource( QString(&quot;file:/whatever&quot;) ) and whatever is actually a filex:/ url. It won&#39;t get identified, cause the filex:/ searching is only applicable to QUrls. <br>
<br>2. Code like this is perfectly legal, and works (no modifications required)<br><br><div style="margin-left: 40px;">Resource r1( KUrl(&quot;nepomuk:/res/blah-blah&quot;) );<br>r1.setRating( 5 );<br>qDebug() &lt;&lt; r1.rating();<br>
</div><br>This is because determineUri() accepts uris whose scheme is &quot;nepomuk&quot;, but don&#39;t really exist in the database. Should this be allowed?<br><br>3. When checking if the the m_kickoffUri is a nie:url for a resource. The nieUrl is assigned to be equal to the uri. This however gets fixed in the load(). And nieUrl isn&#39;t used anywhere, so it doesn&#39;t matter that much.<br>
<br>-----------<br><br>I&#39;ll start combing them ( The code becomes ugly! :-( )<br><br>- Vishesh Handa<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

Cheers,<br>
<font color="#888888">Sebastian<br>
</font><div class="im"><br>
On 05/25/2010 07:36 PM, Vishesh Handa wrote:<br>
&gt;<br>
&gt; Hey Sebastian<br>
&gt;<br>
&gt; On Mon, May 24, 2010 at 4:43 PM, Sebastian Trüg &lt;<a href="mailto:trueg@kde.org">trueg@kde.org</a><br>
</div><div><div></div><div class="h5">&gt; &lt;mailto:<a href="mailto:trueg@kde.org">trueg@kde.org</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt;     Yeah... I think merging determineUri into load and calling it simply<br>
&gt;     load() is perfectly fine. The that method would only be called from<br>
&gt;     Resource but never in ResourceData methods.<br>
&gt;<br>
&gt;<br>
&gt; Just to be clear you want to merge determineUri() and load() and call it<br>
&gt; load()?<br>
&gt;<br>
&gt; Do you still want to keep the original determineUri? Cause merging it<br>
&gt; would cause massive code duplication, if we still plan on keeping<br>
&gt; determineUri() (which is a little buggy, btw) And if we don&#39;t plan on<br>
&gt; keeping determineUri() what do we do with all the calls to it? It called<br>
&gt; before all of the property, hasProperty() functions, and is called in<br>
&gt; store(), which is called whenever you have any kind of setters(<br>
&gt; setProperty() setType() .. )<br>
&gt;<br>
&gt; After trying to merge them. I don&#39;t think merging is that simple.<br>
&gt;<br>
&gt; - Vishesh Handa<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;     Cheers,<br>
&gt;     Sebastian<br>
&gt;<br>
&gt;     &gt; - Vishesh Handa<br>
&gt;     &gt;<br>
&gt;     &gt;<br>
&gt;     &gt;<br>
&gt;     &gt;     Be aware though that I did not look at your patch in detail<br>
&gt;     yet. I will<br>
&gt;     &gt;     do that later. So I might have missed something. :)<br>
&gt;     &gt;<br>
&gt;     &gt;     Cheers,<br>
&gt;     &gt;     Sebastian<br>
&gt;     &gt;<br>
&gt;     &gt;     On 05/23/2010 05:54 PM, Vishesh Handa wrote:<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; On Sun, May 23, 2010 at 8:20 PM, Sebastian Trüg<br>
&gt;     &lt;<a href="mailto:trueg@kde.org">trueg@kde.org</a> &lt;mailto:<a href="mailto:trueg@kde.org">trueg@kde.org</a>&gt;<br>
&gt;     &gt;     &lt;mailto:<a href="mailto:trueg@kde.org">trueg@kde.org</a> &lt;mailto:<a href="mailto:trueg@kde.org">trueg@kde.org</a>&gt;&gt;<br>
&gt;     &gt;     &gt; &lt;mailto:<a href="mailto:trueg@kde.org">trueg@kde.org</a> &lt;mailto:<a href="mailto:trueg@kde.org">trueg@kde.org</a>&gt;<br>
&gt;     &lt;mailto:<a href="mailto:trueg@kde.org">trueg@kde.org</a> &lt;mailto:<a href="mailto:trueg@kde.org">trueg@kde.org</a>&gt;&gt;&gt;&gt; wrote:<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt;     On 05/23/2010 04:23 PM, Vishesh Handa wrote:<br>
&gt;     &gt;     &gt;     &gt;     &gt; One way of solving both the problems is to derive<br>
&gt;     &gt;     &gt;     ResourceData from<br>
&gt;     &gt;     &gt;     &gt;     &gt; QObject. And then call deleteLater() instead of<br>
&gt;     &quot;delete<br>
&gt;     &gt;     &gt;     this&quot;. (Patch<br>
&gt;     &gt;     &gt;     &gt;     &gt; attached)<br>
&gt;     &gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt;     &gt;     oh, no, please don&#39;t. Totally useless overhead. It<br>
&gt;     is much<br>
&gt;     &gt;     &gt;     simpler to<br>
&gt;     &gt;     &gt;     &gt;     make the mutex recursive.<br>
&gt;     &gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt;     &gt; Well then we need a better way of solving the &quot;delete<br>
&gt;     this&quot;<br>
&gt;     &gt;     problem.<br>
&gt;     &gt;     &gt;     &gt; When you say moving &quot;it&quot; into Resource, do you mean<br>
&gt;     &gt;     determineUri() or<br>
&gt;     &gt;     &gt;     &gt; replaceWith() ?<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt;     I mean all calls of determineUri().<br>
&gt;     &gt;     &gt;     Example:<br>
&gt;     &gt;     &gt;     ResourceData::removeProperty calls determineUri. Instead<br>
&gt;     &gt;     determineUri<br>
&gt;     &gt;     &gt;     should be called in Resource::removeProperty.<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; I&#39;m sorry. I don&#39;t understand. Isn&#39;t it the same thing? If A<br>
&gt;     calls<br>
&gt;     &gt;     B or<br>
&gt;     &gt;     &gt; B is called inside A?<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt;     The only problem here is load. But I recently thought<br>
&gt;     that it<br>
&gt;     &gt;     could be<br>
&gt;     &gt;     &gt;     merged into determineUri (or the other way around).<br>
&gt;     After all most<br>
&gt;     &gt;     &gt;     resources do not have more than - say - 20 properties.<br>
&gt;     That is<br>
&gt;     &gt;     quickly<br>
&gt;     &gt;     &gt;     loaded and would avoid performing yet another query. What I<br>
&gt;     &gt;     mean is that<br>
&gt;     &gt;     &gt;     in determineUri<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt;     select distinct ?r ?o where {<br>
&gt;     &gt;     &gt;     { ?r nie:url &lt;uri&gt; . }<br>
&gt;     &gt;     &gt;     UNION { &lt;uri&gt; ?p ?o . } } LIMIT 1<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt;     could become something like<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt;     select distinct ?r ?pp ?oo where {<br>
&gt;     &gt;     &gt;     { ?r nie:url &lt;uri&gt; .<br>
&gt;     &gt;     &gt;     ?r ?pp ?oo . FILTER(?r!=&lt;uri&gt; . }<br>
&gt;     &gt;     &gt;     UNION { &lt;uri&gt; ?p ?o . &lt;uri&gt; ?pp ?oo . }<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt;     to determine the URI AND load all properties at the same<br>
&gt;     time.<br>
&gt;     &gt;     &gt;     Just an idea I had when I thought about ways to spped it<br>
&gt;     all up...<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; Seems logical. But then you call determineUri everywhere? I<br>
&gt;     guess we<br>
&gt;     &gt;     &gt; could make it determineAndLoad(). :-)<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; ---------------------------<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; I had another idea on how to get rid of the proxy mess. I<br>
&gt;     was going to<br>
&gt;     &gt;     &gt; tell you about it later, as its aim was to get rid of the<br>
&gt;     nasty lists<br>
&gt;     &gt;     &gt; and determineUri mess, but it seems as though it would solve<br>
&gt;     the proxy<br>
&gt;     &gt;     &gt; problem as well. (Nice side effect!)<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; The ResourceManagerPrivate has 2 sets of lists. I&#39;m going to<br>
&gt;     call them<br>
&gt;     &gt;     &gt; INIT-LIST (m_initializedData) and the HALF-INIT list<br>
&gt;     &gt;     (m_uriKickoffData &amp;<br>
&gt;     &gt;     &gt; m_idKickoffData). Whenever a Resource is created by the<br>
&gt;     RMP::data()<br>
&gt;     &gt;     &gt; function, it checks if it is present INIT-LIST or HALF-init<br>
&gt;     list, and<br>
&gt;     &gt;     &gt; accordingly gives us a RD (ResourceData).<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; A RD can go into the HALF-INIT lists in 4 ways - (look at<br>
&gt;     &gt;     determineUri)<br>
&gt;     &gt;     &gt; --- KickOffId<br>
&gt;     &gt;     &gt; ------- nepomuk://res/ stored as a string<br>
&gt;     &gt;     &gt; ------- nao:identifier<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; --- KickOffUri<br>
&gt;     &gt;     &gt; -------- nie:url<br>
&gt;     &gt;     &gt; -------- nepomuk://res/<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; *Proposal :*<br>
&gt;     &gt;     &gt; Remove the KickOffId completely. And make KickOffUri contain the<br>
&gt;     &gt;     &gt; nao:identifier as well. When determineUri is being called, say<br>
&gt;     &gt;     &gt; m_kickOffUri is the nepomuk resource uri, it should add<br>
&gt;     itself to the<br>
&gt;     &gt;     &gt; INIT-LIST and it should add all other ways of getting<br>
&gt;     Initialized<br>
&gt;     &gt;     to the<br>
&gt;     &gt;     &gt; HALF-INIT list ( nao:identifier and nie:url ) This way<br>
&gt;     RMP:data() will<br>
&gt;     &gt;     &gt; always returns the correct RD* and a proxy wouldn&#39;t be required.<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; determineUri would be a lot simpler -<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; if( m_kickOffUri.isValid() ) {<br>
&gt;     &gt;     &gt;       // check for nepomuk://res/<br>
&gt;     &gt;     &gt;       // check for nie:url and the filex crap which I don&#39;t<br>
&gt;     understand<br>
&gt;     &gt;     &gt; } else {<br>
&gt;     &gt;     &gt;      // check for nao:identifier<br>
&gt;     &gt;     &gt; }<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; An additional thing we could do is to make removeProperty()<br>
&gt;     &gt;     removing the<br>
&gt;     &gt;     &gt; corresponding RD from the HALF-INIT list if the property<br>
&gt;     being removed<br>
&gt;     &gt;     &gt; is nao:identifier or nie::url. (addProperty should check for the<br>
&gt;     &gt;     same)/<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; I hope I&#39;ve been clear enough.<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; - Vishesh Handa<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt;     Cheers,<br>
&gt;     &gt;     &gt;     Sebastian<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;<br>
&gt;     &gt;<br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br>