You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by wi...@apache.org on 2013/04/17 09:50:32 UTC

[1/9] git commit: MARMOTTA-204: updated to Sesame 2.7.0

Updated Branches:
  refs/heads/develop 84338158b -> bc33de369


MARMOTTA-204: updated to Sesame 2.7.0


Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/b1776b1b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/b1776b1b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/b1776b1b

Branch: refs/heads/develop
Commit: b1776b1b500cb05f13f96952c1f543de81f6dfc7
Parents: 8433815
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed Apr 17 08:32:37 2013 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed Apr 17 08:32:37 2013 +0200

----------------------------------------------------------------------
 parent/pom.xml |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/b1776b1b/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 0e8afc4..b3d2548 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -36,7 +36,7 @@
     <url>http://marmotta.incubator.apache.org</url>
 
     <properties>
-        <sesame.version>2.7.0-beta2</sesame.version>
+        <sesame.version>2.7.0</sesame.version>
         <junit.version>4.11</junit.version>
         <weld.version>1.1.Final</weld.version>
         <weld.core.version>1.1.11.Final</weld.core.version>


[2/9] git commit: MARMOTTA-204: updated rdf/json writer to be fully compliant with sesame 2.7.0

Posted by wi...@apache.org.
MARMOTTA-204: updated rdf/json writer to be fully compliant with sesame 2.7.0


Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/c5b52623
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/c5b52623
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/c5b52623

Branch: refs/heads/develop
Commit: c5b526236b67e9af501c8151716fc0e4047bae2c
Parents: b1776b1
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed Apr 17 08:59:06 2013 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed Apr 17 08:59:06 2013 +0200

----------------------------------------------------------------------
 .../commons/sesame/rio/rdfjson/RDFJsonWriter.java  |   64 ++++++++++++---
 1 files changed, 51 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c5b52623/commons/sesame-tools-rio-rdfjson/src/main/java/org/apache/marmotta/commons/sesame/rio/rdfjson/RDFJsonWriter.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-rio-rdfjson/src/main/java/org/apache/marmotta/commons/sesame/rio/rdfjson/RDFJsonWriter.java b/commons/sesame-tools-rio-rdfjson/src/main/java/org/apache/marmotta/commons/sesame/rio/rdfjson/RDFJsonWriter.java
index 0395f21..f64ada6 100644
--- a/commons/sesame-tools-rio-rdfjson/src/main/java/org/apache/marmotta/commons/sesame/rio/rdfjson/RDFJsonWriter.java
+++ b/commons/sesame-tools-rio-rdfjson/src/main/java/org/apache/marmotta/commons/sesame/rio/rdfjson/RDFJsonWriter.java
@@ -17,6 +17,15 @@
  */
 package org.apache.marmotta.commons.sesame.rio.rdfjson;
 
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+
 import org.codehaus.jackson.map.ObjectMapper;
 import org.openrdf.model.BNode;
 import org.openrdf.model.Literal;
@@ -26,18 +35,14 @@ import org.openrdf.model.Value;
 import org.openrdf.rio.RDFFormat;
 import org.openrdf.rio.RDFHandlerException;
 import org.openrdf.rio.RDFWriter;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.util.HashMap;
