Hey Sebastian<br><br><div class="gmail_quote">On Mon, May 24, 2010 at 1:45 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>
I don&#39;t really see how this can work. After all the same resource could<br>
still be accessed in two different ways. For example we have this resource:<br>
<br>
nepomuk:/res/foobar<br>
    nao:identifier &quot;foobar&quot; .<br>
<br>
Now the code:<br>
<br>
Resource r1( QUrl(&quot;nepomuk:/res/foobar&quot; ) );<br>
Resource r2( &quot;foobar&quot; );<br>
<br>
At this point determineUri has not been called for any resource yet and<br>
as far as RM is concerned those are different resources with 2 different<br>
RDs.<br></blockquote><div><br>You&#39;re right. I forgot that determineUri has to be called at least once. :-( I think we should add a test for this. <br><br>Hmm, so we still need some kind of proxies. I guess it&#39;s time to combine determineUri() and load().<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;">
<br>
Be aware though that I did not look at your patch in detail yet. I will<br>
do that later. So I might have missed something. :)<br>
<br>
Cheers,<br>
<font color="#888888">Sebastian<br>
</font><div class="im"><br>
On 05/23/2010 05:54 PM, Vishesh Handa wrote:<br>
&gt;<br>
&gt; On Sun, May 23, 2010 at 8:20 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;     On 05/23/2010 04:23 PM, Vishesh Handa wrote:<br>
&gt;     &gt;     &gt; One way of solving both the problems is to derive<br>
&gt;     ResourceData from<br>
&gt;     &gt;     &gt; QObject. And then call deleteLater() instead of &quot;delete<br>
&gt;     this&quot;. (Patch<br>
&gt;     &gt;     &gt; attached)<br>
&gt;     &gt;<br>
&gt;     &gt;     oh, no, please don&#39;t. Totally useless overhead. It is much<br>
&gt;     simpler to<br>
&gt;     &gt;     make the mutex recursive.<br>
&gt;     &gt;<br>
&gt;     &gt;<br>
&gt;     &gt; Well then we need a better way of solving the &quot;delete this&quot; problem.<br>
&gt;     &gt; When you say moving &quot;it&quot; into Resource, do you mean determineUri() or<br>
&gt;     &gt; replaceWith() ?<br>
&gt;<br>
&gt;     I mean all calls of determineUri().<br>
&gt;     Example:<br>
&gt;     ResourceData::removeProperty calls determineUri. Instead determineUri<br>
&gt;     should be called in Resource::removeProperty.<br>
&gt;<br>
&gt;<br>
&gt; I&#39;m sorry. I don&#39;t understand. Isn&#39;t it the same thing? If A calls B or<br>
&gt; B is called inside A?<br>
&gt;<br>
&gt;<br>
&gt;     The only problem here is load. But I recently thought that it could be<br>
&gt;     merged into determineUri (or the other way around). After all most<br>
&gt;     resources do not have more than - say - 20 properties. That is quickly<br>
&gt;     loaded and would avoid performing yet another query. What I mean is that<br>
&gt;     in determineUri<br>
&gt;<br>
&gt;     select distinct ?r ?o where {<br>
&gt;     { ?r nie:url &lt;uri&gt; . }<br>
&gt;     UNION { &lt;uri&gt; ?p ?o . } } LIMIT 1<br>
&gt;<br>
&gt;     could become something like<br>
&gt;<br>
&gt;     select distinct ?r ?pp ?oo where {<br>
&gt;     { ?r nie:url &lt;uri&gt; .<br>
&gt;     ?r ?pp ?oo . FILTER(?r!=&lt;uri&gt; . }<br>
&gt;     UNION { &lt;uri&gt; ?p ?o . &lt;uri&gt; ?pp ?oo . }<br>
&gt;<br>
&gt;     to determine the URI AND load all properties at the same time.<br>
&gt;     Just an idea I had when I thought about ways to spped it all up...<br>
&gt;<br>
&gt;<br>
&gt; Seems logical. But then you call determineUri everywhere? I guess we<br>
&gt; could make it determineAndLoad(). :-)<br>
&gt;<br>
&gt; ---------------------------<br>
&gt;<br>
&gt; I had another idea on how to get rid of the proxy mess. I was going to<br>
&gt; tell you about it later, as its aim was to get rid of the nasty lists<br>
&gt; and determineUri mess, but it seems as though it would solve the proxy<br>
&gt; problem as well. (Nice side effect!)<br>
&gt;<br>
&gt; The ResourceManagerPrivate has 2 sets of lists. I&#39;m going to call them<br>
&gt; INIT-LIST (m_initializedData) and the HALF-INIT list (m_uriKickoffData &amp;<br>
&gt; m_idKickoffData). Whenever a Resource is created by the RMP::data()<br>
&gt; function, it checks if it is present INIT-LIST or HALF-init list, and<br>
&gt; accordingly gives us a RD (ResourceData).<br>
&gt;<br>
&gt; A RD can go into the HALF-INIT lists in 4 ways - (look at determineUri)<br>
&gt; --- KickOffId<br>
&gt; ------- nepomuk://res/ stored as a string<br>
&gt; ------- nao:identifier<br>
&gt;<br>
&gt; --- KickOffUri<br>
&gt; -------- nie:url<br>
&gt; -------- nepomuk://res/<br>
&gt;<br>
&gt; *Proposal :*<br>
&gt; Remove the KickOffId completely. And make KickOffUri contain the<br>
&gt; nao:identifier as well. When determineUri is being called, say<br>
&gt; m_kickOffUri is the nepomuk resource uri, it should add itself to the<br>
&gt; INIT-LIST and it should add all other ways of getting Initialized to the<br>
&gt; HALF-INIT list ( nao:identifier and nie:url ) This way RMP:data() will<br>
&gt; always returns the correct RD* and a proxy wouldn&#39;t be required.<br>
&gt;<br>
&gt; determineUri would be a lot simpler -<br>
&gt;<br>
&gt; if( m_kickOffUri.isValid() ) {<br>
&gt;       // check for nepomuk://res/<br>
&gt;       // check for nie:url and the filex crap which I don&#39;t understand<br>
&gt; } else {<br>
&gt;      // check for nao:identifier<br>
&gt; }<br>
&gt;<br>
&gt; An additional thing we could do is to make removeProperty() removing the<br>
&gt; corresponding RD from the HALF-INIT list if the property being removed<br>
&gt; is nao:identifier or nie::url. (addProperty should check for the same)/<br>
&gt;<br>
&gt; I hope I&#39;ve been clear enough.<br>
&gt;<br>
&gt; - Vishesh Handa<br>
&gt;<br>
&gt;<br>
&gt;     Cheers,<br>
&gt;     Sebastian<br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br>