Strabon

changeset 1187:27ac0e47c761

Add TupleQuery result format
author George Garbis <ggarbis@di.uoa.gr>
date Thu Jul 04 17:53:07 2013 +0300 (2013-07-04)
parents 57d8b51cd8d1
children 94f44f1044be
files runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java runtime/src/main/java/eu/earthobservatory/utils/Format.java
line diff
     1.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java	Thu May 23 17:30:52 2013 +0300
     1.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java	Thu Jul 04 17:53:07 2013 +0300
     1.3 @@ -48,17 +48,6 @@
     1.4  public abstract class Strabon {
     1.5  
     1.6  	private static Logger logger = LoggerFactory.getLogger(eu.earthobservatory.runtime.generaldb.Strabon.class);
     1.7 -
     1.8 -	public static final String FORMAT_DEFAULT	= "";
     1.9 -	public static final String FORMAT_XML		= "XML";
    1.10 -	public static final String FORMAT_KML		= "KML";
    1.11 -	public static final String FORMAT_KMZ		= "KMZ";
    1.12 -	public static final String FORMAT_GEOJSON	= "GeoJSON";
    1.13 -	public static final String FORMAT_EXP		= "EXP";
    1.14 -	public static final String FORMAT_HTML		= "HTML";
    1.15 -	
    1.16 -	public static final String NEWLINE		= "\n";
    1.17 -	
    1.18  	/**
    1.19  	 * Connection details (shared with subclasses)
    1.20  	 */
    1.21 @@ -267,21 +256,27 @@
    1.22  				}
    1.23  				
    1.24  				long t3 = System.nanoTime();
    1.25 -	
    1.26 +
    1.27 +				logger.info((t2-t1)+" + "+(t3-t2)+" = "+(t3-t1)+" | "+results);
    1.28  				return new long[]{t2-t1, t3-t2, t3-t1, results};
    1.29  //				break;
    1.30 +			
    1.31 +			case TUQU:
    1.32  				
    1.33 -		default:
    1.34 -			// get the writer for the specified format
    1.35 -			TupleQueryResultWriter resultWriter = stSPARQLQueryResultToFormatAdapter.createstSPARQLQueryResultWriter(resultsFormat, out);
    1.36 -			
    1.37 -			// check for null format
    1.38 -			if (resultWriter == null) {
    1.39 -				logger.error("[Strabon.query] Invalid format.");
    1.40 -				return false;
    1.41 -			}
    1.42 -			
    1.43 -			tupleQuery.evaluate(resultWriter);
    1.44 +				return tupleQuery;
    1.45 +//				break;			
    1.46 +				
    1.47 +			default:
    1.48 +				// get the writer for the specified format
    1.49 +				TupleQueryResultWriter resultWriter = stSPARQLQueryResultToFormatAdapter.createstSPARQLQueryResultWriter(resultsFormat, out);
    1.50 +				
    1.51 +				// check for null format
    1.52 +				if (resultWriter == null) {
    1.53 +					logger.error("[Strabon.query] Invalid format.");
    1.54 +					return false;
    1.55 +				}
    1.56 +				
    1.57 +				tupleQuery.evaluate(resultWriter);
    1.58  		}
    1.59  
    1.60  		return status;
     2.1 --- a/runtime/src/main/java/eu/earthobservatory/utils/Format.java	Thu May 23 17:30:52 2013 +0300
     2.2 +++ b/runtime/src/main/java/eu/earthobservatory/utils/Format.java	Thu Jul 04 17:53:07 2013 +0300
     2.3 @@ -50,6 +50,11 @@
     2.4  	 * Format for experiments
     2.5  	 */
     2.6  	EXP("EXP"),
     2.7 +
     2.8 +	/**
     2.9 +	 * Tuple query object
    2.10 +	 */
    2.11 +	TUQU("TUPLEQUERY"),
    2.12  	
    2.13  	/**
    2.14  	 * HTML format