-import java.util.HashSet;
+import org.openrdf.rio.RioSetting;
+import org.openrdf.rio.WriterConfig;
 
 /**
- * Add file description here!
- * <p/>
- * User: sschaffe
+ * RDF/JSON RIO Writer
+ * 
+ * @author Sebastian Schaffert
+ * @author Sergio Fernández
  */
 public class RDFJsonWriter implements RDFWriter {
 
@@ -49,12 +54,11 @@ public class RDFJsonWriter implements RDFWriter {
     private static final String LANG = "lang";
     private static final String DATATYPE = "datatype";
 
-
     private Writer writer;
-
+    private WriterConfig config;
+    
     private HashMap<String,HashMap<String,HashSet<HashMap<String,String>>>> subjects;
 
-
     public RDFJsonWriter(OutputStream out) {
         writer = new OutputStreamWriter(out);
     }
@@ -115,6 +119,7 @@ public class RDFJsonWriter implements RDFWriter {
      */
     @Override
     public void handleNamespace(String prefix, String uri) throws RDFHandlerException {
+    	
     }
 
     /**
@@ -186,8 +191,41 @@ public class RDFJsonWriter implements RDFWriter {
      */
     @Override
     public void handleComment(String comment) throws RDFHandlerException {
+    	
     }
 
+    /**
+     * @return A collection of {@link RioSetting}s that are supported by this
+     *         RDFWriter.
+     * @since 2.7.0
+     */
+	@Override
+	public Collection<RioSetting<?>> getSupportedSettings() {
+		return new ArrayList<RioSetting<?>>();
+	}
+
+    /**
+     * Retrieves the current writer configuration as a single object.
+     * 
+     * @return a writer configuration object representing the current
+     *         configuration of the writer.
+     * @since 2.7.0
+     */
+	@Override
+	public WriterConfig getWriterConfig() {
+		return config;
+	}
 
+    /**
+     * Sets all supplied writer configuration options.
+     * 
+     * @param config
+     *        a writer configuration object.
+     * @since 2.7.0
+     */
+	@Override
+	public void setWriterConfig(WriterConfig config) {
+		this.config = config;
+	}
 
 }


[7/9] git commit: MARMOTTA-204: updated marmotta-sparql to be compatible with the new rio writers in sesame 2.7.0

Posted by wi...@apache.org.
MARMOTTA-204: updated marmotta-sparql to be compatible with the new rio writers in sesame 2.7.0


Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/2a2baa77
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/2a2baa77
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/2a2baa77

Branch: refs/heads/develop
Commit: 2a2baa770b9532f280c56f958099e6cbc568fbe6
Parents: 9cbf5ea
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed Apr 17 09:30:15 2013 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed Apr 17 09:30:15 2013 +0200

----------------------------------------------------------------------
 .../sparqlhtml/SPARQLBooleanHTMLWriter.java        |  135 +++-
 .../sparqlhtml/SPARQLResultsHTMLWriter.java        |   95 +++-
 .../sparqlhtml/SPARQLResultsHTMLWriterXSL.java     |  104 +++-
 .../sparqljson/SPARQLBooleanJSONWriter.java        |  111 +++-
 .../sparqljson/SPARQLResultsJSONWriter.java        |  538 ++++++++-------
 5 files changed, 708 insertions(+), 275 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/2a2baa77/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/sparqlhtml/SPARQLBooleanHTMLWriter.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/sparqlhtml/SPARQLBooleanHTMLWriter.java b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/sparqlhtml/SPARQLBooleanHTMLWriter.java
index bc08941..28b83e3 100644
--- a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/sparqlhtml/SPARQLBooleanHTMLWriter.java
+++ b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/sparqlhtml/SPARQLBooleanHTMLWriter.java
@@ -17,36 +17,47 @@
  */
 package org.apache.marmotta.platform.sparql.services.sparqlio.sparqlhtml;
 
+import java.io.BufferedWriter;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.Templates;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamSource;
+
 import org.apache.marmotta.platform.core.api.config.ConfigurationService;
 import org.apache.marmotta.platform.core.util.CDIContext;
 import org.jdom2.Document;
 import org.jdom2.output.Format;
 import org.jdom2.output.XMLOutputter;
 import org.jdom2.transform.JDOMResult;
+import org.openrdf.query.BindingSet;
+import org.openrdf.query.QueryResultHandlerException;
+import org.openrdf.query.TupleQueryResultHandlerException;
 import org.openrdf.query.resultio.BooleanQueryResultFormat;
 import org.openrdf.query.resultio.BooleanQueryResultWriter;
+import org.openrdf.query.resultio.QueryResultFormat;
 import org.openrdf.query.resultio.sparqlxml.SPARQLBooleanXMLWriter;
+import org.openrdf.rio.RioSetting;
+import org.openrdf.rio.WriterConfig;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.xml.transform.Source;
-import javax.xml.transform.Templates;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.stream.StreamSource;
-import java.io.BufferedWriter;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.nio.charset.Charset;
-
 /**
- * Add file description here!
- * <p/>
- * User: sschaffe
+ * SPARQL Boolean HTML RIO Writer
+ * 
+ * @author Sebastian Schaffert
+ * @author Sergio Fernández
  */
 public class SPARQLBooleanHTMLWriter implements BooleanQueryResultWriter {
 
@@ -55,14 +66,15 @@ public class SPARQLBooleanHTMLWriter implements BooleanQueryResultWriter {
     private OutputStream out;
     private ByteArrayOutputStream xmlOut;
 
-    private SPARQLBooleanXMLWriter xmlWriter;
+    private SPARQLBooleanXMLWriter writer;
+    private WriterConfig config;
 
     private Templates stylesheet;
 
     public SPARQLBooleanHTMLWriter(OutputStream out) {
         this.out = out;
         this.xmlOut = new ByteArrayOutputStream();
-        this.xmlWriter = new SPARQLBooleanXMLWriter(xmlOut);
+        this.writer = new SPARQLBooleanXMLWriter(xmlOut);
 
         Source s_stylesheet = new StreamSource(SPARQLBooleanHTMLWriter.class.getResourceAsStream("style.xsl"));
         try {
@@ -85,7 +97,7 @@ public class SPARQLBooleanHTMLWriter implements BooleanQueryResultWriter {
      */
     @Override
     public void write(boolean value) throws IOException {
-        xmlWriter.write(value);
+        writer.write(value);
 
         byte[] queryResult = xmlOut.toByteArray();
 
@@ -94,7 +106,7 @@ public class SPARQLBooleanHTMLWriter implements BooleanQueryResultWriter {
 
         BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out));
         try {
-            Source input      = new StreamSource(new ByteArrayInputStream(queryResult));
+            Source input = new StreamSource(new ByteArrayInputStream(queryResult));
 
             Transformer transformer = stylesheet.newTransformer();
             transformer.setParameter("serverurl", server_uri);
@@ -111,6 +123,85 @@ public class SPARQLBooleanHTMLWriter implements BooleanQueryResultWriter {
         } finally {
             writer.close();
         }
-
     }
+
+	@Override
+	public void endHeader() throws QueryResultHandlerException {
+		
+	}
+
+	@Override
+	public QueryResultFormat getQueryResultFormat() {
+		return new QueryResultFormat("HTML", "text/html", Charset.forName("utf-8"), "html");
+	}
+
+	@Override
+	public Collection<RioSetting<?>> getSupportedSettings() {
+		return new ArrayList<RioSetting<?>>();
+	}
+
+	@Override
+	public WriterConfig getWriterConfig() {
+		return config;
+	}
+
+	@Override
+	public void handleNamespace(String arg0, String arg1) throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void handleStylesheet(String arg0) throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void setWriterConfig(WriterConfig config) {
+		this.config = config;
+	}
+
+	@Override
+	public void startDocument() throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void startHeader() throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void endQueryResult() throws TupleQueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void handleBoolean(boolean arg0) throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void handleLinks(List<String> links) throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void handleSolution(BindingSet bindings) throws TupleQueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void startQueryResult(List<String> start) throws TupleQueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+    
 }

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/2a2baa77/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/sparqlhtml/SPARQLResultsHTMLWriter.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/sparqlhtml/SPARQLResultsHTMLWriter.java b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/sparqlhtml/SPARQLResultsHTMLWriter.java
index 05560a4..a1cc0e3 100644
--- a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/sparqlhtml/SPARQLResultsHTMLWriter.java
+++ b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/sparqlhtml/SPARQLResultsHTMLWriter.java
@@ -20,6 +20,8 @@ package org.apache.marmotta.platform.sparql.services.sparqlio.sparqlhtml;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -27,9 +29,13 @@ import java.util.Map;
 
 import org.apache.marmotta.platform.core.api.templating.TemplatingService;
 import org.openrdf.query.BindingSet;
+import org.openrdf.query.QueryResultHandlerException;
 import org.openrdf.query.TupleQueryResultHandlerException;
+import org.openrdf.query.resultio.QueryResultFormat;
 import org.openrdf.query.resultio.TupleQueryResultFormat;
 import org.openrdf.query.resultio.TupleQueryResultWriter;
+import org.openrdf.rio.RioSetting;
+import org.openrdf.rio.WriterConfig;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -54,6 +60,8 @@ public class SPARQLResultsHTMLWriter implements TupleQueryResultWriter {
 
     private TemplatingService templatingService;
     
+    private WriterConfig config;
+    
     public SPARQLResultsHTMLWriter(OutputStream out, TemplatingService templatingService) {
         this.out = out;
     }
@@ -106,6 +114,91 @@ public class SPARQLResultsHTMLWriter implements TupleQueryResultWriter {
             log.error(e.getMessage(), e);
             throw new TupleQueryResultHandlerException(e);
         }
-	}	
+	}
+
+	@Override
+	public void handleBoolean(boolean arg0) throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void handleLinks(List<String> arg0)
+			throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public QueryResultFormat getQueryResultFormat() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void handleNamespace(String prefix, String uri)
+			throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void startDocument() throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void handleStylesheet(String stylesheetUrl)
+			throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void startHeader() throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void endHeader() throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+    /**
+     * @return A collection of {@link RioSetting}s that are supported by this
+     *         RDFWriter.
+     * @since 2.7.0
+     */
+	@Override
+	public Collection<RioSetting<?>> getSupportedSettings() {
+		return new ArrayList<RioSetting<?>>();
+	}
+
+    /**
+     * Retrieves the current writer configuration as a single object.
+     * 
+     * @return a writer configuration object representing the current
+     *         configuration of the writer.
+     * @since 2.7.0
+     */
+	@Override
+	public WriterConfig getWriterConfig() {
+		return config;
+	}
+
+    /**
+     * Sets all supplied writer configuration options.
+     * 
+     * @param config
+     *        a writer configuration object.
+     * @since 2.7.0
+     */
+	@Override
+	public void setWriterConfig(WriterConfig config) {
+		this.config = config;
+	}
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/2a2baa77/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/sparqlhtml/SPARQLResultsHTMLWriterXSL.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/sparqlhtml/SPARQLResultsHTMLWriterXSL.java b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/sparqlhtml/SPARQLResultsHTMLWriterXSL.java
index 56fbe11..5959b2a 100644
--- a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/sparqlhtml/SPARQLResultsHTMLWriterXSL.java
+++ b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/sparqlhtml/SPARQLResultsHTMLWriterXSL.java
@@ -24,10 +24,14 @@ import org.jdom2.output.Format;
 import org.jdom2.output.XMLOutputter;
 import org.jdom2.transform.JDOMResult;
 import org.openrdf.query.BindingSet;
+import org.openrdf.query.QueryResultHandlerException;
 import org.openrdf.query.TupleQueryResultHandlerException;
+import org.openrdf.query.resultio.QueryResultFormat;
 import org.openrdf.query.resultio.TupleQueryResultFormat;
 import org.openrdf.query.resultio.TupleQueryResultWriter;
 import org.openrdf.query.resultio.sparqlxml.SPARQLResultsXMLWriter;
+import org.openrdf.rio.RioSetting;
+import org.openrdf.rio.WriterConfig;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -44,6 +48,8 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 
 /**
@@ -59,14 +65,16 @@ public class SPARQLResultsHTMLWriterXSL implements TupleQueryResultWriter {
     private OutputStream out;
     private ByteArrayOutputStream xmlOut;
 
-    private SPARQLResultsXMLWriter xmlWriter;
+    private SPARQLResultsXMLWriter writer;
+    
+    private WriterConfig config;
 
     private Templates stylesheet;
 
     public SPARQLResultsHTMLWriterXSL(OutputStream out) {
         this.out = out;
         this.xmlOut = new ByteArrayOutputStream();
-        this.xmlWriter = new SPARQLResultsXMLWriter(xmlOut);
+        this.writer = new SPARQLResultsXMLWriter(xmlOut);
         Source s_stylesheet = new StreamSource(SPARQLResultsHTMLWriterXSL.class.getResourceAsStream("style.xsl"));
         try {
             stylesheet = TransformerFactory.newInstance().newTemplates(s_stylesheet);
@@ -93,7 +101,7 @@ public class SPARQLResultsHTMLWriterXSL implements TupleQueryResultWriter {
      */
     @Override
     public void startQueryResult(List<String> bindingNames) throws TupleQueryResultHandlerException {
-        xmlWriter.startQueryResult(bindingNames);
+        writer.startQueryResult(bindingNames);
     }
 
     /**
@@ -101,7 +109,7 @@ public class SPARQLResultsHTMLWriterXSL implements TupleQueryResultWriter {
      */
     @Override
     public void endQueryResult() throws TupleQueryResultHandlerException {
-        xmlWriter.endQueryResult();
+        writer.endQueryResult();
 
         // get server uri
         String server_uri = CDIContext.getInstance(ConfigurationService.class).getServerUri();
@@ -138,6 +146,92 @@ public class SPARQLResultsHTMLWriterXSL implements TupleQueryResultWriter {
      */
     @Override
     public void handleSolution(BindingSet bindingSet) throws TupleQueryResultHandlerException {
-        xmlWriter.handleSolution(bindingSet);
+        writer.handleSolution(bindingSet);
     }
+
+	@Override
+	public void handleBoolean(boolean arg0) throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void handleLinks(List<String> arg0)
+			throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public QueryResultFormat getQueryResultFormat() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void handleNamespace(String prefix, String uri)
+			throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void startDocument() throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void handleStylesheet(String stylesheetUrl)
+			throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void startHeader() throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void endHeader() throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+    /**
+     * @return A collection of {@link RioSetting}s that are supported by this
+     *         RDFWriter.
+     * @since 2.7.0
+     */
+	@Override
+	public Collection<RioSetting<?>> getSupportedSettings() {
+		return new ArrayList<RioSetting<?>>();
+	}
+
+    /**
+     * Retrieves the current writer configuration as a single object.
+     * 
+     * @return a writer configuration object representing the current
+     *         configuration of the writer.
+     * @since 2.7.0
+     */
+	@Override
+	public WriterConfig getWriterConfig() {
+		return config;
+	}
+
+    /**
+     * Sets all supplied writer configuration options.
+     * 
+     * @param config
+     *        a writer configuration object.
+     * @since 2.7.0
+     */
+	@Override
+	public void setWriterConfig(WriterConfig config) {
+		this.config = config;
+	}
+	
 }

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/2a2baa77/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/sparqljson/SPARQLBooleanJSONWriter.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/sparqljson/SPARQLBooleanJSONWriter.java b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/sparqljson/SPARQLBooleanJSONWriter.java
index b9c81d9..31ef321 100644
--- a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/sparqljson/SPARQLBooleanJSONWriter.java
+++ b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/sparqljson/SPARQLBooleanJSONWriter.java
@@ -17,14 +17,23 @@
  */
 package org.apache.marmotta.platform.sparql.services.sparqlio.sparqljson;
 
+import org.openrdf.query.BindingSet;
+import org.openrdf.query.QueryResultHandlerException;
+import org.openrdf.query.TupleQueryResultHandlerException;
 import org.openrdf.query.resultio.BooleanQueryResultFormat;
 import org.openrdf.query.resultio.BooleanQueryResultWriter;
+import org.openrdf.query.resultio.QueryResultFormat;
+import org.openrdf.rio.RioSetting;
+import org.openrdf.rio.WriterConfig;
 
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
 
 /**
  * Add file description here!
@@ -33,8 +42,8 @@ import java.nio.charset.Charset;
  */
 public class SPARQLBooleanJSONWriter implements BooleanQueryResultWriter {
 
-
     private OutputStream out;
+    private WriterConfig config;
 
     public SPARQLBooleanJSONWriter(OutputStream out) {
         this.out = out;
@@ -59,4 +68,104 @@ public class SPARQLBooleanJSONWriter implements BooleanQueryResultWriter {
         writer.flush();
         writer.close();
     }
+    
+    /**
+     * @return A collection of {@link RioSetting}s that are supported by this
+     *         RDFWriter.
+     * @since 2.7.0
+     */
+	@Override
+	public Collection<RioSetting<?>> getSupportedSettings() {
+		return new ArrayList<RioSetting<?>>();
+	}
+
+    /**
+     * Retrieves the current writer configuration as a single object.
+     * 
+     * @return a writer configuration object representing the current
+     *         configuration of the writer.
+     * @since 2.7.0
+     */
+	@Override
+	public WriterConfig getWriterConfig() {
+		return config;
+	}
+
+    /**
+     * Sets all supplied writer configuration options.
+     * 
+     * @param config
+     *        a writer configuration object.
+     * @since 2.7.0
+     */
+	@Override
+	public void setWriterConfig(WriterConfig config) {
+		this.config = config;
+	}
+
+	@Override
+	public QueryResultFormat getQueryResultFormat() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void handleNamespace(String prefix, String uri) throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void startDocument() throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void handleStylesheet(String stylesheetUrl) throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void startHeader() throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void endHeader() throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void endQueryResult() throws TupleQueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void handleBoolean(boolean arg0) throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void handleLinks(List<String> arg0) throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void handleSolution(BindingSet arg0) throws TupleQueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void startQueryResult(List<String> arg0) throws TupleQueryResultHandlerException {
+		// TODO Auto-generated method stub
+		
+	}    
 }

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/2a2baa77/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/sparqljson/SPARQLResultsJSONWriter.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/sparqljson/SPARQLResultsJSONWriter.java b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/sparqljson/SPARQLResultsJSONWriter.java
index 0bf4881..941ec6d 100644
--- a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/sparqljson/SPARQLResultsJSONWriter.java
+++ b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/services/sparqlio/sparqljson/SPARQLResultsJSONWriter.java
@@ -17,27 +17,33 @@
  */
 package org.apache.marmotta.platform.sparql.services.sparqlio.sparqljson;
 
+import info.aduna.io.IndentingWriter;
+import info.aduna.text.StringUtil;
+
 import java.io.BufferedWriter;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
 import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 
-import info.aduna.io.IndentingWriter;
-import info.aduna.text.StringUtil;
-
 import org.openrdf.model.BNode;
 import org.openrdf.model.Literal;
 import org.openrdf.model.URI;
 import org.openrdf.model.Value;
 import org.openrdf.query.Binding;
 import org.openrdf.query.BindingSet;
+import org.openrdf.query.QueryResultHandlerException;
 import org.openrdf.query.TupleQueryResultHandlerException;
+import org.openrdf.query.resultio.QueryResultFormat;
 import org.openrdf.query.resultio.TupleQueryResultFormat;
 import org.openrdf.query.resultio.TupleQueryResultWriter;
+import org.openrdf.rio.RioSetting;
+import org.openrdf.rio.WriterConfig;
 
 /**
  * A TupleQueryResultWriter that writes query results in the <a
@@ -46,247 +52,287 @@ import org.openrdf.query.resultio.TupleQueryResultWriter;
  */
 public class SPARQLResultsJSONWriter implements TupleQueryResultWriter {
 
-	/*-----------*
-	 * Variables *
-	 *-----------*/
-
-    private IndentingWriter writer;
-
-    private boolean firstTupleWritten;
-
-	/*--------------*
-	 * Constructors *
-	 *--------------*/
-
-    public SPARQLResultsJSONWriter(OutputStream out) {
-        Writer w = new OutputStreamWriter(out, Charset.forName("UTF-8"));
-        w = new BufferedWriter(w, 1024);
-        writer = new IndentingWriter(w);
-    }
-
-	/*---------*
-	 * Methods *
-	 *---------*/
-
-    public final TupleQueryResultFormat getTupleQueryResultFormat() {
-        return TupleQueryResultFormat.JSON;
-    }
-
-    public void startQueryResult(List<String> columnHeaders)
-            throws TupleQueryResultHandlerException
-    {
-        try {
-            openBraces();
-
-            // Write header
-            writeKey("head");
-            openBraces();
-            writeKeyValue("vars", columnHeaders);
-            closeBraces();
-
-            writeComma();
-
-            // Write results
-            writeKey("results");
-            openBraces();
-
-            writeKey("bindings");
-            openArray();
-
-            firstTupleWritten = false;
-        }
-        catch (IOException e) {
-            throw new TupleQueryResultHandlerException(e);
-        }
-    }
-
-    public void endQueryResult()
-            throws TupleQueryResultHandlerException
-    {
-        try {
-            closeArray(); // bindings array
-            closeBraces(); // results braces
-            closeBraces(); // root braces
-            writer.flush();
-        }
-        catch (IOException e) {
-            throw new TupleQueryResultHandlerException(e);
-        }
-    }
-
-    public void handleSolution(BindingSet bindingSet)
-            throws TupleQueryResultHandlerException
-    {
-        try {
-            if (firstTupleWritten) {
-                writeComma();
-            }
-            else {
-                firstTupleWritten = true;
-            }
-
-            openBraces(); // start of new solution
-
-            Iterator<Binding> bindingIter = bindingSet.iterator();
-            while (bindingIter.hasNext()) {
-                Binding binding = bindingIter.next();
-
-                writeKeyValue(binding.getName(), binding.getValue());
-
-                if (bindingIter.hasNext()) {
-                    writeComma();
-                }
-            }
-
-            closeBraces(); // end solution
-
-            writer.flush();
-        }
-        catch (IOException e) {
-            throw new TupleQueryResultHandlerException(e);
-        }
-    }
-
-    private void writeKeyValue(String key, String value)
-            throws IOException
-    {
-        writeKey(key);
-        writeString(value);
-    }
-
-    private void writeKeyValue(String key, Value value)
-            throws IOException, TupleQueryResultHandlerException
-    {
-        writeKey(key);
-        writeValue(value);
-    }
-
-    private void writeKeyValue(String key, Iterable<String> array)
-            throws IOException
-    {
-        writeKey(key);
-        writeArray(array);
-    }
-
-    private void writeKey(String key)
-            throws IOException
-    {
-        writeString(key);
-        writer.write(": ");
-    }
-
-    private void writeValue(Value value)
-            throws IOException, TupleQueryResultHandlerException
-    {
-        writer.write("{ ");
-
-        if (value instanceof URI) {
-            writeKeyValue("type", "uri");
-            writer.write(", ");
-            writeKeyValue("value", ((URI)value).toString());
-        }
-        else if (value instanceof BNode) {
-            writeKeyValue("type", "bnode");
-            writer.write(", ");
-            writeKeyValue("value", ((BNode)value).getID());
-        }
-        else if (value instanceof Literal) {
-            Literal lit = (Literal)value;
-
-            if (lit.getLanguage() != null) {
-                writeKeyValue("xml:lang", lit.getLanguage());
-                writer.write(", ");
-            }
-            if (lit.getDatatype() != null) {
-                writeKeyValue("datatype", lit.getDatatype().toString());
-                writer.write(", ");
-            }
-
-            writeKeyValue("type", "literal");
-
-            writer.write(", ");
-            writeKeyValue("value", lit.getLabel());
-        }
-        else {
-            throw new TupleQueryResultHandlerException("Unknown Value object type: " + value.getClass());
-        }
-
-        writer.write(" }");
-    }
-
-    private void writeString(String value)
-            throws IOException
-    {
-        // Escape special characters
-        value = StringUtil.gsub("\\", "\\\\", value);
-        value = StringUtil.gsub("\"", "\\\"", value);
-        value = StringUtil.gsub("/", "\\/", value);
-        value = StringUtil.gsub("\b", "\\b", value);
-        value = StringUtil.gsub("\f", "\\f", value);
-        value = StringUtil.gsub("\n", "\\n", value);
-        value = StringUtil.gsub("\r", "\\r", value);
-        value = StringUtil.gsub("\t", "\\t", value);
-
-        writer.write("\"");
-        writer.write(value);
-        writer.write("\"");
-    }
-
-    private void writeArray(Iterable<String> array)
-            throws IOException
-    {
-        writer.write("[ ");
-
-        Iterator<String> iter = array.iterator();
-        while (iter.hasNext()) {
-            String value = iter.next();
-
-            writeString(value);
-
-            if (iter.hasNext()) {
-                writer.write(", ");
-            }
-        }
-
-        writer.write(" ]");
-    }
-
-    private void openArray()
-            throws IOException
-    {
-        writer.write("[");
-        writer.writeEOL();
-        writer.increaseIndentation();
-    }
-
-    private void closeArray()
-            throws IOException
-    {
-        writer.writeEOL();
-        writer.decreaseIndentation();
-        writer.write("]");
-    }
-
-    private void openBraces()
-            throws IOException
-    {
-        writer.write("{");
-        writer.writeEOL();
-        writer.increaseIndentation();
-    }
-
-    private void closeBraces()
-            throws IOException
-    {
-        writer.writeEOL();
-        writer.decreaseIndentation();
-        writer.write("}");
-    }
-
-    private void writeComma()
-            throws IOException
-    {
-        writer.write(", ");
-        writer.writeEOL();
-    }
+	private IndentingWriter writer;
+
+	private WriterConfig config;
+	
+	private boolean firstTupleWritten;
+
+	public SPARQLResultsJSONWriter(OutputStream out) {
+		Writer w = new OutputStreamWriter(out, Charset.forName("UTF-8"));
+		w = new BufferedWriter(w, 1024);
+		writer = new IndentingWriter(w);
+	}
+
+	public final TupleQueryResultFormat getTupleQueryResultFormat() {
+		return TupleQueryResultFormat.JSON;
+	}
+
+	public void startQueryResult(List<String> columnHeaders) throws TupleQueryResultHandlerException {
+		try {
+			openBraces();
+
+			// Write header
+			writeKey("head");
+			openBraces();
+			writeKeyValue("vars", columnHeaders);
+			closeBraces();
+
+			writeComma();
+
+			// Write results
+			writeKey("results");
+			openBraces();
+
+			writeKey("bindings");
+			openArray();
+
+			firstTupleWritten = false;
+		} catch (IOException e) {
+			throw new TupleQueryResultHandlerException(e);
+		}
+	}
+
+	public void endQueryResult() throws TupleQueryResultHandlerException {
+		try {
+			closeArray(); // bindings array
+			closeBraces(); // results braces
+			closeBraces(); // root braces
+			writer.flush();
+		} catch (IOException e) {
+			throw new TupleQueryResultHandlerException(e);
+		}
+	}
+
+	public void handleSolution(BindingSet bindingSet) throws TupleQueryResultHandlerException {
+		try {
+			if (firstTupleWritten) {
+				writeComma();
+			} else {
+				firstTupleWritten = true;
+			}
+
+			openBraces(); // start of new solution
+
+			Iterator<Binding> bindingIter = bindingSet.iterator();
+			while (bindingIter.hasNext()) {
+				Binding binding = bindingIter.next();
+
+				writeKeyValue(binding.getName(), binding.getValue());
+
+				if (bindingIter.hasNext()) {
+					writeComma();
+				}
+			}
+
+			closeBraces(); // end solution
+
+			writer.flush();
+		} catch (IOException e) {
+			throw new TupleQueryResultHandlerException(e);
+		}
+	}
+
+	private void writeKeyValue(String key, String value) throws IOException {
+		writeKey(key);
+		writeString(value);
+	}
+
+	private void writeKeyValue(String key, Value value) throws IOException, TupleQueryResultHandlerException {
+		writeKey(key);
+		writeValue(value);
+	}
+
+	private void writeKeyValue(String key, Iterable<String> array)
+			throws IOException {
+		writeKey(key);
+		writeArray(array);
+	}
+
+	private void writeKey(String key) throws IOException {
+		writeString(key);
+		writer.write(": ");
+	}
+
+	private void writeValue(Value value) throws IOException, TupleQueryResultHandlerException {
+		writer.write("{ ");
+
+		if (value instanceof URI) {
+			writeKeyValue("type", "uri");
+			writer.write(", ");
+			writeKeyValue("value", ((URI) value).toString());
+		} else if (value instanceof BNode) {
+			writeKeyValue("type", "bnode");
+			writer.write(", ");
+			writeKeyValue("value", ((BNode) value).getID());
+		} else if (value instanceof Literal) {
+			Literal lit = (Literal) value;
+
+			if (lit.getLanguage() != null) {
+				writeKeyValue("xml:lang", lit.getLanguage());
+				writer.write(", ");
+			}
+			if (lit.getDatatype() != null) {
+				writeKeyValue("datatype", lit.getDatatype().toString());
+				writer.write(", ");
+			}
+
+			writeKeyValue("type", "literal");
+
+			writer.write(", ");
+			writeKeyValue("value", lit.getLabel());
+		} else {
+			throw new TupleQueryResultHandlerException(
+					"Unknown Value object type: " + value.getClass());
+		}
+
+		writer.write(" }");
+	}
+
+	private void writeString(String value) throws IOException {
+		// Escape special characters
+		value = StringUtil.gsub("\\", "\\\\", value);
+		value = StringUtil.gsub("\"", "\\\"", value);
+		value = StringUtil.gsub("/", "\\/", value);
+		value = StringUtil.gsub("\b", "\\b", value);
+		value = StringUtil.gsub("\f", "\\f", value);
+		value = StringUtil.gsub("\n", "\\n", value);
+		value = StringUtil.gsub("\r", "\\r", value);
+		value = StringUtil.gsub("\t", "\\t", value);
+
+		writer.write("\"");
+		writer.write(value);
+		writer.write("\"");
+	}
+
+	private void writeArray(Iterable<String> array) throws IOException {
+		writer.write("[ ");
+
+		Iterator<String> iter = array.iterator();
+		while (iter.hasNext()) {
+			String value = iter.next();
+
+			writeString(value);
+
+			if (iter.hasNext()) {
+				writer.write(", ");
+			}
+		}
+
+		writer.write(" ]");
+	}
+
+	private void openArray() throws IOException {
+		writer.write("[");
+		writer.writeEOL();
+		writer.increaseIndentation();
+	}
+
+	private void closeArray() throws IOException {
+		writer.writeEOL();
+		writer.decreaseIndentation();
+		writer.write("]");
+	}
+
+	private void openBraces() throws IOException {
+		writer.write("{");
+		writer.writeEOL();
+		writer.increaseIndentation();
+	}
+
+	private void closeBraces() throws IOException {
+		writer.writeEOL();
+		writer.decreaseIndentation();
+		writer.write("}");
+	}
+
+	private void writeComma() throws IOException {
+		writer.write(", ");
+		writer.writeEOL();
+	}
+
+	@Override
+	public void handleBoolean(boolean arg0) throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+
+	}
+
+	@Override
+	public void handleLinks(List<String> arg0)
+			throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+
+	}
+
+	@Override
+	public QueryResultFormat getQueryResultFormat() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void handleNamespace(String prefix, String uri)
+			throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+
+	}
+
+	@Override
+	public void startDocument() throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+
+	}
+
+	@Override
+	public void handleStylesheet(String stylesheetUrl)
+			throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+
+	}
+
+	@Override
+	public void startHeader() throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+
+	}
+
+	@Override
+	public void endHeader() throws QueryResultHandlerException {
+		// TODO Auto-generated method stub
+
+	}
+
+    /**
+     * @return A collection of {@link RioSetting}s that are supported by this
+     *         RDFWriter.
+     * @since 2.7.0
+     */
+	@Override
+	public Collection<RioSetting<?>> getSupportedSettings() {
+		return new ArrayList<RioSetting<?>>();
+	}
+
+    /**
+     * Retrieves the current writer configuration as a single object.
+     * 
+     * @return a writer configuration object representing the current
+     *         configuration of the writer.
+     * @since 2.7.0
+     */
+	@Override
+	public WriterConfig getWriterConfig() {
+		return config;
+	}
+
+    /**
+     * Sets all supplied writer configuration options.
+     * 
+     * @param config
+     *        a writer configuration object.
+     * @since 2.7.0
+     */
+	@Override
+	public void setWriterConfig(WriterConfig config) {
+		this.config = config;
+	}
 }


[3/9] git commit: MARMOTTA-204: updated json-ld writer to be fully compliant with sesame 2.7.0

Posted by wi...@apache.org.
MARMOTTA-204: updated json-ld writer to be fully compliant with sesame 2.7.0


Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/0458350e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/0458350e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/0458350e

Branch: refs/heads/develop
Commit: 0458350e6d02096b91da77f48c22b685906efdfb
Parents: c5b5262
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed Apr 17 09:01:50 2013 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed Apr 17 09:01:50 2013 +0200

----------------------------------------------------------------------
 .../commons/sesame/rio/jsonld/JsonLdWriter.java    |   43 ++++++++++++++-
 1 files changed, 41 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/0458350e/commons/sesame-tools-rio-jsonld/src/main/java/org/apache/marmotta/commons/sesame/rio/jsonld/JsonLdWriter.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-rio-jsonld/src/main/java/org/apache/marmotta/commons/sesame/rio/jsonld/JsonLdWriter.java b/commons/sesame-tools-rio-jsonld/src/main/java/org/apache/marmotta/commons/sesame/rio/jsonld/JsonLdWriter.java
index c788c85..863887b 100644
--- a/commons/sesame-tools-rio-jsonld/src/main/java/org/apache/marmotta/commons/sesame/rio/jsonld/JsonLdWriter.java
+++ b/commons/sesame-tools-rio-jsonld/src/main/java/org/apache/marmotta/commons/sesame/rio/jsonld/JsonLdWriter.java
@@ -22,11 +22,15 @@ import org.openrdf.model.Statement;
 import org.openrdf.rio.RDFFormat;
 import org.openrdf.rio.RDFHandlerException;
 import org.openrdf.rio.RDFWriter;
+import org.openrdf.rio.RioSetting;
+import org.openrdf.rio.WriterConfig;
 
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Collection;
 
 /**
  * Add file description here!
@@ -35,9 +39,9 @@ import java.io.Writer;
  */
 public class JsonLdWriter implements RDFWriter {
 
-
     private PrintWriter writer;
-
+    private WriterConfig config;
+    
     SesameJSONLDSerializer serializer;
 
     public JsonLdWriter(OutputStream out) {
@@ -122,5 +126,40 @@ public class JsonLdWriter implements RDFWriter {
      */
     @Override
     public void handleComment(String comment) throws RDFHandlerException {
+    	
     }
+    
+    /**
+     * @return A collection of {@link RioSetting}s that are supported by this
+     *         RDFWriter.
+     * @since 2.7.0
+     */
+	@Override
+	public Collection<RioSetting<?>> getSupportedSettings() {
+		return new ArrayList<RioSetting<?>>();
+	}
+
+    /**
+     * Retrieves the current writer configuration as a single object.
+     * 
+     * @return a writer configuration object representing the current
+     *         configuration of the writer.
+     * @since 2.7.0
+     */
+	@Override
+	public WriterConfig getWriterConfig() {
+		return config;
+	}
+
+    /**
+     * Sets all supplied writer configuration options.
+     * 
+     * @param config
+     *        a writer configuration object.
+     * @since 2.7.0
+     */
+	@Override
+	public void setWriterConfig(WriterConfig config) {
+		this.config = config;
+	}    
 }


[8/9] git commit: MARMOTTA-204: updated ldclient rdf provider to be compatible with sesame 2.7.0

Posted by wi...@apache.org.
MARMOTTA-204: updated ldclient rdf provider to be compatible with sesame 2.7.0


Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/921a57ea
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/921a57ea
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/921a57ea

Branch: refs/heads/develop
Commit: 921a57ea2b52ede369d4a627d4f338dbf5f898e9
Parents: 2a2baa7
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed Apr 17 09:46:14 2013 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed Apr 17 09:46:14 2013 +0200

----------------------------------------------------------------------
 .../ldclient/provider/rdf/SPARQLProvider.java      |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/921a57ea/libraries/ldclient/ldclient-provider-rdf/src/main/java/org/apache/marmotta/ldclient/provider/rdf/SPARQLProvider.java
----------------------------------------------------------------------
diff --git a/libraries/ldclient/ldclient-provider-rdf/src/main/java/org/apache/marmotta/ldclient/provider/rdf/SPARQLProvider.java b/libraries/ldclient/ldclient-provider-rdf/src/main/java/org/apache/marmotta/ldclient/provider/rdf/SPARQLProvider.java
index 929b59e..ac8062e 100644
--- a/libraries/ldclient/ldclient-provider-rdf/src/main/java/org/apache/marmotta/ldclient/provider/rdf/SPARQLProvider.java
+++ b/libraries/ldclient/ldclient-provider-rdf/src/main/java/org/apache/marmotta/ldclient/provider/rdf/SPARQLProvider.java
@@ -24,6 +24,7 @@ import org.apache.marmotta.ldclient.services.provider.AbstractHttpProvider;
 import org.openrdf.model.URI;
 import org.openrdf.model.Value;
 import org.openrdf.query.BindingSet;
+import org.openrdf.query.QueryResultHandlerException;
 import org.openrdf.query.TupleQueryResultHandler;
 import org.openrdf.query.TupleQueryResultHandlerException;
 import org.openrdf.query.resultio.QueryResultIO;
@@ -173,6 +174,19 @@ public class SPARQLProvider extends AbstractHttpProvider {
                                 throw new TupleQueryResultHandlerException("error while adding triple to repository connection",e);
                             }
                         }
+
+						@Override
+						public void handleBoolean(boolean bool	) throws QueryResultHandlerException {
+							// TODO Auto-generated method stub
+							
+						}
+
+						@Override
+						public void handleLinks(List<String> links) throws QueryResultHandlerException {
+							// TODO Auto-generated method stub
+							
+						}
+						
                     },
                     triples.getValueFactory());
 


