Strabon
changeset 341:b695c2b754ab
added stSPARQLQueryResultFormat in the style of Sesame. These formats (KML, KMZ, and GeoJSON) are going to be used in StrabonEndpoint. For the time being, formats mentioned in Format class are kept in Strabon.
author | Babis Nikolaou <charnik@di.uoa.gr> |
---|---|
date | Mon Jun 25 13:21:30 2012 +0300 (2012-06-25) |
parents | d0573a708c72 |
children | 7837e4b7fd73 |
files | resultio/src/main/java/org/openrdf/query/resultio/stSPARQLQueryResultFormat.java |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/resultio/src/main/java/org/openrdf/query/resultio/stSPARQLQueryResultFormat.java Mon Jun 25 13:21:30 2012 +0300 1.3 @@ -0,0 +1,62 @@ 1.4 +package org.openrdf.query.resultio; 1.5 + 1.6 +import java.nio.charset.Charset; 1.7 +import java.util.Arrays; 1.8 +import java.util.Collection; 1.9 + 1.10 +/** 1.11 + * Represents the concept of an tuple query result serialization format for 1.12 + * stSPARQL/GeoSPARQL. Tuple query result formats are identified by a 1.13 + * {@link #getName() name} and can have one or more associated MIME types, 1.14 + * zero or more associated file extensions and can specify a (default) 1.15 + * character encoding. 1.16 + * 1.17 + * In contrast to formats mentioned in class {@link #TupleQueryResultFormat}, 1.18 + * stSPARQL/GeoSPARQL formats do not adhere to any specification for SPARQL. 1.19 + * For example, the projected variables in a stSPARQL/GeoSPARQL query are 1.20 + * not included in the beginning of these formats. Instead, they are provided 1.21 + * as an additional description for a feature (e.g., a tuple query result with 1.22 + * a projected variable corresponding to a geometry). 1.23 + * 1.24 + * @author Charlampos Nikolaou <charnik@di.uoa.gr> 1.25 + * 1.26 + */ 1.27 +public class stSPARQLQueryResultFormat extends TupleQueryResultFormat { 1.28 + 1.29 + /** 1.30 + * KML format (see http://www.opengeospatial.org/standards/kml/) 1.31 + */ 1.32 + public static final stSPARQLQueryResultFormat KML = new stSPARQLQueryResultFormat("KML", 1.33 + Arrays.asList("application/vnd.google-earth.kml+xml", "application/kml"), Charset.forName("UTF-8"), Arrays.asList("kml")); 1.34 + 1.35 + /** 1.36 + * KMZ format (a zipped KML content) 1.37 + */ 1.38 + public static final stSPARQLQueryResultFormat KMZ = new stSPARQLQueryResultFormat("KMZ", 1.39 + Arrays.asList("application/vnd.google-earth.kmz", "application/kmz"), Charset.forName("UTF-8"), Arrays.asList("kmz")); 1.40 + 1.41 + /** 1.42 + * GeoJSON format (see http://www.geojson.org/geojson-spec.html) 1.43 + */ 1.44 + public static final stSPARQLQueryResultFormat GEOJSON = new stSPARQLQueryResultFormat("GeoJSON", 1.45 + Arrays.asList("application/json", "application/json"), Charset.forName("UTF-8"), Arrays.asList("json")); 1.46 + 1.47 + // registers stSPARQL formats 1.48 + static { 1.49 + register(KML); 1.50 + register(KMZ); 1.51 + register(GEOJSON); 1.52 + } 1.53 + 1.54 + public stSPARQLQueryResultFormat(String name, String mimeType, String fileExt) { 1.55 + super(name, mimeType, fileExt); 1.56 + } 1.57 + 1.58 + public stSPARQLQueryResultFormat(String name, String mimeType, Charset charset, String fileExt) { 1.59 + super(name, mimeType, charset, fileExt); 1.60 + } 1.61 + 1.62 + public stSPARQLQueryResultFormat(String name, Collection<String> mimeTypes, Charset charset, Collection<String> fileExtensions) { 1.63 + super(name, mimeTypes, charset, fileExtensions); 1.64 + } 1.65 +}