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

List:       nepomuk
Subject:    Re: [Nepomuk] Nepomuk2::Resource backward compatibility
From:       Vishesh Handa <me () vhanda ! in>
Date:       2012-07-03 12:56:50
Message-ID: CAOPTMKB6D-k72q3QyinV-6QUuzo-w9x3Qn8BgZojwfXu8+-pOA () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Tue, Jul 3, 2012 at 12:15 AM, Sebastian Trüg <trueg@kde.org> wrote:

> I don't think the pimo code being very complicated. And it is very
> separate from the rest.
> I would not remove it but if you really want to it would be fine with me.
>
>
Hmm. Well, the groundingOccurance and everything isn't watched by the
resourcewatcher. So, it has an additional overhead.

For now I'm removing them, once the port to shared memory is done, I might
add them again. But I want the flexibility of not having to worry about
deprecating them/supporting them forever. Right now, I can still mess with
the source compatibility.


> On 07/01/2012 03:08 PM, Vishesh Handa wrote:
>
>> Oh yeah. Also, can we get rid of all the pimo stuff from the Resource
>> class?
>>
>> AFAIK, no one really uses any of the pimo features over there and they
>> really complicate the code base.
>>
>> commit 755131d501c687c790c166f8d1ce4d**1b56550301
>> Author: Vishesh Handa <me@vhanda.in <mailto:me@vhanda.in>>
>>
>> Date:   Sat Jun 30 11:32:09 2012 +0530
>>
>>      Loose all the pimo related functions
>>
>>      No one uses them and they complicate the code base. We want this code
>>      base to be as simple as possible.
>>
>> diff --git a/libnepomukcore/resource/**resource.cpp
>> b/libnepomukcore/resource/**resource.cpp
>> index b559f07..c237f44 100644
>> --- a/libnepomukcore/resource/**resource.cpp
>> +++ b/libnepomukcore/resource/**resource.cpp
>> @@ -25,7 +25,6 @@
>>   #include "tools.h"
>>   #include "tag.h"
>>   #include "pimo.h"
>> -#include "thing.h"
>>   #include "file.h"
>>   #include "property.h"
>>   #include "nfo.h"
>> @@ -283,9 +282,9 @@ QString Nepomuk2::Resource::**genericLabel() const
>>       if(!label.isEmpty())
>>           return label;
>>
>> -    label = m_data->pimoThing().label();
>> -    if(!label.isEmpty())
>> -        return label;
>> +    //label = m_data->pimoThing().label();
>> +    //if(!label.isEmpty())
>> +    //    return label;
>>
>>       label = property( Nepomuk2::Vocabulary::NFO::**fileName()
>> ).toString();
>>       if(!label.isEmpty())
>> @@ -357,13 +356,6 @@ QString Nepomuk2::Resource::**genericIcon() const
>>   }
>>
>>
>> -Nepomuk2::Thing Nepomuk2::Resource::pimoThing(**)
>> -{
>> -    determineFinalResourceData();
>> -    return m_data->pimoThing();
>> -}
>> -
>> -
>>   bool Nepomuk2::Resource::operator==**( const Resource& other ) const
>>   {
>>       if( this == &other )
>> diff --git a/libnepomukcore/resource/**resource.h
>> b/libnepomukcore/resource/**resource.h
>> index 2edb562..3cc30c2 100644
>> --- a/libnepomukcore/resource/**resource.h
>> +++ b/libnepomukcore/resource/**resource.h
>> @@ -35,7 +35,6 @@ namespace Nepomuk2 {
>>       class ResourceData;
>>       class Variant;
>>       class Tag;
>> -    class Thing;
>>       class File;
>>       namespace Types {
>>           class Property;
>> @@ -344,16 +343,6 @@ namespace Nepomuk2 {
>>           QString genericIcon() const;
>>
>>           /**
>> -         * Get or create the PIMO thing that relates to this resource.
>> If this resource
>> -         * itself is a pimo:Thing, a reference to this is returned. If
>> a pimo:Thing exists
>> -         * with has as occurrence this resource, the thing is returned.
>> Otherwise a new thing
>> -         * is created.
>> -         *
>> -         * \since 4.2
>> -         */
>> -        Thing pimoThing();
>> -
>> -        /**
>>            * Operator to compare two Resource objects.
>>            */
>>           bool operator==( const Resource& ) const;
>> diff --git a/libnepomukcore/resource/**resourcedata.cpp
>> b/libnepomukcore/resource/**resourcedata.cpp
>> index f908177..e19b4bd 100644
>> --- a/libnepomukcore/resource/**resourcedata.cpp
>> +++ b/libnepomukcore/resource/**resourcedata.cpp
>> @@ -54,6 +54,8 @@ using namespace Soprano;
>>
>>   #define MAINMODEL (m_rm->m_manager->mainModel())
>>
>> +using namespace Soprano::Vocabulary;
>> +using namespace Nepomuk2::Vocabulary;
>>
>>   Nepomuk2::ResourceData::**ResourceData( const QUrl& uri, const QUrl&
>> kickOffUri, const QUrl& type, ResourceManagerPrivate* rm )
>>       : m_uri(uri),
>> @@ -61,8 +63,6 @@ Nepomuk2::ResourceData::**ResourceData( const QUrl&
>> uri,
>> const QUrl& kickOffUri, c
>>         m_modificationMutex(QMutex::**Recursive),
>>         m_cacheDirty(false),
>>         m_addedToWatcher(false),
>> -      m_pimoThing(0),
>> -      m_groundingOccurence(0),
>>         m_rm(rm)
>>   {
>>       if( m_mainType.isEmpty() ) {
>> @@ -197,9 +197,6 @@ void Nepomuk2::ResourceData::**resetAll( bool
>> isDelete )
>>       m_cache.clear();
>>       m_cacheDirty = false;
>>       m_types.clear();
>> -    delete m_pimoThing;
>> -    m_pimoThing = 0;
>> -    m_groundingOccurence = 0;
>>
>>       // when we are being deleted the value of m_mainType is not
>> important
>>       // anymore. Also since ResourceManager is a global static it might
>> be
>> @@ -321,13 +318,6 @@ bool Nepomuk2::ResourceData::store(**)
>>               m_rm->addToKickOffList( this, m_kickoffUris );
>>           }
>>
>> -        // store our grounding occurrence in case we are a thing
>> created by the pimoThing() method
>> -        if( m_groundingOccurence ) {
>> -            if( m_groundingOccurence != this )
>> -                m_groundingOccurence->store();
>> -            setProperty(Vocabulary::PIMO::**groundingOccurrence(),
>> Variant(m_groundingOccurence->**uri()) );
>> -        }
>> -
>>           foreach( const KUrl& url, m_kickoffUris ) {
>>               if( url.scheme().isEmpty() )
>>                   setProperty( Soprano::Vocabulary::NAO::**identifier(),
>> Variant(url.url()) );
>> @@ -437,23 +427,6 @@ bool Nepomuk2::ResourceData::load()
>>               }
>>
>>               m_cacheDirty = false;
>> -
>> -            delete m_pimoThing;
>> -            m_pimoThing = 0;
>> -            if( hasType( Vocabulary::PIMO::Thing() ) ) {
>> -                m_pimoThing = new Thing( m_uri );
>> -            }
>> -            else {
>> -                // TODO: somehow handle pimo:referencingOccurrence and
>> pimo:occurrence
>> -                QueryResultIterator pimoIt = MAINMODEL->executeQuery(
>> QString( "select ?r where { ?r <%1> <%2> . }")
>> -
>> .arg( Vocabulary::PIMO::**groundingOccurrence().**toString() )
>> -
>> .arg( QString::fromAscii( m_uri.toEncoded() ) ),
>> -
>> Soprano::Query::**QueryLanguageSparqlNoInference );
>> -                if( pimoIt.next() ) {
>> -                    m_pimoThing = new Thing( pimoIt.binding("r").uri() );
>> -                }
>> -            }
>> -
>>               return true;
>>           }
>>           else {
>> @@ -707,32 +680,6 @@ void Nepomuk2::ResourceData::**invalidateCache()
>>   }
>>
>>
>> -Nepomuk2::Thing Nepomuk2::ResourceData::**pimoThing()
>> -{
>> -    load();
>> -    if( !m_pimoThing ) {
>> -        //
>> -        // We only create a new thing if we are a nie:InformationElement.
>> -        // All other resources will simply be converted into a pimo:Thing
>> -        //
>> -        // Files, however, are a special case in every aspect. this
>> includes pimo things.
>> -        // Files are their own grounding occurrence. This makes a lot
>> of things
>> -        // much simpler.
>> -        //
>> -        if( hasType( Vocabulary::PIMO::Thing() ) ||
>> -                isFile() ||
>> -                !hasType( Vocabulary::NIE::**InformationElement() ) ) {
>> -            m_pimoThing = new Thing(this);
>> -        }
>> -        else {
>> -            m_pimoThing = new Thing();
>> -        }
>> -        m_pimoThing->m_data->m_**groundingOccurence = this;
>> -    }
>> -    return *m_pimoThing;
>> -}
>> -
>> -
>>   bool Nepomuk2::ResourceData::**operator==( const ResourceData& other )
>> const
>>   {
>>       if( this == &other )
>> diff --git a/libnepomukcore/resource/**resourcedata.h
>> b/libnepomukcore/resource/**resourcedata.h
>> index c6b267f..3708897 100644
>> --- a/libnepomukcore/resource/**resourcedata.h
>> +++ b/libnepomukcore/resource/**resourcedata.h
>> @@ -29,7 +29,6 @@
>>   #include <QtCore/QSet>
>>
>>   #include "variant.h"
>> -#include "thing.h"
>>   #include <kurl.h>
>>
>>   #include <soprano/statement.h>
>> @@ -157,8 +156,6 @@ namespace Nepomuk2 {
>>
>>           void invalidateCache();
>>
>> -        Thing pimoThing();
>> -
>>           /**
>>            * Compares the properties of two ResourceData objects taking
>> into account the Deleted flag
>>            */
>> @@ -205,12 +202,6 @@ namespace Nepomuk2 {
>>           bool m_cacheDirty;
>>           bool m_addedToWatcher;
>>
>> -        // using a pointer to avoid infinite creation loop
>> -        Thing* m_pimoThing;
>> -
>> -        // only used for delayed storage of the pimo thing relation
>> -        ResourceData* m_groundingOccurence;
>> -
>>           ResourceManagerPrivate* m_rm;
>>       };
>>   }
>>
>>
>>
>> On Sun, Jul 1, 2012 at 4:39 PM, Vishesh Handa <me@vhanda.in
>> <mailto:me@vhanda.in>> wrote:
>>
>>     Hey Sebastian
>>
>>     I still have around 3 more weeks during which I'm allowed to break
>>     ABI and API compatibility. I was thinking of changing -
>>
>>     * Resource::resourceUri() -> Resource::uri()
>>     * Resource::resourceType() -> Resource::type()
>>
>>     Is that okay?
>>
>>     --
>>     Vishesh Handa
>>
>>
>>
>>
>> --
>> Vishesh Handa
>>
>>


