Strabon

changeset 646:300e958d034b temporals

temporals
author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr>
date Tue Oct 16 15:47:04 2012 +0300 (2012-10-16)
parents 61c165c2e0b7
children a7188f5f0c4a
files pom.xml runtime/pom.xml runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java runtime/src/main/resources/log4j.properties runtime/src/test/java/eu/earthobservatory/runtime/generaldb/GeneralTests.java runtime/src/test/resources/databases.properties
line diff
     1.1 --- a/pom.xml	Fri Oct 12 16:06:32 2012 +0300
     1.2 +++ b/pom.xml	Tue Oct 16 15:47:04 2012 +0300
     1.3 @@ -210,43 +210,55 @@
     1.4  			<dependency>
     1.5  				<groupId>org.openrdf.sesame</groupId>
     1.6  				<artifactId>sesame-rio-rdfxml</artifactId>
     1.7 -				<version>${sesame.version}</version>
     1.8 +				<version>2.6.9</version>
     1.9 +			</dependency>
    1.10 +			
    1.11 +			
    1.12 +			<dependency>
    1.13 +				<groupId>org.openrdf.sesame</groupId>
    1.14 +				<artifactId>sesame-rio</artifactId>
    1.15 +				<version>2.6.9</version>
    1.16  			</dependency>
    1.17  
    1.18  			<dependency>
    1.19  				<groupId>org.openrdf.sesame</groupId>
    1.20  				<artifactId>sesame-rio-ntriples</artifactId>
    1.21 -				<version>${sesame.version}</version>
    1.22 +				<version>2.6.9</version>
    1.23  			</dependency>
    1.24  
    1.25  			<dependency>
    1.26  				<groupId>org.openrdf.sesame</groupId>
    1.27  				<artifactId>sesame-rio-turtle</artifactId>
    1.28 -				<version>${sesame.version}</version>
    1.29 +				<version>2.6.9</version>
    1.30  			</dependency>
    1.31  
    1.32  			<dependency>
    1.33  				<groupId>org.openrdf.sesame</groupId>
    1.34  				<artifactId>sesame-rio-trig</artifactId>
    1.35 -				<version>${sesame.version}</version>
    1.36 +				<version>2.6.9</version>
    1.37  			</dependency>
    1.38  
    1.39  			<dependency>
    1.40  				<groupId>org.openrdf.sesame</groupId>
    1.41  				<artifactId>sesame-rio-trix</artifactId>
    1.42 -				<version>${sesame.version}</version>
    1.43 +				<version>2.6.9</version>
    1.44  			</dependency>
    1.45  
    1.46  			<dependency>
    1.47  				<groupId>org.openrdf.sesame</groupId>
    1.48  				<artifactId>sesame-rio-n3</artifactId>
    1.49 -				<version>${sesame.version}</version>
    1.50 +				<version>2.6.9</version>
    1.51  			</dependency>
    1.52  
    1.53  			<dependency>
    1.54  				<groupId>org.openrdf.sesame</groupId>
    1.55  				<artifactId>sesame-rio-binary</artifactId>
    1.56 -				<version>${sesame.version}</version>
    1.57 +				<version>2.6.9</version>
    1.58 +			</dependency>
    1.59 +			<dependency>
    1.60 +				<groupId>org.openrdf.sesame</groupId>
    1.61 +				<artifactId>sesame-rio-api</artifactId>
    1.62 +				<version>2.6.9</version>
    1.63  			</dependency>
    1.64  
    1.65  			<!-- GeoTools -->
     2.1 --- a/runtime/pom.xml	Fri Oct 12 16:06:32 2012 +0300
     2.2 +++ b/runtime/pom.xml	Tue Oct 16 15:47:04 2012 +0300
     2.3 @@ -91,6 +91,7 @@
     2.4  		</dependency>
     2.5  
     2.6  		<!-- rio API -->
     2.7 +		
     2.8  		<dependency>
     2.9  			<groupId>org.openrdf.sesame</groupId>
    2.10  			<artifactId>sesame-rio-rdfxml</artifactId>
    2.11 @@ -305,8 +306,24 @@
    2.12  			<groupId>org.opengis</groupId>
    2.13  			<artifactId>geoapi-pending</artifactId>
    2.14  		</dependency>
    2.15 -		
    2.16 +
    2.17 +
    2.18 +    <dependency> 
    2.19 +        <groupId>net.fortytwo.sesametools</groupId> 
    2.20 +        <artifactId>nquads</artifactId> 
    2.21 +        <version>1.1</version> 
    2.22 +    </dependency>
    2.23 +    		
    2.24  	</dependencies>
    2.25 +	
    2.26 +	    <repositories> 
    2.27 +       <repository> 
    2.28 +            <id>fortytwo</id> 
    2.29 +            <name>fortytwo.net Maven repository</name> 
    2.30 +            <url>http://fortytwo.net/maven2</url> 
    2.31 +        </repository> 
    2.32 +    </repositories> 
    2.33 + 
    2.34  
    2.35  	<build>
    2.36  		<pluginManagement>
     3.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java	Fri Oct 12 16:06:32 2012 +0300
     3.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java	Tue Oct 16 15:47:04 2012 +0300
     3.3 @@ -9,6 +9,7 @@
     3.4   */
     3.5  package eu.earthobservatory.runtime.generaldb;
     3.6  
     3.7 +import java.io.ByteArrayInputStream;
     3.8  import java.io.File;
     3.9  import java.io.IOException;
    3.10  import java.io.InputStream;
    3.11 @@ -19,7 +20,10 @@
    3.12  import java.net.URL;
    3.13  import java.sql.SQLException;
    3.14  import java.util.ArrayList;
    3.15 +import java.util.Collection;
    3.16 +import java.util.Iterator;
    3.17  
    3.18 +import org.openrdf.model.Statement;
    3.19  import org.openrdf.model.URI;
    3.20  import org.openrdf.model.ValueFactory;
    3.21  import org.openrdf.query.BindingSet;
    3.22 @@ -322,7 +326,10 @@
    3.23  		} else if(format.equalsIgnoreCase("TURTLE")) {
    3.24  			realFormat =  RDFFormat.TURTLE;
    3.25  			
    3.26 -		} else {
    3.27 +		}else if(format.equalsIgnoreCase("NQUADS")) {
    3.28 +			realFormat =  RDFFormat.NQUADS;
    3.29 +		} 
    3.30 +		else {
    3.31  			throw new InvalidDatasetFormatFault();
    3.32  		}
    3.33  
    3.34 @@ -354,13 +361,33 @@
    3.35  		logger.info("[Strabon.storeURL] Storing file.");
    3.36  		logger.info("[Strabon.storeURL] URL      : {}", url.toString());
    3.37  		if (logger.isDebugEnabled()) {
    3.38 -			logger.debug("[Strabon.storeURL] Base URI : {}", ((baseURI == null) ? "null" : baseURI));
    3.39 +			logger.debug("[Strabon.storeURL] Base URI : {}", ((baseURI == null) ? url.toExternalForm() : baseURI));
    3.40  			logger.debug("[Strabon.storeURL] Context  : {}", ((context == null) ? "null" : context));
    3.41  			logger.debug("[Strabon.storeURL] Format   : {}", ((format == null) ? "null" : format));
    3.42  		}
    3.43  
    3.44  		InputStream in = (InputStream) url.openStream();
    3.45  		InputStreamReader reader = new InputStreamReader(in);
    3.46 +		if(baseURI == null)
    3.47 +		{
    3.48 +			baseURI = url.toExternalForm();
    3.49 +		}
    3.50 +		
    3.51 +		if(format.equals(RDFFormat.NQUADS))
    3.52 +		{
    3.53 +			NQuadsTranslator translator = new NQuadsTranslator();
    3.54 +		//	 final ByteArrayInputStream bais = new ByteArrayInputStream(i);
    3.55 +			Collection<Statement> statements = translator.translate(in, baseURI);
    3.56 +			Iterator iterator = statements.iterator();
    3.57 +			for(Statement st: statements)
    3.58 +			{
    3.59 +				//edw prepei na mpei sunartisi pou na metasximatizei to context an einai temporal
    3.60 +				con1.add(st.getSubject(), st.getPredicate(), st.getObject(), st.getContext());
    3.61 +				System.out.println("STATEMENT: "+st.toString());
    3.62 +				System.out.println("CONTEXT: "+st.getObject().toString());
    3.63 +				return; //there is no point continuing in this method. Or maybe there is for geosparql reasoning
    3.64 +			}
    3.65 +		}
    3.66  
    3.67  		RDFParser parser = Rio.createParser(format);
    3.68  
    3.69 @@ -402,6 +429,8 @@
    3.70  		logger.info("[Strabon.storeString] Format   : " + ((format == null) ? "null" : format.toString()));
    3.71  
    3.72  		StringReader reader = new StringReader(text);
    3.73 +		
    3.74 +		
    3.75  
    3.76  		RDFParser parser = Rio.createParser(format);
    3.77  
     4.1 --- a/runtime/src/main/resources/log4j.properties	Fri Oct 12 16:06:32 2012 +0300
     4.2 +++ b/runtime/src/main/resources/log4j.properties	Tue Oct 16 15:47:04 2012 +0300
     4.3 @@ -1,5 +1,5 @@
     4.4  # logger level values: OFF, ERROR, WARN, INFO, DEBUG, ALL
     4.5 -log4j.rootLogger=INFO, CA
     4.6 +log4j.rootLogger=ALL, CA
     4.7  #log4j.rootLogger=DEBUG, CA
     4.8  #log4j.rootLogger=INFO, CA, FA
     4.9  
     5.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/GeneralTests.java	Fri Oct 12 16:06:32 2012 +0300
     5.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/GeneralTests.java	Tue Oct 16 15:47:04 2012 +0300
     5.3 @@ -55,7 +55,7 @@
     5.4  			"rdfs:label ?placename ; "+	
     5.5  			"geo:geometry ?placegeo ; "+
     5.6  			"a ?type. "+
     5.7 -			"FILTER(strdf:anyInteract(strdf:union(?placegeo,?placegeo),?placegeo)) "+
     5.8 +			"FILTER(strdf:mbbOverlaps(strdf:union(?placegeo,?placegeo),?placegeo)) "+
     5.9  			"}";
    5.10  
    5.11  	protected String query2 = 
     6.1 --- a/runtime/src/test/resources/databases.properties	Fri Oct 12 16:06:32 2012 +0300
     6.2 +++ b/runtime/src/test/resources/databases.properties	Tue Oct 16 15:47:04 2012 +0300
     6.3 @@ -2,7 +2,7 @@
     6.4  postgis.databaseName = strabon-test
     6.5  postgis.serverName = localhost
     6.6  postgis.username = postgres
     6.7 -postgis.password = postgres
     6.8 +postgis.password = p1r3as
     6.9  postgis.port = 5432
    6.10  		
    6.11  ! MonetDB