~ubuntu-branches/ubuntu/natty/kde4libs/natty-proposed

« back to all changes in this revision

Viewing changes to nepomuk/types/entity.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell, Jonathan Riddell, Jonathan Thomas
  • Date: 2010-12-09 17:00:17 UTC
  • mfrom: (1.13.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101209170017-2xingl25r2qb5jv4
Tags: 4:4.5.90-0ubuntu1
[ Jonathan Riddell ]
* New upstream RC release
* Remove kubuntu_69_declare_debugger_pid.diff applied upstream
* Remove kubuntu_77_no_kbookmark_write_error.diff applied upstream

[ Jonathan Thomas ]
* Get rid of missing symbols that were either private or pollution from
  linked libraries. (The KRating* move from libnepomuk to kdeui is not an
  ABI break since libnepomuk links against kdeui)

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
 
66
66
bool Nepomuk::Types::EntityPrivate::load()
67
67
{
 
68
    const QString query = QString::fromLatin1( "select ?p ?o where { "
 
69
                                               "graph ?g { <%1> ?p ?o . } . "
 
70
                                               "{ ?g a %2 . } UNION { ?g a %3 . } . }" )
 
71
                          .arg( QString::fromAscii( uri.toEncoded() ),
 
72
                                Soprano::Node::resourceToN3( Soprano::Vocabulary::NRL::Ontology() ),
 
73
                                Soprano::Node::resourceToN3( Soprano::Vocabulary::NRL::KnowledgeBase() ) );
 
74
                          
68
75
    Soprano::QueryResultIterator it
69
 
        = ResourceManager::instance()->mainModel()->executeQuery( QString("select ?p ?o where { "
70
 
                                                                          "graph ?g { <%1> ?p ?o . } . "
71
 
                                                                          "{ ?g a <%2> . } UNION { ?g a <%3> . } . }")
72
 
                                                                  .arg( QString::fromAscii( uri.toEncoded() ) )
73
 
                                                                  .arg( Soprano::Vocabulary::NRL::Ontology().toString() )
74
 
                                                                  .arg( Soprano::Vocabulary::NRL::KnowledgeBase().toString() ),
75
 
                                                                  Soprano::Query::QueryLanguageSparql );
 
76
        = ResourceManager::instance()->mainModel()->executeQuery( query, Soprano::Query::QueryLanguageSparql );
76
77
    while ( it.next() ) {
77
78
        QUrl property = it.binding( "p" ).uri();
78
79
        Soprano::Node value = it.binding( "o" );
114
115
 
115
116
bool Nepomuk::Types::EntityPrivate::loadAncestors()
116
117
{
 
118
    const QString query = QString::fromLatin1( "select ?s ?p where { "
 
119
                                               "graph ?g { ?s ?p <%1> . } . "
 
120
                                               "{ ?g a %2 . } UNION { ?g a %3 . } . }" )
 
121
                          .arg( QString::fromAscii( uri.toEncoded() ),
 
122
                                Soprano::Node::resourceToN3( Soprano::Vocabulary::NRL::Ontology() ),
 
123
                                Soprano::Node::resourceToN3( Soprano::Vocabulary::NRL::KnowledgeBase() ) );
 
124
                          
117
125
    Soprano::QueryResultIterator it
118
 
        = ResourceManager::instance()->mainModel()->executeQuery( QString("select ?s ?p where { "
119
 
                                                                          "graph ?g { ?s ?p <%1> . } . "
120
 
                                                                          "{ ?g a <%2> . } UNION { ?g a <%3> . } . }")
121
 
                                                                  .arg( QString::fromAscii( uri.toEncoded() ) )
122
 
                                                                  .arg( Soprano::Vocabulary::NRL::Ontology().toString() )
123
 
                                                                  .arg( Soprano::Vocabulary::NRL::KnowledgeBase().toString() ),
124
 
                                                                  Soprano::Query::QueryLanguageSparql );
 
126
        = ResourceManager::instance()->mainModel()->executeQuery( query, Soprano::Query::QueryLanguageSparql );
125
127
    while ( it.next() ) {
126
128
        addAncestorProperty( it.binding( "s" ).uri(), it.binding( "p" ).uri() );
127
129
    }
135
137
{
136
138
    QMutexLocker lock( &mutex );
137
139
 
138
 
    label.truncate(0);
139
 
    comment.truncate(0);
140
 
    l10nLabel.truncate(0);
141
 
    l10nComment.truncate(0);;
 
140
    label.clear();
 
141
    comment.clear();
 
142
    l10nLabel.clear();
 
143
    l10nComment.clear();;
142
144
 
143
145
    icon = QIcon();
144
146
 
307
309
 
308
310
bool Nepomuk::Types::Entity::operator==( const QUrl& other ) const
309
311
{
310
 
    // since we use one instace cache we can improve comparation operations
311
 
    // intensly by not comparing URLs but pointers.
312
312
    if( d )
313
313
        return( d->uri == other );
314
314
    else
315
 
        return !other.isValid();
 
315
        return other.isEmpty();
316
316
}
317
317
 
318
318
 
326
326
 
327
327
bool Nepomuk::Types::Entity::operator!=( const QUrl& other ) const
328
328
{
329
 
    // since we use one instace cache we can improve comparation operations
330
 
    // intensly by not comparing URLs but pointers.
331
329
    if( d )
332
330
        return( d->uri != other );
333
331
    else
334
 
        return other.isValid();
 
332
        return !other.isEmpty();
335
333
}
336
334
 
337
335