Bug 204402

Summary: sopranocmd export don't works with SPAQL
Product: [Unmaintained] nepomuk Reporter: Ignacio Serantes <kde>
Component: generalAssignee: Sebastian Trueg <sebastian>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Ignacio Serantes 2009-08-19 13:46:34 UTC
Version:            (using 4.3.00 (KDE 4.3.0) "release 155", KDE:KDE4:Factory:Desktop / openSUSE_11.1)
Compiler:          gcc
OS:                Linux (x86_64) release 2.6.27.25-0.1-default

I'm trying to create a backup system for manual nepomuk data but export method with SPAQL query don't works.

Test case:

The next query is working fine:

sopranocmd --socket `kde4-config --localprefix`/share/apps/nepomuk/socket --model main query "select ?y where { ?x <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#identifier> ?y .} ORDER BY ?y"

but if I try using with export:

sopranocmd --socket `kde4-config --localprefix`/share/apps/nepomuk/socket --model main export "select ?y where { ?x <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#identifier> ?y .} ORDER BY ?y" nepomuk.tags.backup.txt

******************************************
   .
   .
   .
   .
   .
   .
   .
******************************************

Please, note that I only put a few first lines but all lines are the same.

Add some test cases to sopranocmd could be useful.
Comment 1 Sebastian Trueg 2009-08-19 14:30:32 UTC
SVN commit 1013270 by trueg:

Only graph queries can be serialized. Fail with an error if the query is not a graph query.

BUG: 204402


 M  +11 -4     sopranocmd.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1013270
Comment 2 Sebastian Trueg 2010-10-26 14:01:06 UTC
commit 7cebda729c022156a28dbe9d712039307ad9b548
branch 2.4
Author: Sebastian Trueg <sebastian@trueg.de>
Date:   Wed Aug 19 12:30:09 2009 +0000

    Only graph queries can be serialized. Fail with an error if the query is not a graph query.
    
    BUG: 204402
    
    svn path=/trunk/kdesupport/soprano/; revision=1013270

diff --git a/tools/sopranocmd.cpp b/tools/sopranocmd.cpp
index 49ec31c..0e77414 100644
--- a/tools/sopranocmd.cpp
+++ b/tools/sopranocmd.cpp
@@ -837,10 +837,17 @@ int main( int argc, char *argv[] )
             success = exportFile( model->listStatements(), fileName, serialization );
         }
         else {
-            success = exportFile( model->executeQuery( tuneQuery( query, queryLang ),
-                                                       Soprano::Query::queryLanguageFromString( queryLang ), queryLang ).iterateStatements(),
-                                  fileName,
-                                  serialization );
+            QueryResultIterator it = model->executeQuery( tuneQuery( query, queryLang ),
+                                                          Soprano::Query::queryLanguageFromString( queryLang ), queryLang );
+            if ( it.isGraph() ) {
+                success = exportFile( it.iterateStatements(),
+                                      fileName,
+                                      serialization );
+            }
+            else {
+                errStream << "Can only export graph queries";
+                return 1;
+            }
         }
 
         delete model;