[Nepomuk] Nepomuk2::Resource backward compatibility

Sebastian Trüg trueg at kde.org
Wed Jul 4 08:09:09 UTC 2012


oki

On 07/03/2012 02:44 PM, Vishesh Handa wrote:
>
>
> On Tue, Jul 3, 2012 at 12:15 AM, Sebastian Trüg <trueg at kde.org
> <mailto:trueg at 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 at vhanda.in <mailto:me at vhanda.in>
>         <mailto:me at vhanda.in <mailto:me at 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 at vhanda.in
>         <mailto:me at vhanda.in>
>         <mailto:me at vhanda.in <mailto:me at 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
>


More information about the Nepomuk mailing list