Strabon

changeset 1262:9af0661612c9

now construct functions return a wktLiteral starting with the URI
reference system according to GeoSPARQL spec
author Stella Giannakopoulou <sgian@di.uoa.gr>
date Thu Sep 05 15:15:56 2013 +0300 (2013-09-05)
parents f55f1c7c41d4
children 353ef9002c3a
files generaldb/src/main/java/org/openrdf/sail/generaldb/model/GeneralDBPolyhedron.java resultio-spatial/text/src/main/java/org/openrdf/query/resultio/text/stSPARQLResultsTSVWriter.java
line diff
     1.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/model/GeneralDBPolyhedron.java	Thu Sep 05 11:50:02 2013 +0300
     1.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/model/GeneralDBPolyhedron.java	Thu Sep 05 15:15:56 2013 +0300
     1.3 @@ -111,16 +111,32 @@
     1.4  
     1.5  
     1.6  	public String stringValue() {
     1.7 -		return new String(this.polyhedronStringRep)+";http://www.opengis.net/def/crs/EPSG/0/"+this.getPolyhedron().getGeometry().getSRID();
     1.8 +		if(String.valueOf(datatype) == GeoConstants.WKT)
     1.9 +			return new String(this.polyhedronStringRep)+";http://www.opengis.net/def/crs/EPSG/0/"+this.getPolyhedron().getGeometry().getSRID();
    1.10 +		else
    1.11 +			return new String("<http://www.opengis.net/def/crs/EPSG/0/"+this.getPolyhedron().getGeometry().getSRID()+"> "+this.polyhedronStringRep);
    1.12  	}
    1.13  
    1.14  	@Override
    1.15  	public String toString() {
    1.16 -		return new String("\""+this.polyhedronStringRep+";http://www.opengis.net/def/crs/EPSG/0/"
    1.17 -				+this.getPolyhedron().getGeometry().getSRID()+"\"" + "^^<" + 
    1.18 -				((StrabonPolyhedron.EnableConstraintRepresentation)  ? 
    1.19 -						GeoConstants.stRDFSemiLinearPointset : String.valueOf(datatype))
    1.20 -						+">");
    1.21 +		if(String.valueOf(datatype) == GeoConstants.WKT)
    1.22 +		{
    1.23 +			return new String("\""+this.polyhedronStringRep+";http://www.opengis.net/def/crs/EPSG/0/"
    1.24 +					+this.getPolyhedron().getGeometry().getSRID()+"\"" + "^^<" +
    1.25 +					((StrabonPolyhedron.EnableConstraintRepresentation)  ?
    1.26 +							GeoConstants.stRDFSemiLinearPointset : String.valueOf(datatype))
    1.27 +							+">");
    1.28 +		}
    1.29 +		else if(String.valueOf(datatype) == GeoConstants.WKTLITERAL)
    1.30 +		{
    1.31 +			return new String("\""+"<"+"http://www.opengis.net/def/crs/EPSG/0/"+this.getPolyhedron().getGeometry().getSRID()+"> "+this.polyhedronStringRep
    1.32 +					+"\"" + "^^<" +
    1.33 +					((StrabonPolyhedron.EnableConstraintRepresentation)  ?
    1.34 +							GeoConstants.stRDFSemiLinearPointset : String.valueOf(datatype))
    1.35 +							+">");
    1.36 +		}
    1.37 +		//must not reach this place
    1.38 +		return null;
    1.39  	}
    1.40  
    1.41  	@Override
     2.1 --- a/resultio-spatial/text/src/main/java/org/openrdf/query/resultio/text/stSPARQLResultsTSVWriter.java	Thu Sep 05 11:50:02 2013 +0300
     2.2 +++ b/resultio-spatial/text/src/main/java/org/openrdf/query/resultio/text/stSPARQLResultsTSVWriter.java	Thu Sep 05 15:15:56 2013 +0300
     2.3 @@ -17,6 +17,8 @@
     2.4  import org.openrdf.query.resultio.text.tsv.SPARQLResultsTSVWriter;
     2.5  import org.openrdf.sail.generaldb.model.GeneralDBPolyhedron;
     2.6  
     2.7 +import eu.earthobservatory.constants.GeoConstants;
     2.8 +
     2.9  /**
    2.10   * @author Charalampos Nikolaou <charnik@di.uoa.gr>
    2.11   * 
    2.12 @@ -33,7 +35,10 @@
    2.13  			// catch the spatial case and create a new literal
    2.14  			// constructing a new literal is the only way if we want to reuse the {@link #writeValue(Value)} method
    2.15  			GeneralDBPolyhedron dbpolyhedron = (GeneralDBPolyhedron) val;
    2.16 -			val = new LiteralImpl(dbpolyhedron.getPolyhedronStringRep()+";http://www.opengis.net/def/crs/EPSG/0/"+dbpolyhedron.getPolyhedron().getGeometry().getSRID(), dbpolyhedron.getDatatype());
    2.17 +			if(String.valueOf(dbpolyhedron.getDatatype()) == GeoConstants.WKT)
    2.18 +				val = new LiteralImpl(dbpolyhedron.getPolyhedronStringRep()+";http://www.opengis.net/def/crs/EPSG/0/"+dbpolyhedron.getPolyhedron().getGeometry().getSRID(), dbpolyhedron.getDatatype());
    2.19 +			else
    2.20 +				val = new LiteralImpl("<http://www.opengis.net/def/crs/EPSG/0/"+dbpolyhedron.getPolyhedron().getGeometry().getSRID()+"> "+dbpolyhedron.getPolyhedronStringRep(),dbpolyhedron.getDatatype());
    2.21  		}
    2.22  		
    2.23  		// write value