Strabon

changeset 383:f4aff2df43b3

some cleaning and commmenting
author Babis Nikolaou <charnik@di.uoa.gr>
date Wed Jun 27 16:51:59 2012 +0300 (2012-06-27)
parents fec504cb8143
children b38c9533735c
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/model/XMLGSDatatypeUtil.java
line diff
     1.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPolyhedron.java	Wed Jun 27 15:55:20 2012 +0300
     1.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPolyhedron.java	Wed Jun 27 16:51:59 2012 +0300
     1.3 @@ -29,6 +29,28 @@
     1.4  import com.vividsolutions.jts.io.ParseException;
     1.5  
     1.6  /**
     1.7 + * A {@link StrabonPolyhedron} is a @{link Value} that is used to represent geometries.
     1.8 + * Therefore, a {@link StrabonPolyhedron} wraps around the construct of an RDF @{link Value}
     1.9 + * the notion of geometry. This geometry can be expressed in different kinds of
    1.10 + * representations, such as linear constraints over the reals with addition
    1.11 + * (Semi-linear point sets), Well-Known Text (WKT), or Geography Markup Language (GML).
    1.12 + * 
    1.13 + * The former kind of representation, i.e., Semi-linear point sets, was the first
    1.14 + * representation to be supported by StrabonPolyhedron and now has been deprecated and
    1.15 + * not supported any more. It can be enabled by setting the value for variable
    1.16 + * {@link #EnableConstraintRepresentation} to <tt>true</tt>. However, this is hardly 
    1.17 + * suggested and it is discouraged. 
    1.18 + * 
    1.19 + * The other two kinds of representation is WKT and GML which are representations
    1.20 + * standardized by the Open Geospatial Consortium (OGC). Both representations can be
    1.21 + * used to represent a geometry and they are enabled by default.
    1.22 + * 
    1.23 + * {@link StrabonPolyhedron} does not store a specific representation for a geometry. In
    1.24 + * contrast, it stores the plain geometry as a byte array using a {@link Geometry} object.
    1.25 + * However, {@link StrabonPolyhedron} offers constructors and methods for getting a
    1.26 + * {@link StrabonPolyhedron} instance through any kind of representation and of course
    1.27 + * getting a {@link StrabonPolyhedron} instance in a specific representation.
    1.28 + * 
    1.29   * @author Manos Karpathiotakis <mk@di.uoa.gr>
    1.30   * @author Kostis Kyzirakos <kk@di.uoa.gr>
    1.31   *
    1.32 @@ -45,11 +67,33 @@
    1.33  
    1.34  	public static final boolean EnableConstraintRepresentation = false;
    1.35  
    1.36 -	public static final String stRDF			= "http://strdf.di.uoa.gr/ontology#";
    1.37 -	public static final String stRDFSemiLinearPointset="http://strdf.di.uoa.gr/ontology#SemiLinearPointSet";
    1.38 -	public static final String WKT 				= stRDF + "WKT";
    1.39 -	public static final String GML				="http://www.opengis.net/def/geometryType/OGC-GML/3.2/";
    1.40 -	public static final String geof				= "http://www.opengis.net/def/queryLanguage/OGC-GeoSPARQL/1.0/function/";
    1.41 +	/**
    1.42 +	 * The namespace for stRDF data model
    1.43 +	 */
    1.44 +	public static final String stRDF					= "http://strdf.di.uoa.gr/ontology#";
    1.45 +	
    1.46 +	/**
    1.47 +	 * The URI for the datatype SemiLinearPointSet
    1.48 +	 * (linear constraint-based representation of geometries)
    1.49 +	 */
    1.50 +	public static final String stRDFSemiLinearPointset	= stRDF + "SemiLinearPointSet";
    1.51 +	
    1.52 +	/**
    1.53 +	 * The URI for the datatype Well-Known Text (WKT)
    1.54 +	 */
    1.55 +	public static final String WKT 						= stRDF + "WKT";
    1.56 +	
    1.57 +	/**
    1.58 +	 * The URI for the datatype Geography Markup Langague (GML)
    1.59 +	 */
    1.60 +	public static final String GML						= stRDF + "GML";
    1.61 +	
    1.62 +	//private static final String GML					= "http://www.opengis.net/def/geometryType/OGC-GML/3.2/";
    1.63 +	
    1.64 +	/**
    1.65 +	 * The namespace for geometry functions declared by GeoSPARQL
    1.66 +	 */
    1.67 +	public static final String geof						= "http://www.opengis.net/def/queryLanguage/OGC-GeoSPARQL/1.0/function/";
    1.68  	
    1.69  	/* 						Extended functions 							*/
    1.70  	
    1.71 @@ -158,6 +202,90 @@
    1.72  		this.geometry = null;
    1.73  
    1.74  	}
    1.75 +	
    1.76 +	public StrabonPolyhedron(Polygon polygon) throws Exception {
    1.77 +		this.geometry = new StrabonPolyhedron(polygon, 1).geometry;
    1.78 +	}
    1.79 +
    1.80 +	public StrabonPolyhedron(String geometry) throws Exception {
    1.81 +		int geomSRID = 4326;
    1.82 +		if(geometry.contains(";"))
    1.83 +		{
    1.84 +			int whereToCut = geometry.lastIndexOf('/');
    1.85 +			geomSRID = Integer.parseInt(geometry.substring(whereToCut+1));
    1.86 +			whereToCut = geometry.indexOf(';');
    1.87 +			geometry.substring(0,whereToCut);
    1.88 +		}
    1.89 +		if (geometry.startsWith("POINT") || 
    1.90 +				geometry.startsWith("LINESTRING") || 
    1.91 +				geometry.startsWith("POLYGON") || 
    1.92 +				geometry.startsWith("MULTIPOINT") || 
    1.93 +				geometry.startsWith("MULTILINESTRING") || 
    1.94 +				geometry.startsWith("MULTIPOLYGON") || 
    1.95 +				geometry.startsWith("GEOMETRYCOLLECTION")) {
    1.96 +			Geometry geo = jts.WKTread(geometry);
    1.97 +			this.geometry = new StrabonPolyhedron(geo).geometry;
    1.98 +			//Default 
    1.99 +			this.geometry.setSRID(geomSRID);
   1.100 +		} else {
   1.101 +		
   1.102 +			if(geometry.contains("gml"))
   1.103 +			{
   1.104 +				Geometry geo = GMLReader(geometry);
   1.105 +				this.geometry = new StrabonPolyhedron(geo).geometry;
   1.106 +			}
   1.107 +			
   1.108 +			//Polyhedron polyhedron = new Polyhedron(geometry);
   1.109 +			//String polyhedronWKT = polyhedron.toWKT();
   1.110 +			//Geometry geo = jts.WKTread(polyhedronWKT);
   1.111 +			//
   1.112 +			//if (!EnableConstraintRepresentation) {
   1.113 +			//	this.geometry = geo.union(geo);
   1.114 +			//}
   1.115 +		}
   1.116 +	}
   1.117 +
   1.118 +	public StrabonPolyhedron(String WKT, int algorithm) throws Exception {
   1.119 +		if(WKT.contains("gml"))
   1.120 +		{
   1.121 +			Geometry geo = GMLReader(WKT);
   1.122 +			this.geometry = new StrabonPolyhedron(geo).geometry;
   1.123 +		}
   1.124 +		else
   1.125 +		{
   1.126 +			//System.out.println("	new StrabonPolyhedron: before WKTReader");
   1.127 +			Geometry geo = jts.WKTread(WKT);
   1.128 +			//System.out.println("	new StrabonPolyhedron: after WKTReader");
   1.129 +			this.geometry = new StrabonPolyhedron(geo, algorithm).geometry;
   1.130 +		}
   1.131 +	
   1.132 +	}
   1.133 +
   1.134 +	public StrabonPolyhedron(String WKT, int algorithm, int maxPoints) throws Exception {
   1.135 +
   1.136 +		if(WKT.contains("gml"))
   1.137 +		{
   1.138 +			System.err.println("**************** THIS IS NOT A GOOD PLACE/WARY FOR THIS CONVERSION /////////");
   1.139 +			Geometry geo = GMLReader(WKT);
   1.140 +			this.geometry = new StrabonPolyhedron(geo).geometry;
   1.141 +		}
   1.142 +		else
   1.143 +		{
   1.144 +
   1.145 +			Geometry geo = jts.WKTread(WKT);
   1.146 +			this.geometry = new StrabonPolyhedron(geo, algorithm).geometry;	
   1.147 +		}
   1.148 +	}
   1.149 +
   1.150 +	public StrabonPolyhedron(byte[] byteArray) throws ParseException {
   1.151 +		this.geometry = jts.WKBread(byteArray);
   1.152 +	}
   1.153 +
   1.154 +	public StrabonPolyhedron(byte[] byteArray, int srid) throws ParseException {
   1.155 +
   1.156 +		this.geometry = jts.WKBread(byteArray);
   1.157 +		this.geometry.setSRID(srid);
   1.158 +	}
   1.159  
   1.160  	public void setGeometry(Geometry geometry) {
   1.161  		this.geometry = geometry;
   1.162 @@ -596,95 +724,7 @@
   1.163  		this.geometry = new MultiPolygon(collection, new GeometryFactory());
   1.164  		this.geometry.normalize();
   1.165  	}
   1.166 -
   1.167 -	public StrabonPolyhedron(Polygon polygon) throws Exception {
   1.168 -		this.geometry = new StrabonPolyhedron(polygon, 1).geometry;
   1.169 -	}
   1.170 -
   1.171 -	public StrabonPolyhedron(String geometry) throws Exception {
   1.172 -		int geomSRID = 4326;
   1.173 -		if(geometry.contains(";"))
   1.174 -		{
   1.175 -			int whereToCut = geometry.lastIndexOf('/');
   1.176 -			geomSRID = Integer.parseInt(geometry.substring(whereToCut+1));
   1.177 -			whereToCut = geometry.indexOf(';');
   1.178 -			geometry.substring(0,whereToCut);
   1.179 -		}
   1.180 -		if (geometry.startsWith("POINT") || 
   1.181 -				geometry.startsWith("LINESTRING") || 
   1.182 -				geometry.startsWith("POLYGON") || 
   1.183 -				geometry.startsWith("MULTIPOINT") || 
   1.184 -				geometry.startsWith("MULTILINESTRING") || 
   1.185 -				geometry.startsWith("MULTIPOLYGON") || 
   1.186 -				geometry.startsWith("GEOMETRYCOLLECTION")) {
   1.187 -			Geometry geo = jts.WKTread(geometry);
   1.188 -			this.geometry = new StrabonPolyhedron(geo).geometry;
   1.189 -			//Default 
   1.190 -			this.geometry.setSRID(geomSRID);
   1.191 -		} else {
   1.192 -		
   1.193 -			if(geometry.contains("gml"))
   1.194 -			{
   1.195 -				Geometry geo = GMLReader(geometry);
   1.196 -				this.geometry = new StrabonPolyhedron(geo).geometry;
   1.197 -			}
   1.198 -			
   1.199 -			//Polyhedron polyhedron = new Polyhedron(geometry);
   1.200 -			//String polyhedronWKT = polyhedron.toWKT();
   1.201 -			//Geometry geo = jts.WKTread(polyhedronWKT);
   1.202 -			//
   1.203 -			//if (!EnableConstraintRepresentation) {
   1.204 -			//	this.geometry = geo.union(geo);
   1.205 -			//}
   1.206 -		}
   1.207 -	}
   1.208 -
   1.209 -	public StrabonPolyhedron(String WKT, int algorithm) throws Exception {
   1.210 -		if(WKT.contains("gml"))
   1.211 -		{
   1.212 -			Geometry geo = GMLReader(WKT);
   1.213 -			this.geometry = new StrabonPolyhedron(geo).geometry;
   1.214 -		}
   1.215 -		else
   1.216 -		{
   1.217 -			//System.out.println("	new StrabonPolyhedron: before WKTReader");
   1.218 -			Geometry geo = jts.WKTread(WKT);
   1.219 -			//System.out.println("	new StrabonPolyhedron: after WKTReader");
   1.220 -			this.geometry = new StrabonPolyhedron(geo, algorithm).geometry;
   1.221 -		}
   1.222  	
   1.223 -	}
   1.224 -
   1.225 -	public StrabonPolyhedron(String WKT, int algorithm, int maxPoints) throws Exception {
   1.226 -
   1.227 -		if(WKT.contains("gml"))
   1.228 -		{
   1.229 -			//GMLReader gmlreader= new GMLReader();
   1.230 -			//GeometryFactory gf = new GeometryFactory();
   1.231 -			//Geometry geo = gmlreader.read(WKT,gf);
   1.232 -			Geometry geo = GMLReader(WKT);
   1.233 -			this.geometry = new StrabonPolyhedron(geo).geometry;
   1.234 -		}
   1.235 -		else
   1.236 -		{
   1.237 -
   1.238 -			Geometry geo = jts.WKTread(WKT);
   1.239 -			this.geometry = new StrabonPolyhedron(geo, algorithm).geometry;	
   1.240 -		}
   1.241 -	}
   1.242 -
   1.243 -	public StrabonPolyhedron(byte[] byteArray) throws ParseException {
   1.244 -
   1.245 -		this.geometry = jts.WKBread(byteArray);
   1.246 -		//		System.out.println(geometry.toString()+" "+geometry.getSRID());
   1.247 -	}
   1.248 -
   1.249 -	public StrabonPolyhedron(byte[] byteArray, int srid) throws ParseException {
   1.250 -
   1.251 -		this.geometry = jts.WKBread(byteArray);
   1.252 -		this.geometry.setSRID(srid);
   1.253 -	}
   1.254 -
   1.255  	public String toConstraints() //throws ConversionException 
   1.256  	{
   1.257  		if (this.geometry.isEmpty())
   1.258 @@ -879,19 +919,16 @@
   1.259  
   1.260  	public StrabonPolyhedron getBuffer(double distance) throws Exception {
   1.261  		Geometry geo = this.geometry.buffer(distance);
   1.262 -		System.out.println("TEMPORARY ----> BUFFER EXECUTED!!");
   1.263  		return new StrabonPolyhedron(geo);
   1.264  	}
   1.265  
   1.266  	public StrabonPolyhedron getBoundary() throws Exception {
   1.267  		Geometry geo = this.geometry.getBoundary();
   1.268 -		System.out.println("TEMPORARY ----> BOUNDARY EXECUTED!!");
   1.269  		return new StrabonPolyhedron(geo);
   1.270  	}
   1.271  
   1.272  	public StrabonPolyhedron getEnvelope() throws Exception {
   1.273  		Geometry geo = this.geometry.getEnvelope();
   1.274 -		System.out.println("TEMPORARY ----> BB EXECUTED!!");
   1.275  		return new StrabonPolyhedron(geo);
   1.276  	}
   1.277  
   1.278 @@ -919,73 +956,6 @@
   1.279  											"Unknown";
   1.280  	}
   1.281  
   1.282 -	public static void main(String[] args) {		
   1.283 -		double start, stop;
   1.284 -		double construct = 0;
   1.285 -		double constructWKT = 0;
   1.286 -		double tostring = 0;
   1.287 -		double toconstraints = 0;
   1.288 -
   1.289 -		for (int i = 0; i < 100; i++) {
   1.290 -			try {			
   1.291 -				String WKT = "POLYGON(("
   1.292 -						+ "342164.38954080583 5536425.686612717 , "
   1.293 -						+ "341626.21626698505 5536449.481769281 , "
   1.294 -						+ "341533.2278808594  5536525.216353727 , "
   1.295 -						+ "341233.98619135865 5536475.226529011 , "
   1.296 -						+ "341127.21075357014 5536983.653040268 , "
   1.297 -						+ "341215.02899532224 5537144.780243294 , "
   1.298 -						+ "340955.95747845445 5537799.537709246 , "
   1.299 -						+ "343211.19068847306 5537879.8934287615, "
   1.300 -						+ "343442.00065602345 5537324.533655008 , "
   1.301 -						+ "343314.06638177147 5537172.864526819 , "
   1.302 -						+ "343297.4180221379  5536922.705445975 , "
   1.303 -						+ "342969.57149877446 5536768.366861146 , "
   1.304 -						+ "342464.2661603174  5536951.549574836 , "
   1.305 -						+ "342296.77657097764 5536842.341803761 , "
   1.306 -						+ "342222.48151387094 5536641.402704332 , "
   1.307 -						+ "342286.9145411997  5536458.319970291 , "
   1.308 -						+ "342164.38954080583 5536425.686612717" + "))";
   1.309 -
   1.310 -				start = System.nanoTime();
   1.311 -				Geometry geo = jts.WKTread(WKT);
   1.312 -				geo.isValid();
   1.313 -				geo.isSimple();
   1.314 -				geo.normalize();
   1.315 -				constructWKT += System.nanoTime() - start;
   1.316 -
   1.317 -				start = System.nanoTime();
   1.318 -				StrabonPolyhedron poly = new StrabonPolyhedron(WKT);
   1.319 -				construct += System.nanoTime() - start;
   1.320 -
   1.321 -				//System.out.println("-------------------S-T-R-I-N-G-----------------start");
   1.322 -				start = System.nanoTime();
   1.323 -				String polyString = poly.toString();
   1.324 -				tostring += System.nanoTime() - start;
   1.325 -				//System.out.println(polyString);
   1.326 -
   1.327 -				//System.out.println("-------------------S-T-R-I-N-G-----------------end");
   1.328 -				//System.out.println("-------------C-O-N-S-T-R-A-I-N-T-S-------------start");
   1.329 -				start = System.nanoTime();
   1.330 -				//String constraintString = poly.toConstraints();
   1.331 -				toconstraints += System.nanoTime() - start;
   1.332 -				//System.out.println(constraintString);
   1.333 -				//System.out.println("-----------------------------------------------end");
   1.334 -			} catch (Exception e) {
   1.335 -				// TODO Auto-generated catch block
   1.336 -				e.printStackTrace();
   1.337 -			}
   1.338 -		}
   1.339 -
   1.340 -		System.out.println("Construct (WKT): " + constructWKT);
   1.341 -		System.out.println("Construct      : " + construct);
   1.342 -		System.out.println("To String      : " + tostring);
   1.343 -		System.out.println("To Constraints : " + toconstraints);
   1.344 -		System.out.println("-------------------------------------------------");
   1.345 -		System.out.println("Costruct/Construct(WKT):" + (100*construct/constructWKT));
   1.346 -		System.out.println("To Constraints/To String:" + (100*toconstraints/tostring));
   1.347 -	}
   1.348 -
   1.349  	public String stringValue() {
   1.350  		return this.toWKT();
   1.351  	}
     2.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/managers/LiteralManager.java	Wed Jun 27 15:55:20 2012 +0300
     2.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/managers/LiteralManager.java	Wed Jun 27 16:51:59 2012 +0300
     2.3 @@ -110,44 +110,32 @@
     2.4  					table.insertDateTime(id, label, dt, value);
     2.5  				}
     2.6  				else {
     2.7 -					//System.out.println("NOT  NUMERIC:::"+label+" "+literal);
     2.8  					table.insertDatatype(id, label, dt);
     2.9  					
    2.10  					/**
    2.11 -					 * XXX Additions here
    2.12 +					 * FIXME
    2.13  					 * NOTE: Cannot support the intervalStart and intervalEnd here!! 
    2.14  					 * Will need some other place to add them if this approach does work
    2.15  					 * 
    2.16  					 */
    2.17 -					if(XMLGSDatatypeUtil.isGeoSpatialDatatype(datatype))
    2.18 +					if(XMLGSDatatypeUtil.isWKTDatatype(datatype)) //WKT case
    2.19 +					{
    2.20 +						table.insertWKT(id, label, dt, null, null);
    2.21 +					}
    2.22 +					else if(XMLGSDatatypeUtil.isGMLDatatype(datatype)) //GML case
    2.23 +					{
    2.24 +						table.insertWKT(id, label, dt, null, null);
    2.25 +					} 
    2.26 +					else if(XMLGSDatatypeUtil.isSemiLinearPointSetDatatype(datatype)) // SemiLinearPointSet case
    2.27  					{
    2.28  						table.insertGeoSpatial(id, label,dt,null,null);
    2.29  					}
    2.30 -					else if(XMLGSDatatypeUtil.isNestedWKT(datatype)) //WKT case
    2.31 -					
    2.32 -					{
    2.33 -					//	System.out.println(label);
    2.34 -						table.insertWKT(id, label, dt, null, null);
    2.35 -					}
    2.36 -					else if(XMLGSDatatypeUtil.isGMLDatatype(datatype)) //GML case
    2.37 -						
    2.38 -					{
    2.39 -					//	System.out.println(label);
    2.40 -						table.insertWKT(id, label, dt, null, null);
    2.41 -					}
    2.42 -					
    2.43  				}
    2.44  				
    2.45  			}
    2.46  			catch (NumberFormatException e) {
    2.47  				table.insertDatatype(id, label, dt);
    2.48  			}
    2.49 -			//catch (IllegalArgumentException e) {
    2.50 -			//	table.insertDatatype(id, label, dt);
    2.51 -			//} //catch (IOException e) {
    2.52 -				// TODO removed it while experimenting with the correct spot to deal with geospatial
    2.53 -				//e.printStackTrace();
    2.54 -			//} 
    2.55  		}
    2.56  	}
    2.57  
    2.58 @@ -157,7 +145,6 @@
    2.59  	}
    2.60  
    2.61  	/**
    2.62 -	 * my addition
    2.63  	 * @return the literal table linked with the manager
    2.64  	 */
    2.65  	public LiteralTable getLiteralTable()
     3.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/model/XMLGSDatatypeUtil.java	Wed Jun 27 15:55:20 2012 +0300
     3.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/model/XMLGSDatatypeUtil.java	Wed Jun 27 16:51:59 2012 +0300
     3.3 @@ -49,6 +49,7 @@
     3.4  	 */
     3.5  	public static boolean isGeometryValue(Value value) {
     3.6  		if (value instanceof Literal) {
     3.7 +			// TODO: use #isGMLDatatype instead
     3.8  			Literal literal = (Literal) value;
     3.9  			String datatype = literal.getDatatype() == null ? "":literal.getDatatype().stringValue();
    3.10  			
    3.11 @@ -65,79 +66,70 @@
    3.12  	
    3.13  	/**
    3.14  	 * Returns true when the given literal has as datatype the WKT URI as it is
    3.15 -	 * in @{link StrabonPolyhedron.ogcGeometry}.
    3.16 +	 * in @{link StrabonPolyhedron.WKT}.
    3.17  	 * 
    3.18  	 * @param literal
    3.19  	 * @return
    3.20  	 */
    3.21  	public static boolean isWKTLiteral(Literal literal) {
    3.22 -		return StrabonPolyhedron.WKT.equals(literal.getDatatype().stringValue());
    3.23 +		return isWKTDatatype(literal.getDatatype());
    3.24  	}
    3.25  	
    3.26  	/**
    3.27  	 * Returns true when the given literal has as datatype the GML URI as it is
    3.28 -	 * in @{link StrabonPolyhedron.gml}.
    3.29 +	 * in @{link StrabonPolyhedron.GML}.
    3.30  	 * 
    3.31  	 * @param literal
    3.32  	 * @return
    3.33  	 */
    3.34  	public static boolean isGMLLiteral(Literal literal) {
    3.35 -		return StrabonPolyhedron.GML.equals(literal.getDatatype().stringValue());
    3.36 +		return isGMLDatatype(literal.getDatatype());
    3.37  	}
    3.38  	
    3.39  	/**
    3.40 -	 * FIXME needs retouching
    3.41 -	 * My addition!!
    3.42 -	 * Checks whether the supplied datatype has a geospatial meaning
    3.43 +	 * Checks whether the supplied datatype is actually a WKT literal.
    3.44 +	 * 
    3.45 +	 * @param datatype
    3.46 +	 * @return
    3.47  	 */
    3.48 -	public static boolean isGeoSpatialDatatype(URI datatype) {
    3.49 -
    3.50 -		//System.out.println("Function defining whether the requested datatype is of Geospatial meaning");
    3.51 -		//System.out.println(datatype.toString());
    3.52 -
    3.53 -		//FIXME don't know whether it is my ommission, but exception occurs if datatype is null.
    3.54 -		//perhaps the data weren't in the right format
    3.55 -
    3.56 -		//  should i do something to fix it?
    3.57 -		if(datatype == null)//think it would be ok if i added this
    3.58 -		{
    3.59 -			//System.out.println("probably Untyped Literal");
    3.60 +	public static boolean isWKTDatatype(URI datatype) {
    3.61 +		if(datatype == null) {
    3.62  			return false;
    3.63  		}
    3.64 -		return datatype.toString().equals("http://stsparql.di.uoa.gr/SemiLinearPointSet");
    3.65 -		//return datatype.toString().equals(GeneralDBPolyhedron.stRDFSemiLinearPointset);
    3.66 +		
    3.67 +		return StrabonPolyhedron.WKT.equals(datatype.stringValue());
    3.68  	}
    3.69 -
    3.70 -	//Checks whether the supplied datatype is actually a WKT literal
    3.71 -	public static boolean isNestedWKT(URI datatype) {
    3.72 -
    3.73 -		//System.out.println("Function defining whether the requested datatype is of Geospatial meaning");
    3.74 -		//System.out.println(datatype.toString());
    3.75 -
    3.76 -		//FIXME don't know whether it is my ommission, but exception occurs if datatype is null.
    3.77 -		//perhaps the data weren't in the right format
    3.78 -
    3.79 -		//  should i do something to fix it?
    3.80 -		if(datatype == null)//think it would be ok if i added this
    3.81 -		{
    3.82 -			//System.out.println("probably Untyped Literal");
    3.83 +	
    3.84 +	/**
    3.85 +	 * Checks whether the supplied datatype is actually a GML literal.
    3.86 +	 * 
    3.87 +	 * @param datatype
    3.88 +	 * @return
    3.89 +	 */
    3.90 +	public static boolean isGMLDatatype(URI datatype)
    3.91 +	{
    3.92 +		if(datatype == null) {
    3.93  			return false;
    3.94  		}
    3.95 -		//return datatype.toString().equals("http://stsparql.di.uoa.gr/SemiLinearPointSet");
    3.96 -// to evala apo katw hardcoded giati eixa accessibility issue - konstantina
    3.97 -		
    3.98 -		
    3.99 -			return (datatype.toString().equals("http://strdf.di.uoa.gr/ontology#WKT"));
   3.100 -		//return datatype.toString().equals(GeneralDBPolyhedron.getPolyhedron().ogcGeometry);
   3.101 +	
   3.102 +		return StrabonPolyhedron.GML.equals(datatype.stringValue());
   3.103  	}
   3.104  	
   3.105 -	public static boolean isGMLDatatype(URI datatype)
   3.106 -	{
   3.107 -		if(datatype == null)
   3.108 +	/**
   3.109 +	 * Checks whether the supplied datatype is actually a SemiLinearPointSet literal.
   3.110 +	 * 
   3.111 +	 * @param datatype
   3.112 +	 * @return
   3.113 +	 */
   3.114 +	public static boolean isSemiLinearPointSetDatatype(URI datatype) {
   3.115 +		if(datatype == null) {
   3.116  			return false;
   3.117 +		}
   3.118 +		
   3.119 +		return datatype.toString().equals("http://stsparql.di.uoa.gr/SemiLinearPointSet");
   3.120 +		//return datatype.toString().equals(StrabonPolyhedron.stRDFSemiLinearPointset);
   3.121 +	}
   3.122  	
   3.123 -		return (datatype.toString().equals("http://strdf.di.uoa.gr/ontology#GML"));
   3.124 -	}
   3.125  	/**
   3.126  	 * Checks whether the supplied datatype is a primitive XML Schema datatype.
   3.127  	 */
   3.128 @@ -247,8 +239,8 @@
   3.129  	 * Checks whether the supplied datatype is equal to xsd:float or xsd:double.
   3.130  	 */
   3.131  	public static boolean isFloatingPointDatatype(URI datatype) {
   3.132 -		return
   3.133 -		datatype.equals(XMLSchema.FLOAT) ||
   3.134 +		return 
   3.135 +		datatype.equals(XMLSchema.FLOAT) || 
   3.136  		datatype.equals(XMLSchema.DOUBLE);
   3.137  	}
   3.138  
   3.139 @@ -1833,8 +1825,7 @@
   3.140  			return XMLSchema.DURATION;
   3.141  		}
   3.142  		else {
   3.143 -			throw new IllegalArgumentException("QName cannot be mapped to an XML Schema URI: "
   3.144 -					+ qname.toString());
   3.145 +			throw new IllegalArgumentException("QName cannot be mapped to an XML Schema URI: " + qname.toString());
   3.146  		}
   3.147  	}
   3.148