Strabon

changeset 1431:d018c67d1125

in the case of select constructs there is no need to push the resulting geometry
in the database because there is quite small possibility to meet it again.
author Stella Giannakopoulou <sgian@di.uoa.gr>
date Fri Sep 26 17:19:00 2014 +0300 (2014-09-26)
parents b3b5eb3ca804
children dabf45d0f369
files generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBValueFactory.java generaldb/src/main/java/org/openrdf/sail/generaldb/model/GeneralDBPolyhedron.java monetdb/src/main/java/org/openrdf/sail/monetdb/iteration/MonetDBBindingIteration.java postgis/src/main/java/org/openrdf/sail/postgis/iteration/PostGISBindingIteration.java
line diff
     1.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBValueFactory.java	Fri Sep 26 16:59:18 2014 +0300
     1.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBValueFactory.java	Fri Sep 26 17:19:00 2014 +0300
     1.3 @@ -386,4 +386,31 @@
     1.4  		}
     1.5  		return null;
     1.6  	}
     1.7 +	
     1.8 +	/**
     1.9 +	 * This function is called only for SELECT constructs, thus we do not create an id
    1.10 +	 * for the resulting geometry because we don't push it in the database since
    1.11 +	 * there is small possibility to meet this geometry in the future.
    1.12 +	 * {@link PostGISBindingIteration.createWellKnownTextGeoValueForSelectConstructs},
    1.13 +	 * {@link PostGISBindingIteration.createWellKnownTextLiteralGeoValueForSelectConstructs},
    1.14 +	 * {@link and MonetDBBindingIteration.createWellKnownTextGeoValueForSelectConstructs},
    1.15 +	 * {@link and MonetDBBindingIteration.createWellKnownTextLiteralGeoValueForSelectConstructs}
    1.16 +	 * @param datatype
    1.17 +	 * @param wkb
    1.18 +	 * @param srid
    1.19 +	 * @return
    1.20 +	 */
    1.21 +	public GeneralDBPolyhedron getRdbmsPolyhedron(String datatype, byte[] wkb, int srid)  {
    1.22 +
    1.23 +		try {
    1.24 +			if(wkb != null) {
    1.25 +				return new GeneralDBPolyhedron(vf.createURI(datatype), wkb, srid);
    1.26 +			}
    1.27 +		} catch (IOException e) {
    1.28 +			e.printStackTrace();
    1.29 +		} catch (ClassNotFoundException e) {
    1.30 +			e.printStackTrace();
    1.31 +		}
    1.32 +		return null;
    1.33 +	}
    1.34  }
     2.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/model/GeneralDBPolyhedron.java	Fri Sep 26 16:59:18 2014 +0300
     2.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/model/GeneralDBPolyhedron.java	Fri Sep 26 17:19:00 2014 +0300
     2.3 @@ -58,6 +58,34 @@
     2.4  		this.datatype = datatype;
     2.5  	}
     2.6  
     2.7 +	/**
     2.8 +	 * this method is called from the method:
     2.9 +	 * {@link GeneralDBValueFactory.getRdbmsPolyhedron}
    2.10 +	 * for SELECT constructs 
    2.11 +	 * 
    2.12 +	 * @param datatype
    2.13 +	 * @param polyhedron
    2.14 +	 * @param srid
    2.15 +	 */
    2.16 +	public GeneralDBPolyhedron(URI datatype, byte[] polyhedron, int srid) throws IOException, ClassNotFoundException {
    2.17 +		//set null id and version in the RdbmsSValue
    2.18 +		super(null, null);
    2.19 +		
    2.20 +		try {
    2.21 +			this.polyhedron = new StrabonPolyhedron(polyhedron, srid, GeometryDatatype.fromString(datatype.stringValue()));
    2.22 +			
    2.23 +		} catch (ParseException e) {
    2.24 +
    2.25 +			e.printStackTrace();
    2.26 +		} catch (Exception e) {
    2.27 +
    2.28 +			e.printStackTrace();
    2.29 +		}
    2.30 +		
    2.31 +		setPolyhedronStringRep(this.polyhedron);
    2.32 +		this.datatype = datatype;
    2.33 +	}
    2.34 +
    2.35  	public String getPolyhedronStringRep() {
    2.36  		return polyhedronStringRep;
    2.37  	}
     3.1 --- a/monetdb/src/main/java/org/openrdf/sail/monetdb/iteration/MonetDBBindingIteration.java	Fri Sep 26 16:59:18 2014 +0300
     3.2 +++ b/monetdb/src/main/java/org/openrdf/sail/monetdb/iteration/MonetDBBindingIteration.java	Fri Sep 26 17:19:00 2014 +0300
     3.3 @@ -53,7 +53,7 @@
     3.4  		Blob labelBlob = rs.getBlob(index + 1); 
     3.5  		byte[] label = labelBlob.getBytes((long)1, (int)labelBlob.length());
     3.6  		int srid = rs.getInt(index + 2);
     3.7 -		return vf.getRdbmsPolyhedron(114, GeoConstants.WKT, label, srid);
     3.8 +		return vf.getRdbmsPolyhedron(GeoConstants.WKT, label, srid);
     3.9  	}
    3.10  	
    3.11  	@Override
    3.12 @@ -63,6 +63,6 @@
    3.13  		Blob labelBlob = rs.getBlob(index + 1); 
    3.14  		byte[] label = labelBlob.getBytes((long)1, (int)labelBlob.length());
    3.15  		int srid = rs.getInt(index + 2);
    3.16 -		return vf.getRdbmsPolyhedron(114, GeoConstants.WKTLITERAL, label, srid);
    3.17 +		return vf.getRdbmsPolyhedron(GeoConstants.WKTLITERAL, label, srid);
    3.18  	}
    3.19  }
    3.20 \ No newline at end of file
     4.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/iteration/PostGISBindingIteration.java	Fri Sep 26 16:59:18 2014 +0300
     4.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/iteration/PostGISBindingIteration.java	Fri Sep 26 17:19:00 2014 +0300
     4.3 @@ -51,7 +51,8 @@
     4.4  		//Case of spatial constructs
     4.5  		byte[] label = rs.getBytes(index + 1);
     4.6  		int srid = rs.getInt(index + 2);
     4.7 -		return vf.getRdbmsPolyhedron(114, GeoConstants.WKT, label, srid);
     4.8 +		
     4.9 +		return vf.getRdbmsPolyhedron(GeoConstants.WKT, label, srid);
    4.10  	}
    4.11  	
    4.12  	@Override
    4.13 @@ -60,6 +61,6 @@
    4.14  		//Case of spatial constructs
    4.15  		byte[] label = rs.getBytes(index + 1);
    4.16  		int srid = rs.getInt(index + 2);
    4.17 -		return vf.getRdbmsPolyhedron(114, GeoConstants.WKTLITERAL, label, srid);
    4.18 +		return vf.getRdbmsPolyhedron(GeoConstants.WKTLITERAL, label, srid);
    4.19  	}
    4.20  }
    4.21 \ No newline at end of file