Strabon

changeset 1250:d98fe31ee81b temporals

extended KMLWriter to support TimeSpan Values as well
author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr>
date Fri Aug 02 15:17:43 2013 +0300 (2013-08-02)
parents 5475dee7d136
children f592e2d83bd8
files resultio-spatial/sparqlkml/src/main/java/org/openrdf/query/resultio/sparqlkml/stSPARQLResultsKMLWriter.java
line diff
     1.1 --- a/resultio-spatial/sparqlkml/src/main/java/org/openrdf/query/resultio/sparqlkml/stSPARQLResultsKMLWriter.java	Thu Aug 01 16:09:20 2013 +0300
     1.2 +++ b/resultio-spatial/sparqlkml/src/main/java/org/openrdf/query/resultio/sparqlkml/stSPARQLResultsKMLWriter.java	Fri Aug 02 15:17:43 2013 +0300
     1.3 @@ -48,6 +48,7 @@
     1.4  import com.vividsolutions.jts.io.ParseException;
     1.5  
     1.6  import eu.earthobservatory.constants.GeoConstants;
     1.7 +import eu.earthobservatory.constants.TemporalConstants;
     1.8  
     1.9  /**
    1.10   * @author Manos Karpathiotakis <mk@di.uoa.gr>
    1.11 @@ -198,15 +199,25 @@
    1.12  			xmlWriter.startTag(PLACEMARK_TAG);
    1.13  			for (Binding binding : bindingSet) {
    1.14  				
    1.15 -				if(!binding.getValue().toString().contains("^^")){
    1.16 +				if(!binding.getValue().toString().contains("^^") || (binding.getValue() instanceof org.openrdf.sail.generaldb.model.GeneralDBPolyhedron)){
    1.17  					continue;
    1.18  				}
    1.19  				Literal literal = (Literal) binding.getValue();
    1.20 +		
    1.21  				if(XMLGSDatatypeUtil.isCalendarDatatype(literal.getDatatype())){
    1.22  					hasTimestamp = true;
    1.23  					xmlWriter.startTag(TIMESTAMP_TAG);
    1.24  					xmlWriter.textElement(WHEN_TAG, literal.getLabel());
    1.25  					xmlWriter.endTag(TIMESTAMP_TAG);
    1.26 +				} else if(literal.getDatatype().stringValue().equalsIgnoreCase(TemporalConstants.PERIOD)){
    1.27 +					String period = literal.getLabel().replace(")", "]");
    1.28 +					String start = period.substring(period.indexOf("[")+1, period.indexOf(","));
    1.29 +					String end = period.substring(period.indexOf(",")+2, period.indexOf("]"));
    1.30 +					xmlWriter.startTag(TIMESPAN_TAG);
    1.31 +					xmlWriter.textElement(BEGIN_TAG, start);
    1.32 +					xmlWriter.textElement(END_TAG, end);
    1.33 +					xmlWriter.endTag(TIMESPAN_TAG);
    1.34 +
    1.35  				}
    1.36  			}
    1.37  			xmlWriter.textElement(NAME_TAG, "Result" + nresults);