[9/9] git commit: MARMOTTA-204: updated kiwi reasoner to be compatible with the new signature of ValueFactory.createLiteral() on sesame 2.7.0

Posted by wi...@apache.org.
MARMOTTA-204: updated kiwi reasoner to be compatible with the new signature of ValueFactory.createLiteral() on sesame 2.7.0


Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/bc33de36
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/bc33de36
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/bc33de36

Branch: refs/heads/develop
Commit: bc33de369d52610a34e8fb9afdfdeefd672a55c1
Parents: 921a57e
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed Apr 17 09:49:03 2013 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed Apr 17 09:49:03 2013 +0200

----------------------------------------------------------------------
 .../reasoner/parser/KWRLProgramParserBase.java     |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/bc33de36/libraries/kiwi/kiwi-reasoner/src/main/java/org/apache/marmotta/kiwi/reasoner/parser/KWRLProgramParserBase.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-reasoner/src/main/java/org/apache/marmotta/kiwi/reasoner/parser/KWRLProgramParserBase.java b/libraries/kiwi/kiwi-reasoner/src/main/java/org/apache/marmotta/kiwi/reasoner/parser/KWRLProgramParserBase.java
index 550da32..0074b4c 100644
--- a/libraries/kiwi/kiwi-reasoner/src/main/java/org/apache/marmotta/kiwi/reasoner/parser/KWRLProgramParserBase.java
+++ b/libraries/kiwi/kiwi-reasoner/src/main/java/org/apache/marmotta/kiwi/reasoner/parser/KWRLProgramParserBase.java
@@ -128,14 +128,13 @@ public abstract class KWRLProgramParserBase {
         return valueFactory.createURI(uri);
     }
 
