Strabon
changeset 349:370de8802da3
added stSPARQLTSV writer and factory that extends TSV SPARQLResultsWriter and Format respectively
author | Babis Nikolaou <charnik@di.uoa.gr> |
---|---|
date | Mon Jun 25 15:48:05 2012 +0300 (2012-06-25) |
parents | d437dd57982a |
children | 7316bec474c1 |
files | resultio/src/main/java/org/openrdf/query/resultio/stSPARQLQueryResultFormat.java resultio/src/main/java/org/openrdf/query/resultio/text/stSPARQLResultsTSVWriter.java resultio/src/main/java/org/openrdf/query/resultio/text/stSPARQLResultsTSVWriterFactory.java |
line diff
1.1 --- a/resultio/src/main/java/org/openrdf/query/resultio/stSPARQLQueryResultFormat.java Mon Jun 25 15:40:01 2012 +0300 1.2 +++ b/resultio/src/main/java/org/openrdf/query/resultio/stSPARQLQueryResultFormat.java Mon Jun 25 15:48:05 2012 +0300 1.3 @@ -46,6 +46,12 @@ 1.4 */ 1.5 public static final stSPARQLQueryResultFormat GEOJSON = new stSPARQLQueryResultFormat("GeoJSON", 1.6 Arrays.asList("application/json", "application/json"), Charset.forName("UTF-8"), Arrays.asList("json")); 1.7 + 1.8 + /** 1.9 + * Tab separated value format (extension of {@link TupleQueryResultFormat#TSV} format to include geometries) 1.10 + */ 1.11 + public static final stSPARQLQueryResultFormat TSV = new stSPARQLQueryResultFormat("TSV", 1.12 + Arrays.asList("text/tab-separated-values"), Charset.forName("UTF-8"), Arrays.asList("tsv")); 1.13 1.14 // registers stSPARQL/GeoSPARQL formats 1.15 static { 1.16 @@ -53,6 +59,7 @@ 1.17 register(KML); 1.18 register(KMZ); 1.19 register(GEOJSON); 1.20 + register(TSV); 1.21 } 1.22 1.23 public stSPARQLQueryResultFormat(String name, String mimeType, String fileExt) {
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/resultio/src/main/java/org/openrdf/query/resultio/text/stSPARQLResultsTSVWriter.java Mon Jun 25 15:48:05 2012 +0300 2.3 @@ -0,0 +1,17 @@ 2.4 +package org.openrdf.query.resultio.text; 2.5 + 2.6 +import java.io.OutputStream; 2.7 + 2.8 +import org.openrdf.query.resultio.text.tsv.SPARQLResultsTSVWriter; 2.9 + 2.10 +/** 2.11 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 2.12 + * 2.13 + */ 2.14 +public class stSPARQLResultsTSVWriter extends SPARQLResultsTSVWriter { 2.15 + 2.16 + public stSPARQLResultsTSVWriter(OutputStream out) { 2.17 + super(out); 2.18 + } 2.19 + 2.20 +}
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/resultio/src/main/java/org/openrdf/query/resultio/text/stSPARQLResultsTSVWriterFactory.java Mon Jun 25 15:48:05 2012 +0300 3.3 @@ -0,0 +1,26 @@ 3.4 +package org.openrdf.query.resultio.text; 3.5 + 3.6 +import java.io.OutputStream; 3.7 + 3.8 +import org.openrdf.query.resultio.TupleQueryResultFormat; 3.9 +import org.openrdf.query.resultio.TupleQueryResultWriter; 3.10 +import org.openrdf.query.resultio.stSPARQLQueryResultFormat; 3.11 +import org.openrdf.query.resultio.text.tsv.SPARQLResultsTSVWriterFactory; 3.12 + 3.13 +/** 3.14 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 3.15 + * 3.16 + */ 3.17 +public class stSPARQLResultsTSVWriterFactory extends SPARQLResultsTSVWriterFactory { 3.18 + 3.19 + @Override 3.20 + public TupleQueryResultFormat getTupleQueryResultFormat() { 3.21 + return stSPARQLQueryResultFormat.TSV; 3.22 + } 3.23 + 3.24 + @Override 3.25 + public TupleQueryResultWriter getWriter(OutputStream out) { 3.26 + return new stSPARQLResultsTSVWriter(out); 3.27 + } 3.28 + 3.29 +}