-- 
Vishesh Handa

[Attachment #5 (text/html)]

<br><br><div class="gmail_quote">On Tue, Jul 3, 2012 at 12:15 AM, Sebastian Trüg \
<span dir="ltr">&lt;<a href="mailto:trueg@kde.org" \
target="_blank">trueg@kde.org</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"> I don&#39;t think the pimo code being very complicated. And \
it is very separate from the rest.<br> I would not remove it but if you really want \
to it would be fine with me.<div class="im"><br></div></blockquote><div><br>Hmm. \
Well, the groundingOccurance and everything isn&#39;t watched by the resourcewatcher. \
So, it has an additional overhead.<br> <br>For now I&#39;m removing them, once the \
port to shared memory is done, I might add them again. But I want the flexibility of \
not having to worry about deprecating them/supporting them forever. Right now, I can \
still mess with the source compatibility.<br> <br></div><blockquote \
class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div class="im"> <br>
On 07/01/2012 03:08 PM, Vishesh Handa wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div class="im"> Oh yeah. Also, can we get rid of all the \
pimo stuff from the Resource class?<br> <br>
AFAIK, no one really uses any of the pimo features over there and they<br>
really complicate the code base.<br>
<br>
commit 755131d501c687c790c166f8d1ce4d<u></u>1b56550301<br></div>
Author: Vishesh Handa &lt;<a href="mailto:me@vhanda.in" \
target="_blank">me@vhanda.in</a> &lt;mailto:<a href="mailto:me@vhanda.in" \
                target="_blank">me@vhanda.in</a>&gt;&gt;<div><div class="h5"><br>
Date:   Sat Jun 30 11:32:09 2012 +0530<br>
<br>
     Loose all the pimo related functions<br>
<br>
     No one uses them and they complicate the code base. We want this code<br>
     base to be as simple as possible.<br>
<br>
diff --git a/libnepomukcore/resource/<u></u>resource.cpp<br>
b/libnepomukcore/resource/<u></u>resource.cpp<br>
index b559f07..c237f44 100644<br>
--- a/libnepomukcore/resource/<u></u>resource.cpp<br>
+++ b/libnepomukcore/resource/<u></u>resource.cpp<br>
@@ -25,7 +25,6 @@<br>
  #include &quot;tools.h&quot;<br>
  #include &quot;tag.h&quot;<br>
  #include &quot;pimo.h&quot;<br>
-#include &quot;thing.h&quot;<br>
  #include &quot;file.h&quot;<br>
  #include &quot;property.h&quot;<br>
  #include &quot;nfo.h&quot;<br>
@@ -283,9 +282,9 @@ QString Nepomuk2::Resource::<u></u>genericLabel() const<br>
      if(!label.isEmpty())<br>
          return label;<br>
<br>
-    label = m_data-&gt;pimoThing().label();<br>
-    if(!label.isEmpty())<br>
-        return label;<br>
+    //label = m_data-&gt;pimoThing().label();<br>
+    //if(!label.isEmpty())<br>
+    //    return label;<br>
<br>
      label = property( Nepomuk2::Vocabulary::NFO::<u></u>fileName() \
).toString();<br>  if(!label.isEmpty())<br>
@@ -357,13 +356,6 @@ QString Nepomuk2::Resource::<u></u>genericIcon() const<br>
  }<br>
