Strabon

changeset 388:390625cc49c3

added support for GML in store
author Babis Nikolaou <charnik@di.uoa.gr>
date Wed Jun 27 20:09:43 2012 +0300 (2012-06-27)
parents 74c6142de217
children 578b40921312
files evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPolyhedron.java generaldb/src/main/java/org/openrdf/sail/generaldb/managers/LiteralManager.java generaldb/src/main/java/org/openrdf/sail/generaldb/schema/LiteralTable.java
line diff
     1.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPolyhedron.java	Wed Jun 27 19:31:08 2012 +0300
     1.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPolyhedron.java	Wed Jun 27 20:09:43 2012 +0300
     1.3 @@ -365,6 +365,8 @@
     1.4  	 * Return the geometry of {@link StrabonPolyhedron} in Well-Known
     1.5  	 * Binary (WKB).
     1.6  	 * 
     1.7 +	 * This method is equivalent to {@link #toByteArray()}.
     1.8 +	 * 
     1.9  	 * @return
    1.10  	 */
    1.11  	public byte[] toWKB() {
    1.12 @@ -383,6 +385,8 @@
    1.13  	/**
    1.14  	 * Return the geometry of {@link StrabonPolyhedron} as a byte array.
    1.15  	 * 
    1.16 +	 * This method is equivalent to {@link #toWKB()}.
    1.17 +	 * 
    1.18  	 * @return
    1.19  	 */
    1.20  	public byte[] toByteArray() {
     2.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/managers/LiteralManager.java	Wed Jun 27 19:31:08 2012 +0300
     2.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/managers/LiteralManager.java	Wed Jun 27 20:09:43 2012 +0300
     2.3 @@ -124,7 +124,7 @@
     2.4  					}
     2.5  					else if(XMLGSDatatypeUtil.isGMLDatatype(datatype)) //GML case
     2.6  					{
     2.7 -						table.insertWKT(id, label, dt, null, null);
     2.8 +						table.insertGML(id, label, dt, null, null);
     2.9  					} 
    2.10  					else if(XMLGSDatatypeUtil.isSemiLinearPointSetDatatype(datatype)) // SemiLinearPointSet case
    2.11  					{
     3.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/schema/LiteralTable.java	Wed Jun 27 19:31:08 2012 +0300
     3.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/schema/LiteralTable.java	Wed Jun 27 20:09:43 2012 +0300
     3.3 @@ -197,13 +197,11 @@
     3.4  		
     3.5  		try {
     3.6  			
     3.7 -			/***XXX new stuff dictated by kkyzir's StrabonPolyhedron***/
     3.8 -			
     3.9 -			StrabonPolyhedron polyhedron = new StrabonPolyhedron(label,2);//current algorithm selected: approx convex partition
    3.10 -			if(polyhedron.getGeometry().getSRID()>0)
    3.11 +			StrabonPolyhedron polyhedron = new StrabonPolyhedron(label);//current algorithm selected: approx convex partition
    3.12 +			if(polyhedron.getGeometry().getSRID() > 0)
    3.13  			{
    3.14  				srid = polyhedron.getGeometry().getSRID();
    3.15 -				System.out.println("SRID="+srid);
    3.16 +				//System.out.println("SRID="+srid);
    3.17  			}
    3.18  			geomWKB = polyhedron.toWKB();
    3.19  	
    3.20 @@ -212,12 +210,26 @@
    3.21  		}
    3.22  	     srid= findSRID(label);
    3.23  		geoSpatialTable.insert(id,srid,/* start,end,*/ geomWKB);
    3.24 -		
    3.25 -		//XXX not needed currently because this method is called AFTER an insertDatatype()
    3.26 -		//		insertSimple(id, label);
    3.27 -		//		datatypes.insert(id, datatype);
    3.28  	}
    3.29  	
    3.30 +	/**
    3.31 +	 * Inserts a the given geometry represented in GML into the geo_values table.
    3.32 +	 * 
    3.33 +	 * @param id
    3.34 +	 * @param label
    3.35 +	 * @param datatype
    3.36 +	 * @param start
    3.37 +	 * @param end
    3.38 +	 * @throws SQLException
    3.39 +	 * @throws NullPointerException
    3.40 +	 * @throws InterruptedException
    3.41 +	 * @throws IllegalArgumentException
    3.42 +	 */
    3.43 +	public void insertGML(Number id, String gml, String datatype, Timestamp start, Timestamp end) throws SQLException, NullPointerException,InterruptedException,IllegalArgumentException {
    3.44 +		StrabonPolyhedron geomValue = new StrabonPolyhedron(gml); 
    3.45 +			
    3.46 +		geoSpatialTable.insert(id, geomValue.getGeometry().getSRID(),/* start,end,*/ geomValue.toByteArray());
    3.47 +	}
    3.48  	
    3.49  	
    3.50  	/********************************************************************/