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

List:       kde-commits
Subject:    playground/base/nepomuk-kde/search-api
From:       Sebastian Trueg <sebastian () trueg ! de>
Date:       2008-04-29 16:49:26
Message-ID: 1209487766.186751.17433.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 802497 by trueg:

Enhance plain sparql queries with the requested properties patterns. Although we do \
not have a proper Soprano query API yet it should work just fine in case there is a \
variable called r

 M  +1 -1      query.h  
 M  +13 -1     searchthread.cpp  


--- trunk/playground/base/nepomuk-kde/search-api/query.h #802496:802497
@@ -54,7 +54,7 @@
             Query( const Term& term );
 
             /**
-             * Create a SPARQL query. The query has to have one select variable.
+             * Create a SPARQL query. The query has to have one select variable \
                called "?r"
              */
             Query( const QString& sparqlQuery );
 
--- trunk/playground/base/nepomuk-kde/search-api/searchthread.cpp #802496:802497
@@ -248,7 +248,19 @@
         search( splitLuceneSparql( t ) /*optimize( resolveValues( resolveFields( \
m_searchTerm ) ) )*/, 1.0, true );  }
     else {
-        sparqlQuery( m_searchTerm.sparqlQuery(), 1.0, true );
+        // FIXME: once we have the Soprano query API it should be simple to add the \
requestProperties here +        // for now we do it the hacky way
+        QString query = m_searchTerm.sparqlQuery();
+        int pos = query.indexOf( QLatin1String( "where" ) );
+        if ( pos > 0 ) {
+            query.insert( pos, buildRequestPropertyVariableList() + ' ' );
+            pos = query.lastIndexOf( '}' );
+            if ( pos > 0 ) {
+                query.insert( pos, ' ' + buildRequestPropertyPatterns() + ' ' );
+            }
+        }
+
+        sparqlQuery( query, 1.0, true );
     }
 
     kDebug() << time.elapsed();


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

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