Strabon

changeset 1247:8ae0b81833b7 temporals

resolved merge issues
author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr>
date Thu Aug 01 16:07:06 2013 +0300 (2013-08-01)
parents da14a303bf2c
children 0a1821a519c5
files endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StrabonBeanWrapper.java generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java generaldb/src/main/java/org/openrdf/sail/generaldb/iteration/GeneralDBBindingIteration.java monetdb/src/main/java/org/openrdf/sail/monetdb/iteration/MonetDBBindingIteration.java postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java postgis/src/main/java/org/openrdf/sail/postgis/iteration/PostGISBindingIteration.java runtime/src/test/java/eu/earthobservatory/runtime/postgres/temporals/TemplateTests.java runtime/src/test/java/eu/earthobservatory/runtime/postgres/temporals/storeTests.java
line diff
     1.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StrabonBeanWrapper.java	Thu Aug 01 14:40:30 2013 +0300
     1.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StrabonBeanWrapper.java	Thu Aug 01 16:07:06 2013 +0300
     1.3 @@ -13,6 +13,7 @@
     1.4  import java.io.IOException;
     1.5  import java.io.InputStream;
     1.6  import java.io.OutputStream;
     1.7 +import java.io.StringReader;
     1.8  import java.net.URL;
     1.9  import java.text.ParseException;
    1.10  import java.util.ArrayList;
    1.11 @@ -24,6 +25,7 @@
    1.12  import java.util.regex.Pattern;
    1.13  
    1.14  import org.openrdf.query.BindingSet;
    1.15 +import org.openrdf.model.Resource;
    1.16  import org.openrdf.model.Statement;
    1.17  import org.openrdf.query.MalformedQueryException;
    1.18  import org.openrdf.query.QueryEvaluationException;
    1.19 @@ -32,6 +34,8 @@
    1.20  import org.openrdf.query.TupleQueryResultHandlerException;
    1.21  import eu.earthobservatory.constants.TemporalConstants;
    1.22  import org.openrdf.repository.RepositoryException;
    1.23 +import org.openrdf.repository.sail.SailRepositoryConnection;
    1.24 +import org.openrdf.rio.RDFFormat;
    1.25  import org.openrdf.rio.RDFHandlerException;
    1.26  import org.openrdf.rio.RDFParseException;
    1.27  import org.slf4j.Logger;
    1.28 @@ -352,26 +356,23 @@
    1.29  			throw new RepositoryException("Could not connect to Strabon.");
    1.30  		}
    1.31  
    1.32 +		SailRepositoryConnection conn = strabon.getSailRepoConnection();
    1.33 +
    1.34  			URL source=null;
    1.35 -			
    1.36  		if (url) {
    1.37 -				source = new URL(source_data);
    1.38 +				source = new URL(src);
    1.39  			if (source.getProtocol().equalsIgnoreCase(FILE_PROTOCOL)) {
    1.40  				// it would be a security issue if we read from the server's filesystem
    1.41  				throw new IllegalArgumentException("The protocol of the URL should be one of http or ftp.");
    1.42 -				if (source.getProtocol().equalsIgnoreCase(FILE_PROTOCOL)) {
    1.43 -					// it would be a security issue if we read from the server's filesystem
    1.44 -					throw new IllegalArgumentException("The protocol of the URL should be one of http or ftp.");
    1.45 -				}
    1.46  			}
    1.47  				
    1.48 -			if(!format.equals(RDFFormat.NQUADS))
    1.49 +			if(!format.equals(RDFFormat.NQUADS.toString()))
    1.50  			{
    1.51  				if (url) {				
    1.52 -					conn.add(source, "", format, new Resource[1]);
    1.53 +					conn.add(source, "", RDFFormat.NQUADS, new Resource[1]);
    1.54  	
    1.55  				} else {
    1.56 -					conn.add(new StringReader(source_data), "", format, new Resource[1]);
    1.57 +					conn.add(new StringReader(src), "", RDFFormat.NQUADS, new Resource[1]);
    1.58  				}			
    1.59  			}
    1.60  			else
    1.61 @@ -380,7 +381,7 @@
    1.62  				if (url) {				
    1.63  					in= source.openStream();
    1.64  				} else {
    1.65 -					in= new ByteArrayInputStream(source_data.getBytes());
    1.66 +					in= new ByteArrayInputStream(src.getBytes());
    1.67  				}
    1.68  				//ByteArrayInputStream in = new ByteArrayInputStream();
    1.69  				NQuadsTranslator translator = new NQuadsTranslator(conn);
    1.70 @@ -412,9 +413,11 @@
    1.71  		strabon.storeInRepo(src, null, context, format, inference);
    1.72  		
    1.73  		logger.info("[StrabonEndpoint] STORE was successful.");
    1.74 -		
    1.75 +		}
    1.76  		return true;
    1.77 +	
    1.78  	}
    1.79 +	
    1.80  
    1.81  	public void setConnectionDetails(String dbname, String username, String password, String port, String hostname, String dbengine) {
    1.82  		this.databaseName = dbname;
     2.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java	Thu Aug 01 14:40:30 2013 +0300
     2.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java	Thu Aug 01 16:07:06 2013 +0300
     2.3 @@ -1141,7 +1141,7 @@
     2.4  			return null;
     2.5  		}
     2.6  	}
     2.7 -	
     2.8 +	GeneralDBSqlExpr spatialRelationshipPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg, GeneralDBSqlExpr thirdArg)
     2.9  	{
    2.10  		//XXX stSPARQL		
    2.11  		if(function.getURI().equals(GeoConstants.stSPARQLequals))
     3.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java	Thu Aug 01 14:40:30 2013 +0300
     3.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java	Thu Aug 01 16:07:06 2013 +0300
     3.3 @@ -149,7 +149,7 @@
     3.4  	 * Enumeration of the possible types of the results of spatial functions.
     3.5  	 * A <tt>NULL</tt> result type is to be interpreted as error.   
     3.6  	 */ 
     3.7 -	public enum ResultType { INTEGER, STRING, BOOLEAN, WKB, DOUBLE, PERIOD,INSTANT, NULL};
     3.8 +	public enum ResultType { INTEGER, STRING, BOOLEAN, WKB, DOUBLE, PERIOD,INSTANT, NULL,  WKT, WKTLITERAL};
     3.9  
    3.10  	
    3.11  	//used to retrieve the appropriate column in the Binding Iteration
     4.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/iteration/GeneralDBBindingIteration.java	Thu Aug 01 14:40:30 2013 +0300
     4.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/iteration/GeneralDBBindingIteration.java	Thu Aug 01 16:07:06 2013 +0300
     4.3 @@ -249,10 +249,10 @@
     4.4  	protected abstract RdbmsValue createTemporalValue(ResultSet rs, int index)
     4.5  	throws SQLException;
     4.6  	
     4.7 -	
     4.8 +	protected abstract RdbmsValue createWellKnownTextGeoValueForSelectConstructs(ResultSet rs, int index) throws SQLException;
     4.9 +
    4.10  	protected abstract RdbmsValue createWellKnownTextLiteralGeoValueForSelectConstructs(ResultSet rs, int index) throws SQLException;
    4.11  
    4.12 -	protected RdbmsValue createDoubleGeoValueForSelectConstructs(ResultSet rs, int index) throws SQLException
    4.13  	/**
    4.14  	 * FIXME the implementation of this function for PostGIS and MonetDB
    4.15  	 * uses by default the {@link GeoConstants#WKT} datatype when creating WKT
    4.16 @@ -314,17 +314,6 @@
    4.17  	}
    4.18  
    4.19  		
    4.20 -	protected abstract RdbmsValue createWellKnownTextLiteralGeoValueForSelectConstructs(ResultSet rs, int index) throws SQLException;
    4.21 -
    4.22 -	protected RdbmsValue createDoubleGeoValueForSelectConstructs(ResultSet rs, int index) throws SQLException
    4.23 -	{
    4.24 -		double potentialMetric;
    4.25 -		//case of metrics
    4.26 -		potentialMetric = rs.getFloat(index + 1);
    4.27 -
    4.28 -		return vf.asRdbmsLiteral(vf.createLiteral(potentialMetric));
    4.29 -
    4.30 -	}
    4.31  
    4.32  	protected RdbmsValue createIntegerGeoValueForSelectConstructs(ResultSet rs, int index)
    4.33  	throws SQLException
     5.1 --- a/monetdb/src/main/java/org/openrdf/sail/monetdb/iteration/MonetDBBindingIteration.java	Thu Aug 01 14:40:30 2013 +0300
     5.2 +++ b/monetdb/src/main/java/org/openrdf/sail/monetdb/iteration/MonetDBBindingIteration.java	Thu Aug 01 16:07:06 2013 +0300
     5.3 @@ -72,4 +72,11 @@
     5.4  		// TODO Auto-generated method stub
     5.5  		return null;
     5.6  	}
     5.7 +
     5.8 +	@Override
     5.9 +	protected RdbmsValue createBinaryGeoValueForSelectConstructs(ResultSet rs,
    5.10 +			int index) throws SQLException {
    5.11 +		// TODO Auto-generated method stub
    5.12 +		return null;
    5.13 +	}
    5.14  }
    5.15 \ No newline at end of file
     6.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Thu Aug 01 14:40:30 2013 +0300
     6.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Thu Aug 01 16:07:06 2013 +0300
     6.3 @@ -19,6 +19,7 @@
     6.4  import java.util.TimeZone;
     6.5  
     6.6  import org.openrdf.query.algebra.evaluation.function.datetime.Timezone;
     6.7 +import org.openrdf.query.algebra.evaluation.function.spatial.AbstractWKT;
     6.8  import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron;
     6.9  import org.openrdf.query.algebra.evaluation.function.spatial.WKTHelper;
    6.10  import org.openrdf.sail.generaldb.algebra.GeneralDBColumnVar;
     7.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/iteration/PostGISBindingIteration.java	Thu Aug 01 14:40:30 2013 +0300
     7.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/iteration/PostGISBindingIteration.java	Thu Aug 01 16:07:06 2013 +0300
     7.3 @@ -129,4 +129,11 @@
     7.4  		int srid = rs.getInt(index + 2);
     7.5  		return vf.getRdbmsPolyhedron(114, GeoConstants.WKTLITERAL, label, srid);
     7.6  	}
     7.7 +
     7.8 +	@Override
     7.9 +	protected RdbmsValue createBinaryGeoValueForSelectConstructs(ResultSet rs,
    7.10 +			int index) throws SQLException {
    7.11 +		// TODO Auto-generated method stub
    7.12 +		return null;
    7.13 +	}
    7.14  }
     8.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/postgres/temporals/TemplateTests.java	Thu Aug 01 14:40:30 2013 +0300
     8.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/postgres/temporals/TemplateTests.java	Thu Aug 01 16:07:06 2013 +0300
     8.3 @@ -98,6 +98,6 @@
     8.4  	protected static void loadTestData(String inputfile, Strabon strabon, String format)
     8.5  		throws RDFParseException, RepositoryException, IOException, RDFHandlerException, InvalidDatasetFormatFault
     8.6  	{
     8.7 -		strabon.storeInRepo(inputfile, format);
     8.8 +		strabon.storeInRepo(inputfile, format, null);
     8.9  	}
    8.10  }
     9.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/postgres/temporals/storeTests.java	Thu Aug 01 14:40:30 2013 +0300
     9.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/postgres/temporals/storeTests.java	Thu Aug 01 16:07:06 2013 +0300
     9.3 @@ -99,8 +99,8 @@
     9.4  		String text2 = "<http://example.org/itemOfString1> <http://example.org/id> \"String121\" \"[2002-11-19T12:41:00,2010-11-19T13:41:00]\"^^<http://strdf.di.uoa.gr/ontology#period> . \n" +
     9.5  				"<http://example.org/itemOfString22> <http://example.org/id> \"String122\" \"[2002-11-19T12:42:00,2010-11-19T13:41:00]\"^^<http://strdf.di.uoa.gr/ontology#period>.";
     9.6  		try {
     9.7 -			strabon.storeInRepo(text1, "NQUADS");
     9.8 -			strabon.storeInRepo(text2, "NQUADS");
     9.9 +			strabon.storeInRepo(text1, "NQUADS", null);
    9.10 +			strabon.storeInRepo(text2, "NQUADS", null);
    9.11  
    9.12  		} catch (RDFParseException e) {
    9.13  			// TODO Auto-generated catch block
    9.14 @@ -124,14 +124,14 @@
    9.15  	@Test
    9.16  	public void testStoreURL() throws RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault 
    9.17  	{
    9.18 -		strabon.storeInRepo("http://manolee.di.uoa.gr/temporals/temporal-periods.nq", "NQUADS");
    9.19 +		strabon.storeInRepo("http://manolee.di.uoa.gr/temporals/temporal-periods.nq", "NQUADS", null);
    9.20  
    9.21  	}
    9.22  	
    9.23  	@Test
    9.24  	public void testStoreFile() throws RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault 
    9.25  	{
    9.26 -		strabon.storeInRepo("/temporal-periods.nq", "NQUADS");
    9.27 +		strabon.storeInRepo("/temporal-periods.nq", "NQUADS", null);
    9.28  
    9.29  	}
    9.30  	
    9.31 @@ -144,8 +144,8 @@
    9.32  		String text2 = "<http://example.org/itemOfString31> <http://example.org/id> \"String3121\"  . \n" +
    9.33  				"<http://example.org/itemOfString322> <http://example.org/id> \"String3122\" .";
    9.34  		try {
    9.35 -			strabon.storeInRepo(text1, "NQUADS");
    9.36 -			strabon.storeInRepo(text2, "NQUADS");
    9.37 +			strabon.storeInRepo(text1, "NQUADS", null);
    9.38 +			strabon.storeInRepo(text2, "NQUADS", null);
    9.39  
    9.40  		} catch (RDFParseException e) {
    9.41  			// TODO Auto-generated catch block
    9.42 @@ -175,7 +175,7 @@
    9.43  		
    9.44  		
    9.45  		try {
    9.46 -			strabon.storeInRepo(text1, "NQUADS");
    9.47 +			strabon.storeInRepo(text1, "NQUADS", null);
    9.48  
    9.49  		} catch (RDFParseException e) {
    9.50  			// TODO Auto-generated catch block
    9.51 @@ -199,7 +199,7 @@
    9.52  	@Test
    9.53  	public void testNQUADSFile() throws RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault 
    9.54  	{
    9.55 -		strabon.storeInRepo("/triples-and-quads.nq", "NQUADS");
    9.56 +		strabon.storeInRepo("/triples-and-quads.nq", "NQUADS", null);
    9.57  
    9.58  	}
    9.59