-
     protected Literal resolveLiteral(Object content, Locale loc, String typeUri) {
         if(typeUri != null) {
             return valueFactory.createLiteral(content.toString(),valueFactory.createURI(typeUri));
         } else if(loc != null) {
             return valueFactory.createLiteral(content.toString(), loc.getLanguage());
         } else {
-            return valueFactory.createLiteral(content);
+            return valueFactory.createLiteral(content.toString());
         }
     }
 


[6/9] git commit: MARMOTTA-204: updated html rdf writter to be compatible with sesame 2.7.0

Posted by wi...@apache.org.
MARMOTTA-204: updated html rdf writter to be compatible with sesame 2.7.0


Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/9cbf5eae
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/9cbf5eae
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/9cbf5eae

Branch: refs/heads/develop
Commit: 9cbf5eaed4a13bfb72d1913e4cf92479ed2ed0e9
Parents: 1ff9df6
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed Apr 17 09:29:31 2013 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed Apr 17 09:29:31 2013 +0200

----------------------------------------------------------------------
 .../platform/core/rio/RDFHtmlWriterImpl.java       |   39 +++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/9cbf5eae/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/rio/RDFHtmlWriterImpl.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/rio/RDFHtmlWriterImpl.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/rio/RDFHtmlWriterImpl.java