<br>
<br>
-Nepomuk2::Thing Nepomuk2::Resource::pimoThing(<u></u>)<br>
-{<br>
-    determineFinalResourceData();<br>
-    return m_data-&gt;pimoThing();<br>
-}<br>
-<br>
-<br>
  bool Nepomuk2::Resource::operator==<u></u>( const Resource&amp; other ) const<br>
  {<br>
      if( this == &amp;other )<br>
diff --git a/libnepomukcore/resource/<u></u>resource.h<br>
b/libnepomukcore/resource/<u></u>resource.h<br>
index 2edb562..3cc30c2 100644<br>
--- a/libnepomukcore/resource/<u></u>resource.h<br>
+++ b/libnepomukcore/resource/<u></u>resource.h<br>
@@ -35,7 +35,6 @@ namespace Nepomuk2 {<br>
      class ResourceData;<br>
      class Variant;<br>
      class Tag;<br>
-    class Thing;<br>
      class File;<br>
      namespace Types {<br>
          class Property;<br>
@@ -344,16 +343,6 @@ namespace Nepomuk2 {<br>
          QString genericIcon() const;<br>
<br>
          /**<br>
-         * Get or create the PIMO thing that relates to this resource.<br>
If this resource<br>
-         * itself is a pimo:Thing, a reference to this is returned. If<br>
a pimo:Thing exists<br>
-         * with has as occurrence this resource, the thing is returned.<br>
Otherwise a new thing<br>
-         * is created.<br>
-         *<br>
-         * \since 4.2<br>
-         */<br>
-        Thing pimoThing();<br>
-<br>
-        /**<br>
           * Operator to compare two Resource objects.<br>
           */<br>
          bool operator==( const Resource&amp; ) const;<br>
diff --git a/libnepomukcore/resource/<u></u>resourcedata.cpp<br>
b/libnepomukcore/resource/<u></u>resourcedata.cpp<br>
index f908177..e19b4bd 100644<br>
--- a/libnepomukcore/resource/<u></u>resourcedata.cpp<br>
+++ b/libnepomukcore/resource/<u></u>resourcedata.cpp<br>
@@ -54,6 +54,8 @@ using namespace Soprano;<br>
<br>
  #define MAINMODEL (m_rm-&gt;m_manager-&gt;mainModel())<br>
<br>
+using namespace Soprano::Vocabulary;<br>
+using namespace Nepomuk2::Vocabulary;<br>
<br>
  Nepomuk2::ResourceData::<u></u>ResourceData( const QUrl&amp; uri, const \
QUrl&amp;<br> kickOffUri, const QUrl&amp; type, ResourceManagerPrivate* rm )<br>
      : m_uri(uri),<br>
@@ -61,8 +63,6 @@ Nepomuk2::ResourceData::<u></u>ResourceData( const QUrl&amp; \
uri,<br> const QUrl&amp; kickOffUri, c<br>
        m_modificationMutex(QMutex::<u></u>Recursive),<br>
        m_cacheDirty(false),<br>
        m_addedToWatcher(false),<br>
-      m_pimoThing(0),<br>
-      m_groundingOccurence(0),<br>
        m_rm(rm)<br>
  {<br>
      if( m_mainType.isEmpty() ) {<br>
@@ -197,9 +197,6 @@ void Nepomuk2::ResourceData::<u></u>resetAll( bool isDelete )<br>
      m_cache.clear();<br>
      m_cacheDirty = false;<br>
      m_types.clear();<br>
-    delete m_pimoThing;<br>
-    m_pimoThing = 0;<br>
-    m_groundingOccurence = 0;<br>
<br>
      // when we are being deleted the value of m_mainType is not important<br>
      // anymore. Also since ResourceManager is a global static it might be<br>
@@ -321,13 +318,6 @@ bool Nepomuk2::ResourceData::store(<u></u>)<br>
              m_rm-&gt;addToKickOffList( this, m_kickoffUris );<br>
          }<br>
<br>
-        // store our grounding occurrence in case we are a thing<br>
created by the pimoThing() method<br>
-        if( m_groundingOccurence ) {<br>
-            if( m_groundingOccurence != this )<br>
-                m_groundingOccurence-&gt;store();<br>
-            setProperty(Vocabulary::PIMO::<u></u>groundingOccurrence(),<br>
Variant(m_groundingOccurence-&gt;<u></u>uri()) );<br>
-        }<br>
-<br>
          foreach( const KUrl&amp; url, m_kickoffUris ) {<br>
              if( url.scheme().isEmpty() )<br>
                  setProperty( Soprano::Vocabulary::NAO::<u></u>identifier(),<br>
Variant(url.url()) );<br>
@@ -437,23 +427,6 @@ bool Nepomuk2::ResourceData::load()<br>
              }<br>
<br>
              m_cacheDirty = false;<br>
-<br>
-            delete m_pimoThing;<br>
-            m_pimoThing = 0;<br>
-            if( hasType( Vocabulary::PIMO::Thing() ) ) {<br>
-                m_pimoThing = new Thing( m_uri );<br>
-            }<br>
-            else {<br>
-                // TODO: somehow handle pimo:referencingOccurrence and<br>
pimo:occurrence<br>
-                QueryResultIterator pimoIt = MAINMODEL-&gt;executeQuery(<br>
QString( &quot;select ?r where { ?r &lt;%1&gt; &lt;%2&gt; . }&quot;)<br>
-<br>
.arg( Vocabulary::PIMO::<u></u>groundingOccurrence().<u></u>toString() )<br>
-<br>
.arg( QString::fromAscii( m_uri.toEncoded() ) ),<br>
-<br>
Soprano::Query::<u></u>QueryLanguageSparqlNoInference );<br>
-                if( pimoIt.next() ) {<br>
-                    m_pimoThing = new Thing( pimoIt.binding(&quot;r&quot;).uri() \
                );<br>
-                }<br>
-            }<br>
-<br>
              return true;<br>
          }<br>
          else {<br>
@@ -707,32 +680,6 @@ void Nepomuk2::ResourceData::<u></u>invalidateCache()<br>
  }<br>
<br>
<br>
-Nepomuk2::Thing Nepomuk2::ResourceData::<u></u>pimoThing()<br>
-{<br>
-    load();<br>
-    if( !m_pimoThing ) {<br>
-        //<br>
-        // We only create a new thing if we are a nie:InformationElement.<br>
-        // All other resources will simply be converted into a pimo:Thing<br>
-        //<br>
-        // Files, however, are a special case in every aspect. this<br>
includes pimo things.<br>
-        // Files are their own grounding occurrence. This makes a lot<br>
of things<br>
-        // much simpler.<br>
-        //<br>
-        if( hasType( Vocabulary::PIMO::Thing() ) ||<br>
-                isFile() ||<br>
-                !hasType( Vocabulary::NIE::<u></u>InformationElement() ) ) {<br>
-            m_pimoThing = new Thing(this);<br>
-        }<br>
-        else {<br>
-            m_pimoThing = new Thing();<br>
-        }<br>
-        m_pimoThing-&gt;m_data-&gt;m_<u></u>groundingOccurence = this;<br>
-    }<br>
-    return *m_pimoThing;<br>
-}<br>
-<br>
-<br>
  bool Nepomuk2::ResourceData::<u></u>operator==( const ResourceData&amp; other ) \
const<br>  {<br>
      if( this == &amp;other )<br>
diff --git a/libnepomukcore/resource/<u></u>resourcedata.h<br>
b/libnepomukcore/resource/<u></u>resourcedata.h<br>
index c6b267f..3708897 100644<br>
--- a/libnepomukcore/resource/<u></u>resourcedata.h<br>
+++ b/libnepomukcore/resource/<u></u>resourcedata.h<br>
@@ -29,7 +29,6 @@<br>
  #include &lt;QtCore/QSet&gt;<br>
<br>
  #include &quot;variant.h&quot;<br>
-#include &quot;thing.h&quot;<br>
  #include &lt;kurl.h&gt;<br>
<br>
  #include &lt;soprano/statement.h&gt;<br>
@@ -157,8 +156,6 @@ namespace Nepomuk2 {<br>
<br>
          void invalidateCache();<br>
<br>
-        Thing pimoThing();<br>
-<br>
          /**<br>
           * Compares the properties of two ResourceData objects taking<br>
into account the Deleted flag<br>
           */<br>
@@ -205,12 +202,6 @@ namespace Nepomuk2 {<br>
          bool m_cacheDirty;<br>
          bool m_addedToWatcher;<br>
<br>
-        // using a pointer to avoid infinite creation loop<br>
-        Thing* m_pimoThing;<br>
-<br>
-        // only used for delayed storage of the pimo thing relation<br>
-        ResourceData* m_groundingOccurence;<br>
-<br>
          ResourceManagerPrivate* m_rm;<br>
      };<br>
  }<br>
<br>
<br>
<br>
On Sun, Jul 1, 2012 at 4:39 PM, Vishesh Handa &lt;<a href="mailto:me@vhanda.in" \
target="_blank">me@vhanda.in</a><br></div></div><div class="im"> &lt;mailto:<a \
href="mailto:me@vhanda.in" target="_blank">me@vhanda.in</a>&gt;&gt; wrote:<br> <br>
    Hey Sebastian<br>
<br>
    I still have around 3 more weeks during which I&#39;m allowed to break<br>
    ABI and API compatibility. I was thinking of changing -<br>
<br>
    * Resource::resourceUri() -&gt; Resource::uri()<br>
    * Resource::resourceType() -&gt; Resource::type()<br>
<br>
    Is that okay?<br>
<br>
    --<br>
    Vishesh Handa<br>
<br>
<br>
<br>
<br>
--<br>
Vishesh Handa<br>
<br>
</div></blockquote>
</blockquote></div><br><br clear="all"><br>-- <br><span \
style="color:rgb(192,192,192)">Vishesh Handa</span><br><br>



_______________________________________________
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