Strabon

changeset 77:3a650ebf4868

add cast in buildInsertGeometryValue for MonetDB
author George Garbis <ggarbis@di.uoa.gr>
date Thu Mar 22 16:26:36 2012 +0200 (2012-03-22)
parents e2a9aab812bf
children 83d84d87ab59
files generaldb/src/main/java/org/openrdf/sail/generaldb/schema/GeoValueTable.java monetdb/src/main/java/org/openrdf/sail/monetdb/MonetDBSqlTable.java postgis/src/main/java/org/openrdf/sail/postgis/PostGISSqlTable.java
line diff
     1.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/schema/GeoValueTable.java	Thu Mar 22 13:16:35 2012 +0100
     1.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/schema/GeoValueTable.java	Thu Mar 22 16:26:36 2012 +0200
     1.3 @@ -133,13 +133,9 @@
     1.4  	{
     1.5  		StringBuilder sb = new StringBuilder();
     1.6  		sb.append("INSERT INTO ").append(getInsertTable().getName());
     1.7 -		//sb.append(" (id, value, interval_start, interval_end, strdfgeo) VALUES (?, ?,?,?,?)");
     1.8 -		
     1.9 -		//Normal One sb.append(" (id, interval_start, interval_end, strdfgeo) VALUES (?,?,?,?)");
    1.10 -		//sb.append(" (id, interval_start, interval_end, strdfgeo) VALUES (?,?,?,ST_GeomFromWKB(?,4326))");
    1.11 -		//sb.append(" (id, strdfgeo) VALUES (?,ST_GeomFromWKB(?,32630))");
    1.12 -		Integer srid=  StrabonPolyhedron.defaultSRID;
    1.13 -		sb.append(" (id, strdfgeo,srid) VALUES (?,ST_Transform(ST_GeomFromWKB(?,?),").append(srid).append("),?)"); 
    1.14 +//		Integer srid=  StrabonPolyhedron.defaultSRID;
    1.15 +//		sb.append(" (id, strdfgeo,srid) VALUES (?,ST_Transform(ST_GeomFromWKB(?,?),").append(srid).append("),?)");
    1.16 +		sb.append(((GeneralDBSqlTable)temporary).buildInsertGeometryValue());
    1.17  		INSERT = sb.toString();
    1.18  		sb.delete(0, sb.length());
    1.19  		sb.append("DELETE FROM ").append(table.getName()).append("\n");
     2.1 --- a/monetdb/src/main/java/org/openrdf/sail/monetdb/MonetDBSqlTable.java	Thu Mar 22 13:16:35 2012 +0100
     2.2 +++ b/monetdb/src/main/java/org/openrdf/sail/monetdb/MonetDBSqlTable.java	Thu Mar 22 16:26:36 2012 +0200
     2.3 @@ -7,6 +7,7 @@
     2.4  
     2.5  import java.sql.SQLException;
     2.6  
     2.7 +import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron;
     2.8  import org.openrdf.sail.generaldb.GeneralDBSqlTable;
     2.9  
    2.10  /**
    2.11 @@ -46,8 +47,9 @@
    2.12  	}
    2.13  	
    2.14  	@Override
    2.15 -	public String buildInsertGeometryValue() { // FIXME for srid
    2.16 -		return " (id, strdfgeo) VALUES (CAST(? AS INTEGER),GeomFromWKB(?))";
    2.17 +	public String buildInsertGeometryValue() {
    2.18 +		Integer srid=  StrabonPolyhedron.defaultSRID;
    2.19 +		return " (id, strdfgeo,srid) VALUES (CAST(? AS INTEGER), Transform(GeomFromWKB(CAST(? AS BLOB),CAST(? AS INTEGER)),"+srid+"), CAST(? AS INTEGER))"; 
    2.20  	}
    2.21  	
    2.22  	@Override
     3.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/PostGISSqlTable.java	Thu Mar 22 13:16:35 2012 +0100
     3.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/PostGISSqlTable.java	Thu Mar 22 16:26:36 2012 +0200
     3.3 @@ -7,6 +7,7 @@
     3.4  
     3.5  import java.sql.SQLException;
     3.6  
     3.7 +import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron;
     3.8  import org.openrdf.sail.generaldb.GeneralDBSqlTable;
     3.9  
    3.10  /**
    3.11 @@ -45,7 +46,8 @@
    3.12  	
    3.13  	@Override
    3.14  	public String buildInsertGeometryValue() {
    3.15 -		return " (id, strdfgeo,srid) VALUES (?,ST_Transform(ST_GeomFromWKB(?,?),4326),?)";
    3.16 +		Integer srid=  StrabonPolyhedron.defaultSRID;
    3.17 +		return " (id, strdfgeo,srid) VALUES (?,ST_Transform(ST_GeomFromWKB(?,?),"+srid+"),?)";
    3.18  	}
    3.19  	
    3.20  	@Override