You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ss...@apache.org on 2013/07/11 13:04:56 UTC
git commit: fix MARMOTTA-191 (changing GraphResultWriter according to
Peter's recommendation)
Updated Branches:
refs/heads/develop b83ad66e8 -> deb2d4f30
fix MARMOTTA-191 (changing GraphResultWriter according to Peter's recommendation)
Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/deb2d4f3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/deb2d4f3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/deb2d4f3
Branch: refs/heads/develop
Commit: deb2d4f30d006d0dfb2a8a32dea0ba9f1bbcb5bb
Parents: b83ad66
Author: Sebastian Schaffert <ss...@apache.org>
Authored: Thu Jul 11 13:04:46 2013 +0200
Committer: Sebastian Schaffert <ss...@apache.org>
Committed: Thu Jul 11 13:04:46 2013 +0200
----------------------------------------------------------------------
.../sparqlio/rdf/SPARQLGraphResultWriter.java | 21 +++-----------------
1 file changed, 3 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/deb2d4f3/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/rdf/SPARQLGraphResultWriter.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/rdf/SPARQLGraphResultWriter.java b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/rdf/SPARQLGraphResultWriter.java
index 0623365..2e7a189 100644
--- a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/rdf/SPARQLGraphResultWriter.java
+++ b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/rdf/SPARQLGraphResultWriter.java
@@ -23,6 +23,7 @@ import java.util.Map;
import org.openrdf.query.GraphQueryResult;
import org.openrdf.query.QueryEvaluationException;
+import org.openrdf.query.resultio.QueryResultIO;
import org.openrdf.repository.Repository;
import org.openrdf.repository.RepositoryConnection;
import org.openrdf.repository.RepositoryException;
@@ -55,29 +56,13 @@ public class SPARQLGraphResultWriter {
}
public void write(GraphQueryResult result) throws IOException {
- Repository repository = new SailRepository(new MemoryStore());
- try {
- repository.initialize();
-
- RepositoryConnection conn = repository.getConnection();
-
- for(Map.Entry<String,String> namespace : result.getNamespaces().entrySet()) {
- conn.setNamespace(namespace.getKey(), namespace.getValue());
- }
- conn.add(result);
- conn.commit();
-
- RDFWriter writer = Rio.createWriter(format, outputStream);
- conn.export(writer);
- conn.close();
- repository.shutDown();
+ try {
+ QueryResultIO.write(result,format,outputStream);
outputStream.flush();
outputStream.close();
- } catch (RepositoryException e) {
- throw new IOException("query result writing failed because there was an error while creating temporary triple store", e);
} catch (QueryEvaluationException e) {
throw new IOException("query result writing failed because query evaluation had a problem", e);
} catch (RDFHandlerException e) {