Strabon
changeset 182:ea0f600da0a1
JTSWrapper.WKBWriter writes big endian
author | George Garbis <ggarbis@di.uoa.gr> |
---|---|
date | Wed May 23 12:03:34 2012 +0300 (2012-05-23) |
parents | 439c5e28e3bc |
children | 2192aa4a6418 |
files | evaluation/src/main/java/org/openrdf/query/algebra/evaluation/util/JTSWrapper.java generaldb/src/main/java/org/openrdf/sail/generaldb/schema/GeoValueTable.java runtime/src/test/java/eu/earthobservatory/runtime/generaldb/GeneralTests.java |
line diff
1.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/util/JTSWrapper.java Tue May 22 12:18:22 2012 +0300 1.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/util/JTSWrapper.java Wed May 23 12:03:34 2012 +0300 1.3 @@ -5,6 +5,7 @@ 1.4 1.5 import com.vividsolutions.jts.geom.Geometry; 1.6 import com.vividsolutions.jts.io.ParseException; 1.7 +import com.vividsolutions.jts.io.WKBConstants; 1.8 import com.vividsolutions.jts.io.WKBReader; 1.9 import com.vividsolutions.jts.io.WKBWriter; 1.10 import com.vividsolutions.jts.io.WKTReader; 1.11 @@ -32,7 +33,8 @@ 1.12 wktr = new WKTReader(); 1.13 wktw = new WKTWriter(); 1.14 wkbr = new WKBReader(); 1.15 - wkbw = new WKBWriter(); 1.16 +// wkbw = new WKBWriter(); // PostGIS 1.17 + wkbw = new WKBWriter(2, WKBConstants.wkbXDR); // MonetDB 1.18 } 1.19 1.20 public static synchronized JTSWrapper getInstance() { 1.21 @@ -42,7 +44,7 @@ 1.22 return instance; 1.23 } 1.24 1.25 - public synchronized Geometry WKTread(String wkt) throws ParseException { 1.26 + public synchronized Geometry WKTread(String wkt) throws ParseException { 1.27 return wktr.read(wkt); 1.28 } 1.29 1.30 @@ -55,7 +57,13 @@ 1.31 } 1.32 1.33 public synchronized byte[] WKBwrite(Geometry geom) { 1.34 - return wkbw.write(geom); 1.35 +// return wkbw.write(geom); // PostGIS 1.36 + // MonetDB 1.37 + byte[] temp = wkbw.write(geom); 1.38 + temp[0] = 1; 1.39 + return temp; 1.40 + // 1.41 + 1.42 } 1.43 1.44 }
2.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/schema/GeoValueTable.java Tue May 22 12:18:22 2012 +0300 2.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/schema/GeoValueTable.java Wed May 23 12:03:34 2012 +0300 2.3 @@ -2,6 +2,7 @@ 2.4 package org.openrdf.sail.generaldb.schema; 2.5 2.6 2.7 +import org.apache.commons.codec.binary.Hex; 2.8 import org.openrdf.sail.generaldb.GeneralDBSqlTable; 2.9 import org.openrdf.sail.rdbms.schema.RdbmsTable; 2.10 import java.sql.PreparedStatement; 2.11 @@ -279,6 +280,11 @@ 2.12 } 2.13 else 2.14 { 2.15 + /// 2.16 +// geom[0]=1; 2.17 +// String hexString = new String(Hex.encodeHex(geom)); 2.18 +// System.err.println(id+", "+hexString); 2.19 + /// 2.20 batch.setBytes(2,geom); 2.21 } 2.22 batch.setObject(3, srid); //adding original srid-constant
3.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/GeneralTests.java Tue May 22 12:18:22 2012 +0300 3.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/GeneralTests.java Wed May 23 12:03:34 2012 +0300 3.3 @@ -65,9 +65,9 @@ 3.4 "SELECT ?place (?placegeo AS ?tt1) (strdf:union(?placegeo,?placegeo) AS ?constr) "+ 3.5 "WHERE { "+ 3.6 "?place "+ 3.7 - "a ?type ; "+ 3.8 - "geo:geometry ?placegeo ; "+ 3.9 - "rdfs:label ?placename . "+ 3.10 + " a ?type ; "+ 3.11 + " geo:geometry ?placegeo ; "+ 3.12 + " rdfs:label ?placename . "+ 3.13 "FILTER(strdf:anyInteract(strdf:union(?placegeo,?placegeo),?placegeo)) "+ 3.14 "}"; 3.15 3.16 @@ -76,9 +76,9 @@ 3.17 "SELECT ?place (?placegeo AS ?constr) "+ 3.18 "WHERE { "+ 3.19 "?place "+ 3.20 - "a ?type ; "+ 3.21 - "geo:geometry ?placegeo ; "+ 3.22 - "rdfs:label ?placename . "+ 3.23 + " a ?type ; "+ 3.24 + " geo:geometry ?placegeo ; "+ 3.25 + " rdfs:label ?placename . "+ 3.26 "FILTER(strdf:anyInteract(strdf:union(?placegeo,?placegeo),?placegeo)) "+ 3.27 "}"; 3.28 3.29 @@ -87,9 +87,9 @@ 3.30 "SELECT ?place ?placegeo "+ 3.31 "WHERE { "+ 3.32 "?place "+ 3.33 - "a ?type ; "+ 3.34 - "geo:geometry ?placegeo ; "+ 3.35 - "rdfs:label ?placename . "+ 3.36 + " a ?type ; "+ 3.37 + " geo:geometry ?placegeo ; "+ 3.38 + " rdfs:label ?placename . "+ 3.39 "FILTER(strdf:anyInteract(strdf:union(?placegeo,?placegeo),?placegeo) " + 3.40 "&& strdf:anyInteract(strdf:union(?placegeo,?placegeo),?placegeo)) "+ 3.41 "}"; 3.42 @@ -99,9 +99,9 @@ 3.43 "SELECT ?place ?placegeo "+ 3.44 "WHERE { "+ 3.45 "?place "+ 3.46 - "a ?type ; "+ 3.47 - "geo:geometry ?placegeo ; "+ 3.48 - "rdfs:label ?placename . "+ 3.49 + " a ?type ; "+ 3.50 + " geo:geometry ?placegeo ; "+ 3.51 + " rdfs:label ?placename . "+ 3.52 "FILTER(strdf:anyInteract(strdf:union(?placegeo,?placegeo),?placegeo)). "+ 3.53 "FILTER(strdf:anyInteract(strdf:union(?placegeo,?placegeo),?placegeo)). "+ 3.54 "}"; 3.55 @@ -112,9 +112,9 @@ 3.56 "?place (?placegeo AS ?tt1) (strdf:union(?placegeo,?placegeo) AS ?constr2) "+ 3.57 "WHERE { "+ 3.58 "?place "+ 3.59 - "a ?type ; "+ 3.60 - "geo:geometry ?placegeo ; "+ 3.61 - "rdfs:label ?placename . "+ 3.62 + " a ?type ; "+ 3.63 + " geo:geometry ?placegeo ; "+ 3.64 + " rdfs:label ?placename . "+ 3.65 "FILTER(strdf:anyInteract(strdf:union(?placegeo,?placegeo),?placegeo)) "+ 3.66 "}"; 3.67 3.68 @@ -123,9 +123,9 @@ 3.69 "SELECT ?place (?placegeo AS ?tt1) (strdf:union(?placegeo,?placegeo) AS ?constr) "+ 3.70 "WHERE { "+ 3.71 "?place "+ 3.72 - " a ?type ; "+ 3.73 - " geo:geometry ?placegeo ; "+ 3.74 - " rdfs:label ?placename . "+ 3.75 + " a ?type ; "+ 3.76 + " geo:geometry ?placegeo ; "+ 3.77 + " rdfs:label ?placename . "+ 3.78 "} "; 3.79 3.80 String query8 = 3.81 @@ -133,9 +133,9 @@ 3.82 "SELECT ?place "+ 3.83 "WHERE { "+ 3.84 "?place "+ 3.85 - "a ?type ; "+ 3.86 - "geo:geometry ?placegeo ; "+ 3.87 - "rdfs:label ?placename . "+ 3.88 + " a ?type ; "+ 3.89 + " geo:geometry ?placegeo ; "+ 3.90 + " rdfs:label ?placename . "+ 3.91 "FILTER(strdf:anyInteract(?placegeo,?placegeo)) "+ 3.92 "}"; 3.93 3.94 @@ -144,9 +144,9 @@ 3.95 "SELECT ?place (?placegeo AS ?tt1) "+ 3.96 "WHERE { ?x lgdo:bufferExtent ?ext . "+ 3.97 "?place "+ 3.98 - "a ?type ; "+ 3.99 - "geo:geometry ?placegeo ; "+ 3.100 - "rdfs:label ?placename . "+ 3.101 + " a ?type ; "+ 3.102 + " geo:geometry ?placegeo ; "+ 3.103 + " rdfs:label ?placename . "+ 3.104 "FILTER(strdf:anyInteract(strdf:buffer(?placegeo,?ext),?placegeo)) "+ 3.105 "}"; 3.106 3.107 @@ -155,9 +155,9 @@ 3.108 "SELECT ?place (?placegeo AS ?tt1) "+ 3.109 "WHERE { ?x lgdo:bufferExtent ?ext . "+ 3.110 "?place "+ 3.111 - "a ?type ; "+ 3.112 - "geo:geometry ?placegeo ; "+ 3.113 - "rdfs:label ?placename . "+ 3.114 + " a ?type ; "+ 3.115 + " geo:geometry ?placegeo ; "+ 3.116 + " rdfs:label ?placename . "+ 3.117 "FILTER(strdf:anyInteract(strdf:buffer(?placegeo,2),?placegeo)) "+ 3.118 "}"; 3.119 3.120 @@ -166,9 +166,9 @@ 3.121 "SELECT ?place (?placegeo AS ?tt1) "+ 3.122 "WHERE { ?x lgdo:bufferExtent ?ext . "+ 3.123 "?place "+ 3.124 - "a ?type ; "+ 3.125 - "geo:geometry ?placegeo ; "+ 3.126 - "rdfs:label ?placename . "+ 3.127 + " a ?type ; "+ 3.128 + " geo:geometry ?placegeo ; "+ 3.129 + " rdfs:label ?placename . "+ 3.130 "FILTER(strdf:anyInteract(strdf:buffer(\"POINT(23.72873 37.97205)\"^^<http://strdf.di.uoa.gr/ontology#WKT>,0.0572),?placegeo)) "+ 3.131 "}"; 3.132 3.133 @@ -177,9 +177,9 @@ 3.134 "SELECT ?place (?placegeo AS ?tt1) (strdf:buffer(?placegeo,2) AS ?buf) "+ 3.135 "WHERE { ?x lgdo:bufferExtent ?ext . "+ 3.136 "?place "+ 3.137 - "a ?type ; "+ 3.138 - "geo:geometry ?placegeo ; "+ 3.139 - "rdfs:label ?placename . "+ 3.140 + " a ?type ; "+ 3.141 + " geo:geometry ?placegeo ; "+ 3.142 + " rdfs:label ?placename . "+ 3.143 "FILTER(strdf:anyInteract(strdf:buffer(?placegeo,2),?placegeo)) "+ 3.144 "}"; 3.145 3.146 @@ -189,9 +189,9 @@ 3.147 "SELECT ?place (?placegeo AS ?tt1) (strdf:buffer(?placegeo,?ext) AS ?buf) "+ 3.148 "WHERE { ?x lgdo:bufferExtent ?ext . "+ 3.149 "?place "+ 3.150 - "a ?type ; "+ 3.151 - "geo:geometry ?placegeo ; "+ 3.152 - "rdfs:label ?placename . "+ 3.153 + " a ?type ; "+ 3.154 + " geo:geometry ?placegeo ; "+ 3.155 + " rdfs:label ?placename . "+ 3.156 "FILTER(strdf:anyInteract(strdf:buffer(?placegeo,2),?placegeo)) "+ 3.157 "}"; 3.158 3.159 @@ -200,9 +200,9 @@ 3.160 "SELECT ?place (?placegeo AS ?tt1) (strdf:buffer(?placegeo,3) AS ?buf) "+ 3.161 "WHERE { ?x lgdo:bufferExtent ?ext . "+ 3.162 "?place "+ 3.163 - "a ?type ; "+ 3.164 - "geo:geometry ?placegeo ; "+ 3.165 - "rdfs:label ?placename . "+ 3.166 + " a ?type ; "+ 3.167 + " geo:geometry ?placegeo ; "+ 3.168 + " rdfs:label ?placename . "+ 3.169 "FILTER(strdf:anyInteract(strdf:buffer(?placegeo,?ext),?placegeo)) "+ 3.170 "}"; 3.171 3.172 @@ -210,11 +210,11 @@ 3.173 prefixes+ 3.174 "SELECT ?place (?placegeo AS ?tt1) (strdf:envelope(?placegeo) AS ?constr) (strdf:convexHull(?placegeo) AS ?constr2) "+ 3.175 "WHERE { "+ 3.176 - " ?place "+ 3.177 - " a ?type ; "+ 3.178 - " geo:geometry ?placegeo ; "+ 3.179 - " rdfs:label ?placename . "+ 3.180 - " FILTER(strdf:anyInteract(strdf:union(?placegeo,strdf:envelope(?placegeo)),?placegeo) && strdf:anyInteract(strdf:convexHull(?placegeo),?placegeo)) "+ 3.181 + "?place "+ 3.182 + " a ?type ; "+ 3.183 + " geo:geometry ?placegeo ; "+ 3.184 + " rdfs:label ?placename . "+ 3.185 + "FILTER(strdf:anyInteract(strdf:union(?placegeo,strdf:envelope(?placegeo)),?placegeo) && strdf:anyInteract(strdf:convexHull(?placegeo),?placegeo)) "+ 3.186 "}"; 3.187 3.188 String queryMetrics1 = 3.189 @@ -223,9 +223,9 @@ 3.190 "( strdf:envelope(?placegeo) AS ?mbb) "+ 3.191 "WHERE { ?x lgdo:bufferExtent ?ext . "+ 3.192 "?place "+ 3.193 - "rdfs:label ?placename ; "+ 3.194 - "geo:geometry ?placegeo ; "+ 3.195 - "a ?type. "+ 3.196 + " rdfs:label ?placename ; "+ 3.197 + " geo:geometry ?placegeo ; "+ 3.198 + " a ?type. "+ 3.199 "FILTER(2*strdf:distance(?placegeo,?placegeo) + strdf:area(?placegeo) - 3 + ?ext "+ 3.200 "< ?ext + 8 - strdf:distance(?placegeo,?placegeo)) "+ 3.201 "}"; 3.202 @@ -235,9 +235,9 @@ 3.203 "SELECT ?place ?placegeo ( 33*strdf:area(?placegeo) + 114 AS ?area) ( strdf:envelope(?placegeo) AS ?mbb) "+ 3.204 "WHERE { ?x lgdo:bufferExtent ?ext . "+ 3.205 "?place "+ 3.206 - "rdfs:label ?placename ; "+ 3.207 - "geo:geometry ?placegeo ; "+ 3.208 - "a ?type. "+ 3.209 + " rdfs:label ?placename ; "+ 3.210 + " geo:geometry ?placegeo ; "+ 3.211 + " a ?type. "+ 3.212 "FILTER(2*strdf:distance(?placegeo,?placegeo) < 8) "+ 3.213 "}"; 3.214 3.215 @@ -247,9 +247,9 @@ 3.216 "SELECT ?place ?placegeo ( 33*strdf:area(?placegeo) + 114 AS ?area) ( strdf:envelope(?placegeo) AS ?mbb) "+ 3.217 "WHERE { ?x lgdo:bufferExtent ?ext . "+ 3.218 "?place "+ 3.219 - "rdfs:label ?placename ; "+ 3.220 - "geo:geometry ?placegeo ; "+ 3.221 - "a ?type. "+ 3.222 + " rdfs:label ?placename ; "+ 3.223 + " geo:geometry ?placegeo ; "+ 3.224 + " a ?type. "+ 3.225 "FILTER(2*strdf:area(?placegeo) < 8) "+ 3.226 "}"; 3.227 3.228 @@ -258,9 +258,9 @@ 3.229 "SELECT ?place ?placegeo ( 33*strdf:area(?placegeo) + 114 AS ?area) ( strdf:envelope(?placegeo) AS ?mbb) "+ 3.230 "WHERE { ?x lgdo:bufferExtent ?ext . "+ 3.231 "?place "+ 3.232 - "rdfs:label ?placename ; "+ 3.233 - "geo:geometry ?placegeo ; "+ 3.234 - "a ?type. "+ 3.235 + " rdfs:label ?placename ; "+ 3.236 + " geo:geometry ?placegeo ; "+ 3.237 + " a ?type. "+ 3.238 "FILTER(2*strdf:distance(?placegeo,?placegeo) + strdf:area(?placegeo) - 3 + ?ext " + 3.239 "< ?ext + 8 - strdf:distance(?placegeo,?placegeo)) "+ 3.240 "}"; 3.241 @@ -270,9 +270,9 @@ 3.242 "SELECT ?place ?placegeo (strdf:dimension(?placegeo) + 2 AS ?dim) (strdf:srid(?placegeo) AS ?srid) "+ 3.243 "WHERE { "+ 3.244 "?place "+ 3.245 - "rdfs:label ?placename ; "+ 3.246 - "geo:geometry ?placegeo ; "+ 3.247 - "a ?type. "+ 3.248 + " rdfs:label ?placename ; "+ 3.249 + " geo:geometry ?placegeo ; "+ 3.250 + " a ?type. "+ 3.251 "FILTER(strdf:anyInteract(strdf:union(?placegeo,?placegeo),?placegeo) && strdf:isSimple(?placegeo) "+ 3.252 "&& strdf:dimension(?placegeo) - 1 < 3) "+ 3.253 "}"; 3.254 @@ -282,9 +282,9 @@ 3.255 "SELECT ?place ?placegeo (strdf:srid(?placegeo) AS ?srid) (strdf:dimension(?placegeo) + 2 AS ?dim) "+ 3.256 "WHERE { "+ 3.257 "?place "+ 3.258 - "rdfs:label ?placename ; "+ 3.259 - "geo:geometry ?placegeo ; "+ 3.260 - "a ?type. "+ 3.261 + " rdfs:label ?placename ; "+ 3.262 + " geo:geometry ?placegeo ; "+ 3.263 + " a ?type. "+ 3.264 "FILTER(strdf:anyInteract(strdf:union(?placegeo,?placegeo),?placegeo) && strdf:isSimple(?placegeo) "+ 3.265 "&& strdf:dimension(\"POINT(0 0)\") - 1 < 3) "+ 3.266 "}";