Bug 204402 - sopranocmd export don't works with SPAQL
Summary: sopranocmd export don't works with SPAQL
Status: RESOLVED FIXED
Alias: None
Product: nepomuk
Classification: Unmaintained
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Sebastian Trueg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-19 13:46 UTC by Ignacio Serantes
Modified: 2010-10-26 14:01 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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;