index 92dc972..4dbba17 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/rio/RDFHtmlWriterImpl.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/rio/RDFHtmlWriterImpl.java
@@ -24,6 +24,7 @@ import java.io.UnsupportedEncodingException;
 import java.io.Writer;
 import java.net.URLEncoder;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
@@ -46,6 +47,8 @@ import org.openrdf.model.URI;
 import org.openrdf.model.Value;
 import org.openrdf.rio.RDFFormat;
 import org.openrdf.rio.RDFHandlerException;
+import org.openrdf.rio.RioSetting;
+import org.openrdf.rio.WriterConfig;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -68,6 +71,8 @@ public class RDFHtmlWriterImpl implements RDFHtmlWriter {
     protected Logger log = LoggerFactory.getLogger(RDFHtmlWriterImpl.class);
 
     protected PrintWriter writer;
+    
+    protected WriterConfig config;
 
     protected Map<Resource, SortedSet<Statement>> tripleMap = new HashMap<Resource, SortedSet<Statement>>();
 
@@ -318,5 +323,39 @@ public class RDFHtmlWriterImpl implements RDFHtmlWriter {
     public RDFWriterPriority getPriority() {
         return RDFWriterPriority.MEDIUM;
     }
+    
+    /**
+     * @return A collection of {@link RioSetting}s that are supported by this
+     *         RDFWriter.
+     * @since 2.7.0
+     */
+	@Override
+	public Collection<RioSetting<?>> getSupportedSettings() {
+		return new ArrayList<RioSetting<?>>();
+	}
+
+    /**
+     * Retrieves the current writer configuration as a single object.
+     * 
+     * @return a writer configuration object representing the current
+     *         configuration of the writer.
+     * @since 2.7.0
+     */
+	@Override
+	public WriterConfig getWriterConfig() {
+		return config;
+	}
+
+    /**
+     * Sets all supplied writer configuration options.
+     * 
+     * @param config
+     *        a writer configuration object.
+     * @since 2.7.0
+     */
+	@Override
+	public void setWriterConfig(WriterConfig config) {
+		this.config = config;
+	}    
 
 }


[5/9] git commit: MARMOTTA-204: updated kiwi triplestore to be fully compatible with sesame 2.7.0

Posted by wi...@apache.org.
MARMOTTA-204: updated kiwi triplestore to be fully compatible with sesame 2.7.0


Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/1ff9df65
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/1ff9df65
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/1ff9df65

Branch: refs/heads/develop
Commit: 1ff9df65e72e69d42f35bb68f2caf5602ff36a93
Parents: 3e5720b
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed Apr 17 09:10:35 2013 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed Apr 17 09:10:35 2013 +0200

----------------------------------------------------------------------
 .../marmotta/kiwi/model/rdf/KiWiNamespace.java     |    7 ++-
 .../marmotta/kiwi/sail/KiWiValueFactory.java       |   42 +++++++++-----
 2 files changed, 33 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/1ff9df65/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/model/rdf/KiWiNamespace.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/model/rdf/KiWiNamespace.java b/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/model/rdf/KiWiNamespace.java
index 83ec60c..42957f3 100644
--- a/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/model/rdf/KiWiNamespace.java
+++ b/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/model/rdf/KiWiNamespace.java
@@ -57,7 +57,6 @@ public class KiWiNamespace implements Namespace, Serializable {
 
     public String getPrefix() {
         return prefix;
-        
     }
 
     public void setPrefix(String prefix) {
@@ -159,4 +158,10 @@ public class KiWiNamespace implements Namespace, Serializable {
         result = 31 * result + (deleted != null ? deleted.hashCode() : 0);
         return result;
     }
+
+	@Override
+	public int compareTo(Namespace other) {
+		return uri.compareTo(other.getName());
+	}
+	
 }

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/1ff9df65/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/sail/KiWiValueFactory.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/sail/KiWiValueFactory.java b/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/sail/KiWiValueFactory.java
index 22038f6..dc7c631 100644
--- a/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/sail/KiWiValueFactory.java
+++ b/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/sail/KiWiValueFactory.java
@@ -17,13 +17,34 @@
  */
 package org.apache.marmotta.kiwi.sail;
 
-import com.google.common.collect.MapMaker;
+import info.aduna.iteration.Iterations;
+
+import java.sql.SQLException;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+import java.util.Random;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.locks.ReentrantLock;
+
+import javax.xml.datatype.XMLGregorianCalendar;
+
 import org.apache.commons.lang.LocaleUtils;
 import org.apache.marmotta.commons.sesame.model.LiteralCommons;
 import org.apache.marmotta.commons.sesame.model.Namespaces;
 import org.apache.marmotta.commons.util.DateUtils;
 import org.apache.marmotta.kiwi.model.caching.IntArray;
-import org.apache.marmotta.kiwi.model.rdf.*;
+import org.apache.marmotta.kiwi.model.rdf.KiWiAnonResource;
+import org.apache.marmotta.kiwi.model.rdf.KiWiBooleanLiteral;
+import org.apache.marmotta.kiwi.model.rdf.KiWiDateLiteral;
+import org.apache.marmotta.kiwi.model.rdf.KiWiDoubleLiteral;
+import org.apache.marmotta.kiwi.model.rdf.KiWiIntLiteral;
+import org.apache.marmotta.kiwi.model.rdf.KiWiLiteral;
+import org.apache.marmotta.kiwi.model.rdf.KiWiNode;
+import org.apache.marmotta.kiwi.model.rdf.KiWiResource;
+import org.apache.marmotta.kiwi.model.rdf.KiWiStringLiteral;
+import org.apache.marmotta.kiwi.model.rdf.KiWiTriple;
+import org.apache.marmotta.kiwi.model.rdf.KiWiUriResource;
 import org.apache.marmotta.kiwi.persistence.KiWiConnection;
 import org.openrdf.model.BNode;
 import org.openrdf.model.Literal;
@@ -33,19 +54,11 @@ import org.openrdf.model.URI;
 import org.openrdf.model.Value;
 import org.openrdf.model.ValueFactory;
 import org.openrdf.model.impl.ContextStatementImpl;
-import org.openrdf.model.impl.StatementImpl;
 import org.openrdf.repository.RepositoryException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.xml.datatype.XMLGregorianCalendar;
-import java.sql.SQLException;
-import java.util.Date;
-import java.util.List;
-import java.util.Locale;
-import java.util.Random;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.locks.ReentrantLock;
+import com.google.common.collect.MapMaker;
 
 /**
  * Add file description here!
@@ -77,7 +90,7 @@ public class KiWiValueFactory implements ValueFactory {
     private KiWiStore store;
 
     private ReentrantLock nodeLock;
-    private ReentrantLock tripleLock;
+    //private ReentrantLock tripleLock;
 
     private ConcurrentMap<String,ReentrantLock> resourceLocks;
     private ConcurrentMap<Object,ReentrantLock> literalLocks;
@@ -87,7 +100,7 @@ public class KiWiValueFactory implements ValueFactory {
 
     public KiWiValueFactory(KiWiStore store, String defaultContext) {
         nodeLock = store.nodeLock;
-        tripleLock = store.tripleLock;
+        //tripleLock = store.tripleLock;
         resourceLocks = new MapMaker().weakKeys().weakValues().makeMap();
         literalLocks  = new MapMaker().weakKeys().weakValues().makeMap();
 
@@ -260,7 +273,6 @@ public class KiWiValueFactory implements ValueFactory {
      * @return a typed literal representation of the supplied object.
      * @since 2.7.0
      */
-    @Override
     public Literal createLiteral(Object object) {
         if(object instanceof XMLGregorianCalendar) {
             return createLiteral((XMLGregorianCalendar)object);
@@ -607,7 +619,7 @@ public class KiWiValueFactory implements ValueFactory {
                 KiWiResource    kcontext   = convert(context);
 
                 // test if the triple already exists in the database; if yes, return it
-                List<Statement> triples = connection.listTriples(ksubject,kpredicate,kobject,kcontext,true).asList();
+                List<Statement> triples = Iterations.asList(connection.listTriples(ksubject,kpredicate,kobject,kcontext,true));
                 if(triples.size() == 1) {
                     result = triples.get(0);
                 } else {


[4/9] git commit: updated javadoc

Posted by wi...@apache.org.
updated javadoc


Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/3e5720b1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/3e5720b1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/3e5720b1

Branch: refs/heads/develop
Commit: 3e5720b19ecf3e220f2d2e72cc97275d06f9be86
Parents: 0458350
Author: Sergio Fernández <wi...@apache.org>
Authored: Wed Apr 17 09:03:12 2013 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Wed Apr 17 09:03:12 2013 +0200

----------------------------------------------------------------------
 .../commons/sesame/rio/jsonld/JsonLdWriter.java    |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/3e5720b1/commons/sesame-tools-rio-jsonld/src/main/java/org/apache/marmotta/commons/sesame/rio/jsonld/JsonLdWriter.java
----------------------------------------------------------------------
diff --git a/commons/sesame-tools-rio-jsonld/src/main/java/org/apache/marmotta/commons/sesame/rio/jsonld/JsonLdWriter.java b/commons/sesame-tools-rio-jsonld/src/main/java/org/apache/marmotta/commons/sesame/rio/jsonld/JsonLdWriter.java
index 863887b..f6d13ad 100644
--- a/commons/sesame-tools-rio-jsonld/src/main/java/org/apache/marmotta/commons/sesame/rio/jsonld/JsonLdWriter.java
+++ b/commons/sesame-tools-rio-jsonld/src/main/java/org/apache/marmotta/commons/sesame/rio/jsonld/JsonLdWriter.java
@@ -33,9 +33,10 @@ import java.util.ArrayList;
 import java.util.Collection;
 
 /**
- * Add file description here!
- * <p/>
- * User: sschaffe
+ * JSON-LD RIO Writer
+ * 
+ * @author Sebastian Schaffert
+ * @author Sergio Fernández
  */
 public class JsonLdWriter implements RDFWriter {