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

List:       kde-commits
Subject:    KDE/kdelibs/nepomuk/query
From:       Sebastian Trueg <sebastian () trueg ! de>
Date:       2010-09-20 9:16:20
Message-ID: 20100920091620.6615AAC7CB () svn ! kde ! org
[Download RAW message or body]

SVN commit 1177457 by trueg:

When looking for a non-optional resource type term in a query also handle a set of \
resource type terms combined in an or term.

 M  +14 -1     query.cpp  


--- trunk/KDE/kdelibs/nepomuk/query/query.cpp #1177456:1177457
@@ -158,14 +158,27 @@
         if( term.isResourceTypeTerm() ) {
             return true;
         }
+
+        // in an and-term a single resource type term is sufficient
         else if( term.isAndTerm() ) {
             Q_FOREACH( const Nepomuk::Query::Term& subTerm, \
                term.toAndTerm().subTerms() ) {
-                if( subTerm.isResourceTypeTerm() ) {
+                if( containsResourceTypeTerm(subTerm) ) {
                     return true;
                 }
             }
         }
 
+        // an or-term which only consists of resource type terms is valid also
+        else if( term.isOrTerm() ) {
+            Q_FOREACH( const Nepomuk::Query::Term& subTerm, \
term.toOrTerm().subTerms() ) { +                if( \
!containsResourceTypeTerm(subTerm) ) { +                    return false;
+                }
+            }
+            // at this point all subterms contain a non-optional resource type term
+            return true;
+        }
+
         // fallback
         return false;
     }


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

Configure | About | News | Add a list | Sponsored by KoreLogic