Strabon

changeset 1048:cc1504a43458

Removed testCRS from runtime and moved tests in testsuite.
author Panayiotis Smeros <psmeros@di.uoa.gr>
date Fri Apr 19 11:28:52 2013 +0300 (2013-04-19)
parents bbba44d70ba5
children c3bf7385caf7
files runtime/src/main/java/eu/earthobservatory/runtime/postgis/testCRS.java testsuite/src/test/java/eu/earthobservatory/testsuite/stSPARQL/StoreGMLTest.java testsuite/src/test/java/eu/earthobservatory/testsuite/stSPARQL/StoreWKTTest.java testsuite/src/test/resources/stSPARQL/StoreGMLTest/StoreGMLTest.nt testsuite/src/test/resources/stSPARQL/StoreGMLTest/StoreGMLTest.rq testsuite/src/test/resources/stSPARQL/StoreGMLTest/StoreGMLTest.srx testsuite/src/test/resources/stSPARQL/StoreWKTTest/StoreWKTTest.nt testsuite/src/test/resources/stSPARQL/StoreWKTTest/StoreWKTTest.rq testsuite/src/test/resources/stSPARQL/StoreWKTTest/StoreWKTTest.srx
line diff
     1.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/postgis/testCRS.java	Thu Apr 18 13:27:06 2013 +0300
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,83 +0,0 @@
     1.4 -/**
     1.5 - * This Source Code Form is subject to the terms of the Mozilla Public
     1.6 - * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 - * file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.8 - * 
     1.9 - * Copyright (C) 2010, 2011, 2012, Pyravlos Team
    1.10 - * 
    1.11 - * http://www.strabon.di.uoa.gr/
    1.12 - */
    1.13 -package eu.earthobservatory.runtime.postgis;
    1.14 -
    1.15 -import java.io.IOException;
    1.16 -import java.net.URL;
    1.17 -import java.sql.SQLException;
    1.18 -
    1.19 -import org.openrdf.repository.RepositoryException;
    1.20 -import org.openrdf.rio.RDFHandlerException;
    1.21 -import org.openrdf.rio.RDFParseException;
    1.22 -
    1.23 -import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault;
    1.24 -
    1.25 -public class testCRS {
    1.26 -	
    1.27 -	public static Strabon strabon;
    1.28 -	
    1.29 -	public static void main(String[] args) throws RDFParseException, RepositoryException, IOException, InvalidDatasetFormatFault, RDFHandlerException {
    1.30 -		try {
    1.31 -			strabon = new Strabon("tut","postgres","p1r3as", 5432, "localhost", true);
    1.32 -		} catch (SQLException e) {
    1.33 -			// TODO Auto-generated catch block
    1.34 -		
    1.35 -			e.printStackTrace();
    1.36 -		} catch (ClassNotFoundException e) {
    1.37 -			// TODO Auto-generated catch block
    1.38 -			e.printStackTrace();
    1.39 -		} catch (Exception e) {
    1.40 -			e.printStackTrace();
    1.41 -		}
    1.42 -		
    1.43 -		String text = 
    1.44 -				"<http://example.org/rcc8Obj1> <http://www.opengis.net/def/function/geosparql/rcc8eq> <http://example.org/rcc8Obj2> . \n" +
    1.45 -				"<http://example.org/simpleGeometry1> <http://www.opengis.net/def/function/geosparql/isEmpty> <http://example.org/nai> . \n"+
    1.46 -		"<http://example.org/ForestArea1> <http://www.opengis.net/def/function/geosparql/defaultGeometry> <http://example.org/defaultgeom> . \n"+
    1.47 -		"<http://example.org/SpatialObject1> <http://www.opengis.net/def/function/geosparql/ehIntersects> <http://example.org/SpatialObject2> . \n";
    1.48 -
    1.49 -		String statement1= "<http://example.org/CoastLine4> <http://www.earthobservatory.eu/ontologies/noaOntology.owl#hasGeometry> " +
    1.50 -				"\"POLYGON((34.80 19.37,41.74 19.37,41.74 29.64 ,34.80 29.64,34.80 19.37));http://www.opengis.net/def/crs/EPSG/0/4326" +
    1.51 -				"\"^^<http://strdf.di.uoa.gr/ontology#WKT> .";
    1.52 -	String statement2= "<http://example.org/CoastLine5> <http://www.earthobservatory.eu/ontologies/noaOntology.owl#hasGeometry> " +
    1.53 -				"\"POLYGON((34.80 19.37,41.74 19.37,41.74 29.64 ,34.80 29.64,34.80 19.37));http://www.opengis.net/def/crs/EPSG/0/32630" +
    1.54 -				"\"^^<http://strdf.di.uoa.gr/ontology#WKT> .";
    1.55 -		String gml =  "<http://example.org/rcc8Obj1> <http://example.org/hasGeometry> \"<gml:Point> <gml:coordinates>45.67, 88.56</gml:coordinates> </gml:Point>\"^^<http://strdf.di.uoa.gr/ontology#GML> .";
    1.56 -				
    1.57 -		String file = "/home/konstantina/gmlread.nt";
    1.58 -		URL url = new URL("http://www.di.uoa.gr/~pms509/rdf-data/streason.nt");
    1.59 -		String fileBaseURI = "http://example#";
    1.60 -		String fileRDFFormat = "NTRIPLES";
    1.61 -		String stringBaseURI = "http://example#";
    1.62 -		String stringRDFFormat = "NTRIPLES";
    1.63 -		try {
    1.64 -			//strabon.storeInRepo(statement1, stringBaseURI, null, stringRDFFormat);
    1.65 -			//strabon.storeInRepo(statement2, stringBaseURI, null, stringRDFFormat);
    1.66 -			//strabon.storeInRepo(text, null, null, "NTRIPLES");
    1.67 -			strabon.storeInRepo(file, fileRDFFormat);
    1.68 -			//strabon.storeInRepo(gml, null, null, stringRDFFormat);
    1.69 -			
    1.70 -		} catch (RDFParseException e) {
    1.71 -			e.printStackTrace();
    1.72 -		} catch (RepositoryException e) {
    1.73 -			e.printStackTrace();
    1.74 -		} catch (IOException e) {
    1.75 -			e.printStackTrace();
    1.76 -		} catch (InvalidDatasetFormatFault e) {
    1.77 -			e.printStackTrace();
    1.78 -		}
    1.79 -		finally{
    1.80 -			strabon.close();
    1.81 -			System.out.println("connection closed.");
    1.82 -		}
    1.83 -		
    1.84 -	}
    1.85 -
    1.86 -}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/stSPARQL/StoreGMLTest.java	Fri Apr 19 11:28:52 2013 +0300
     2.3 @@ -0,0 +1,20 @@
     2.4 +/**
     2.5 + * This Source Code Form is subject to the terms of the Mozilla Public
     2.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     2.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
     2.8 + * 
     2.9 + * Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team
    2.10 + * 
    2.11 + * http://www.strabon.di.uoa.gr/
    2.12 + */
    2.13 +package eu.earthobservatory.testsuite.stSPARQL;
    2.14 +
    2.15 +import eu.earthobservatory.testsuite.utils.TemplateTest;
    2.16 +
    2.17 +
    2.18 +/**
    2.19 + * A simple store test. It tests if triples with GML serialization are stored and retrieved correctly.
    2.20 + * 
    2.21 + * @author Panayiotis Smeros <psmeros@di.uoa.gr
    2.22 + */
    2.23 +public class StoreGMLTest extends TemplateTest{}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/stSPARQL/StoreWKTTest.java	Fri Apr 19 11:28:52 2013 +0300
     3.3 @@ -0,0 +1,20 @@
     3.4 +/**
     3.5 + * This Source Code Form is subject to the terms of the Mozilla Public
     3.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     3.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
     3.8 + * 
     3.9 + * Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team
    3.10 + * 
    3.11 + * http://www.strabon.di.uoa.gr/
    3.12 + */
    3.13 +package eu.earthobservatory.testsuite.stSPARQL;
    3.14 +
    3.15 +import eu.earthobservatory.testsuite.utils.TemplateTest;
    3.16 +
    3.17 +
    3.18 +/**
    3.19 + * A simple store test. It tests if triples with WKT serialization are stored and retrieved correctly.
    3.20 + * 
    3.21 + * @author Panayiotis Smeros <psmeros@di.uoa.gr
    3.22 + */
    3.23 +public class StoreWKTTest extends TemplateTest{}
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/testsuite/src/test/resources/stSPARQL/StoreGMLTest/StoreGMLTest.nt	Fri Apr 19 11:28:52 2013 +0300
     4.3 @@ -0,0 +1,4 @@
     4.4 +<http://example.org/point> <http://strdf.di.uoa.gr/ontology#hasGeometry> _:point.
     4.5 +_:point <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2003/01/geo/wgs84_pos#Point>.
     4.6 +_:point <http://www.w3.org/2003/01/geo/wgs84_pos#lat> "55.701".
     4.7 +_:point <http://www.w3.org/2003/01/geo/wgs84_pos#long> "12.552".
     4.8 \ No newline at end of file
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/testsuite/src/test/resources/stSPARQL/StoreGMLTest/StoreGMLTest.rq	Fri Apr 19 11:28:52 2013 +0300
     5.3 @@ -0,0 +1,3 @@
     5.4 +SELECT ?o
     5.5 +WHERE {?s <http://strdf.di.uoa.gr/ontology#hasGeometry> ?geo.
     5.6 +?geo <http://www.w3.org/2003/01/geo/wgs84_pos#lat> ?o.}
     5.7 \ No newline at end of file
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/testsuite/src/test/resources/stSPARQL/StoreGMLTest/StoreGMLTest.srx	Fri Apr 19 11:28:52 2013 +0300
     6.3 @@ -0,0 +1,13 @@
     6.4 +<?xml version='1.0' encoding='UTF-8'?>
     6.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'>
     6.6 +	<head>
     6.7 +		<variable name='o'/>
     6.8 +	</head>
     6.9 +	<results>
    6.10 +		<result>
    6.11 +			<binding name='o'>
    6.12 +				<literal>55.701</literal>
    6.13 +			</binding>
    6.14 +		</result>
    6.15 +	</results>
    6.16 +</sparql>
    6.17 \ No newline at end of file
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/testsuite/src/test/resources/stSPARQL/StoreWKTTest/StoreWKTTest.nt	Fri Apr 19 11:28:52 2013 +0300
     7.3 @@ -0,0 +1,2 @@
     7.4 +<http://example.org/Area1> <http://strdf.di.uoa.gr/ontology#hasGeometry> "POLYGON((34.80 19.37,41.74 19.37,41.74 29.64 ,34.80 29.64,34.80 19.37));http://www.opengis.net/def/crs/EPSG/0/4326"^^<http://strdf.di.uoa.gr/ontology#WKT> .
     7.5 +<http://example.org/Area1> <http://strdf.di.uoa.gr/ontology#hasGeometry> "POLYGON((34.80 19.37,41.74 19.37,41.74 29.64 ,34.80 29.64,34.80 19.37));http://www.opengis.net/def/crs/EPSG/0/32630"^^<http://strdf.di.uoa.gr/ontology#WKT> .
     7.6 \ No newline at end of file
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/testsuite/src/test/resources/stSPARQL/StoreWKTTest/StoreWKTTest.rq	Fri Apr 19 11:28:52 2013 +0300
     8.3 @@ -0,0 +1,2 @@
     8.4 +SELECT ?o
     8.5 +WHERE {?s <http://strdf.di.uoa.gr/ontology#hasGeometry> ?o}
     8.6 \ No newline at end of file
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/testsuite/src/test/resources/stSPARQL/StoreWKTTest/StoreWKTTest.srx	Fri Apr 19 11:28:52 2013 +0300
     9.3 @@ -0,0 +1,18 @@
     9.4 +<?xml version='1.0' encoding='UTF-8'?>
     9.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'>
     9.6 +	<head>
     9.7 +		<variable name='o'/>
     9.8 +	</head>
     9.9 +	<results>
    9.10 +		<result>
    9.11 +			<binding name='o'>
    9.12 +				<literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON((34.80 19.37,41.74 19.37,41.74 29.64 ,34.80 29.64,34.80 19.37));http://www.opengis.net/def/crs/EPSG/0/4326</literal>
    9.13 +			</binding>
    9.14 +		</result>
    9.15 +		<result>
    9.16 +			<binding name='o'>
    9.17 +				<literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON((34.80 19.37,41.74 19.37,41.74 29.64 ,34.80 29.64,34.80 19.37));http://www.opengis.net/def/crs/EPSG/0/32630</literal>
    9.18 +			</binding>
    9.19 +		</result>
    9.20 +	</results>
    9.21 +</sparql>
    9.22 \ No newline at end of file