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 really complicate the code base.<br><br>commit 755131d501c687c790c166f8d1ce4d1b56550301<br>
Author: Vishesh Handa <<a href="mailto:me@vhanda.in">me@vhanda.in</a>><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/resource.cpp b/libnepomukcore/resource/resource.cpp<br>index b559f07..c237f44 100644<br>--- a/libnepomukcore/resource/resource.cpp<br>+++ b/libnepomukcore/resource/resource.cpp<br>
@@ -25,7 +25,6 @@<br> #include "tools.h"<br> #include "tag.h"<br> #include "pimo.h"<br>-#include "thing.h"<br> #include "file.h"<br> #include "property.h"<br> #include "nfo.h"<br>
@@ -283,9 +282,9 @@ QString Nepomuk2::Resource::genericLabel() const<br> if(!label.isEmpty())<br> return label;<br> <br>- label = m_data->pimoThing().label();<br>- if(!label.isEmpty())<br>- return label;<br>
+ //label = m_data->pimoThing().label();<br>+ //if(!label.isEmpty())<br>+ // return label;<br> <br> label = property( Nepomuk2::Vocabulary::NFO::fileName() ).toString();<br> if(!label.isEmpty())<br>
@@ -357,13 +356,6 @@ QString Nepomuk2::Resource::genericIcon() const<br> }<br> <br> <br>-Nepomuk2::Thing Nepomuk2::Resource::pimoThing()<br>-{<br>- determineFinalResourceData();<br>- return m_data->pimoThing();<br>
-}<br>-<br>-<br> bool Nepomuk2::Resource::operator==( const Resource& other ) const<br> {<br> if( this == &other )<br>diff --git a/libnepomukcore/resource/resource.h b/libnepomukcore/resource/resource.h<br>index 2edb562..3cc30c2 100644<br>
--- a/libnepomukcore/resource/resource.h<br>+++ b/libnepomukcore/resource/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. If this resource<br>
- * itself is a pimo:Thing, a reference to this is returned. If a pimo:Thing exists<br>- * with has as occurrence this resource, the thing is returned. 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& ) const;<br>
diff --git a/libnepomukcore/resource/resourcedata.cpp b/libnepomukcore/resource/resourcedata.cpp<br>index f908177..e19b4bd 100644<br>--- a/libnepomukcore/resource/resourcedata.cpp<br>+++ b/libnepomukcore/resource/resourcedata.cpp<br>
@@ -54,6 +54,8 @@ using namespace Soprano;<br> <br> #define MAINMODEL (m_rm->m_manager->mainModel())<br> <br>+using namespace Soprano::Vocabulary;<br>+using namespace Nepomuk2::Vocabulary;<br> <br> Nepomuk2::ResourceData::ResourceData( const QUrl& uri, const QUrl& kickOffUri, const QUrl& type, ResourceManagerPrivate* rm )<br>
: m_uri(uri),<br>@@ -61,8 +63,6 @@ Nepomuk2::ResourceData::ResourceData( const QUrl& uri, const QUrl& kickOffUri, c<br> m_modificationMutex(QMutex::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::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()<br> m_rm->addToKickOffList( this, m_kickoffUris );<br> }<br> <br>
- // store our grounding occurrence in case we are a thing created by the pimoThing() method<br>- if( m_groundingOccurence ) {<br>- if( m_groundingOccurence != this )<br>- m_groundingOccurence->store();<br>
- setProperty(Vocabulary::PIMO::groundingOccurrence(), Variant(m_groundingOccurence->uri()) );<br>- }<br>-<br> foreach( const KUrl& url, m_kickoffUris ) {<br> if( url.scheme().isEmpty() )<br>
setProperty( Soprano::Vocabulary::NAO::identifier(), 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 pimo:occurrence<br>- QueryResultIterator pimoIt = MAINMODEL->executeQuery( QString( "select ?r where { ?r <%1> <%2> . }")<br>
- .arg( Vocabulary::PIMO::groundingOccurrence().toString() )<br>- .arg( QString::fromAscii( m_uri.toEncoded() ) ),<br>
- Soprano::Query::QueryLanguageSparqlNoInference );<br>- if( pimoIt.next() ) {<br>- m_pimoThing = new Thing( pimoIt.binding("r").uri() );<br>
- }<br>- }<br>-<br> return true;<br> }<br> else {<br>@@ -707,32 +680,6 @@ void Nepomuk2::ResourceData::invalidateCache()<br> }<br> <br> <br>-Nepomuk2::Thing Nepomuk2::ResourceData::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 includes pimo things.<br>- // Files are their own grounding occurrence. This makes a lot of things<br>- // much simpler.<br>
- //<br>- if( hasType( Vocabulary::PIMO::Thing() ) ||<br>- isFile() ||<br>- !hasType( Vocabulary::NIE::InformationElement() ) ) {<br>- m_pimoThing = new Thing(this);<br>
- }<br>- else {<br>- m_pimoThing = new Thing();<br>- }<br>- m_pimoThing->m_data->m_groundingOccurence = this;<br>- }<br>- return *m_pimoThing;<br>-}<br>-<br>-<br> bool Nepomuk2::ResourceData::operator==( const ResourceData& other ) const<br>
{<br> if( this == &other )<br>diff --git a/libnepomukcore/resource/resourcedata.h b/libnepomukcore/resource/resourcedata.h<br>index c6b267f..3708897 100644<br>--- a/libnepomukcore/resource/resourcedata.h<br>+++ b/libnepomukcore/resource/resourcedata.h<br>
@@ -29,7 +29,6 @@<br> #include <QtCore/QSet><br> <br> #include "variant.h"<br>-#include "thing.h"<br> #include <kurl.h><br> <br> #include <soprano/statement.h><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 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><div class="gmail_quote">On Sun, Jul 1, 2012 at 4:39 PM, Vishesh Handa <span dir="ltr"><<a href="mailto:me@vhanda.in" target="_blank">me@vhanda.in</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hey Sebastian<br clear="all"><br>I still have around 3 more weeks during which I'm allowed to break ABI and API compatibility. I was thinking of changing -<br>
<br>* Resource::resourceUri() -> Resource::uri()<br>* Resource::resourceType() -> Resource::type()<br>
<br>Is that okay?<span class="HOEnZb"><font color="#888888"><br><br>-- <br><span style="color:rgb(192,192,192)">Vishesh Handa</span><br><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><span style="color:rgb(192,192,192)">Vishesh Handa</span><br><br>