Strabon

changeset 663:c273bdca2caf temporals

made changes to valueTableFactory
author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr>
date Thu Oct 25 12:52:37 2012 +0300 (2012-10-25)
parents e3b9342f0914
children 6b6d2fc83ed7
files generaldb/src/main/java/org/openrdf/sail/generaldb/managers/HashManager.java generaldb/src/main/java/org/openrdf/sail/generaldb/managers/LiteralManager.java generaldb/src/main/java/org/openrdf/sail/generaldb/schema/LiteralTable.java generaldb/src/main/java/org/openrdf/sail/generaldb/schema/PeriodTable.java generaldb/src/main/java/org/openrdf/sail/generaldb/schema/ValueTableFactory.java runtime/src/main/java/eu/earthobservatory/runtime/generaldb/NQuadsTranslator.java runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java
line diff
     1.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/managers/HashManager.java	Wed Oct 24 17:53:16 2012 +0300
     1.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/managers/HashManager.java	Thu Oct 25 12:52:37 2012 +0300
     1.3 @@ -555,7 +555,7 @@
     1.4  		Number id = value.getInternalId();
     1.5  		table.insert(id, idseq.hashOf(value));
     1.6  		if (value instanceof RdbmsLiteral) {
     1.7 -			//System.out.println("Ayto stelnw ston LiteralManager, "+value.toString());
     1.8 +			System.out.println("Ayto stelnw ston LiteralManager, "+value.toString());
     1.9  			literals.insert(id, (RdbmsLiteral)value);
    1.10  		}
    1.11  		else if (value instanceof RdbmsURI) {
     2.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/managers/LiteralManager.java	Wed Oct 24 17:53:16 2012 +0300
     2.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/managers/LiteralManager.java	Thu Oct 25 12:52:37 2012 +0300
     2.3 @@ -118,6 +118,7 @@
     2.4  					 * Will need some other place to add them if this approach does work
     2.5  					 * 
     2.6  					 */
     2.7 +					System.out.println("DATATYPE:"+datatype);
     2.8  					if(XMLGSDatatypeUtil.isWKTDatatype(datatype)) //WKT case
     2.9  					{
    2.10  						table.insertWKT(id, label, dt, null, null);
    2.11 @@ -132,6 +133,7 @@
    2.12  					}
    2.13  					else if(XMLGSDatatypeUtil.isPeriodDatatype(datatype)) // valid period  case- Constant
    2.14  					{ //TODO remember that the period should be validated, haven't decided the level yet though
    2.15 +						System.out.println("LABEL TO literalTable:"+label);
    2.16  						table.insertTemporal(id, label);
    2.17  					}
    2.18  				}
     3.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/schema/LiteralTable.java	Wed Oct 24 17:53:16 2012 +0300
     3.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/schema/LiteralTable.java	Thu Oct 25 12:52:37 2012 +0300
     3.3 @@ -194,6 +194,7 @@
     3.4  	{
     3.5  
     3.6  		//TODO the label should be validated as a period before reaching this point. Not sure yet on which level this should be done
     3.7 +		System.out.println("LABEL: "+label);
     3.8  		temporalTable.insert(id, label);
     3.9  	}
    3.10  	
    3.11 @@ -304,6 +305,8 @@
    3.12  		bool |= numeric.expunge(condition);
    3.13  		bool |= dateTime.expunge(condition);
    3.14  		bool |= geoSpatialTable.expunge(condition);
    3.15 +		bool |= temporalTable.expunge(condition);
    3.16 +		
    3.17  		return bool;
    3.18  	}
    3.19  	
     4.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/schema/PeriodTable.java	Wed Oct 24 17:53:16 2012 +0300
     4.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/schema/PeriodTable.java	Thu Oct 25 12:52:37 2012 +0300
     4.3 @@ -176,7 +176,7 @@
     4.4  		throws SQLException, InterruptedException, NullPointerException
     4.5  	{
     4.6  
     4.7 -	
     4.8 +		System.out.println("PERIOD:"+period);
     4.9  		ValueBatch batch = getValueBatch();
    4.10  		if (isExpired(batch)) {
    4.11  			batch = newValueBatch();
    4.12 @@ -385,15 +385,15 @@
    4.13  		// timezone representation in GMT and stores them. When retrieved, they are all transformed into the timezone of the running machine
    4.14  		StringBuilder sb = new StringBuilder();
    4.15  		sb.append("  id ").append(sql(idType, -1)).append(" NOT NULL,");
    4.16 -		sb.append("  period ").append("PERIOD").append(" NOT NULL,");
    4.17 +		sb.append("  period ").append("PERIOD").append(" NOT NULL");
    4.18  	
    4.19  		table.createTable(sb);
    4.20  		
    4.21 -		String extension = ((GeneralDBSqlTable)table).buildGeometryCollumn();
    4.22 +		/*String extension = ((GeneralDBSqlTable)table).buildGeometryCollumn();
    4.23  		table.execute(extension);
    4.24  		
    4.25  		String index = ((GeneralDBSqlTable)table).buildIndexOnGeometryCollumn();
    4.26 -		table.execute(index);
    4.27 +		table.execute(index);*/
    4.28  	}
    4.29  
    4.30  	/**
     5.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/schema/ValueTableFactory.java	Wed Oct 24 17:53:16 2012 +0300
     5.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/schema/ValueTableFactory.java	Thu Oct 25 12:52:37 2012 +0300
     5.3 @@ -130,6 +130,11 @@
     5.4  		//TODO
     5.5  		GeoValueTable myAddition = createGeoValueTable(conn,queue,"geo_values",VARCHAR,VCL);
     5.6  		literals.setGeoSpatialTable(myAddition);
     5.7 +		/****************************************************************/
     5.8 +		//TODO
     5.9 +		PeriodTable temporals = createPeriodTable(conn,queue,"period_values",VARCHAR,VCL);
    5.10 +		literals.setGeoSpatialTable(myAddition);
    5.11 +		
    5.12  		return literals;
    5.13  	}
    5.14  
    5.15 @@ -187,10 +192,47 @@
    5.16  		return table;
    5.17  	}
    5.18  	
    5.19 +	
    5.20  	protected GeoValueTable newGeoValueTable() {
    5.21  		return new GeoValueTable();
    5.22  	}
    5.23  	
    5.24 +	protected PeriodTable createPeriodTable(Connection conn, BlockingQueue<Batch> queue, String name,
    5.25 +			int sqlType, int length)
    5.26 +		throws SQLException
    5.27 +	{
    5.28 +		//System.out.println("Create GeoValueTable!!");
    5.29 +		PeriodTable table = newPeriodTable();
    5.30 +		
    5.31 +		table.setRdbmsTable(createTable(conn, name));
    5.32 +	
    5.33 +		if (!sequenced) {
    5.34 +			table.setTemporaryTable(factory.createTemporaryTable(conn, "INSERT_" + name));
    5.35 +		}
    5.36 +		
    5.37 +		initPeriodTable(table, queue, sqlType, length, INDEX_VALUES);
    5.38 +		
    5.39 +		return table;
    5.40 +	}
    5.41 +	
    5.42 +	
    5.43 +	private void initPeriodTable(PeriodTable table, BlockingQueue<Batch> queue, int sqlType, int length,
    5.44 +			boolean indexValues)
    5.45 +		throws SQLException
    5.46 +	{
    5.47 +		table.setQueue(queue);
    5.48 +		table.setSqlType(sqlType);
    5.49 +		table.setIdType(ids.getJdbcIdType());
    5.50 +		table.setLength(length);
    5.51 +		table.setIndexingValues(indexValues);
    5.52 +		table.initialize();
    5.53 +	}
    5.54 +	/***********************************************************************************************************/
    5.55 +
    5.56 +	protected PeriodTable newPeriodTable() {
    5.57 +		return new PeriodTable();
    5.58 +	}
    5.59 +	
    5.60  	private void initGeoValueTable(GeoValueTable table, BlockingQueue<Batch> queue, int sqlType, int length,
    5.61  			boolean indexValues)
    5.62  		throws SQLException
    5.63 @@ -203,6 +245,7 @@
    5.64  		table.initialize();
    5.65  	}
    5.66  	/***********************************************************************************************************/
    5.67 +	
    5.68  	protected HashTable newHashtable(ValueTable table) {
    5.69  		return new HashTable(table);
    5.70  	}
     6.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/NQuadsTranslator.java	Wed Oct 24 17:53:16 2012 +0300
     6.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/NQuadsTranslator.java	Thu Oct 25 12:52:37 2012 +0300
     6.3 @@ -5,7 +5,7 @@
     6.4  import java.io.InputStreamReader;
     6.5  import java.util.Collection;
     6.6  
     6.7 -import org.junit.Assert;
     6.8 +
     6.9  import org.openrdf.model.Statement;
    6.10  import org.openrdf.rio.RDFHandlerException;
    6.11  import org.openrdf.rio.RDFParseException;
     7.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java	Wed Oct 24 17:53:16 2012 +0300
     7.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java	Thu Oct 25 12:52:37 2012 +0300
     7.3 @@ -53,6 +53,7 @@
     7.4  
     7.5  import eu.earthobservatory.utils.RDFHandlerFactory;
     7.6  
     7.7 +
     7.8  public abstract class Strabon {
     7.9  
    7.10  	private static Logger logger = LoggerFactory.getLogger(eu.earthobservatory.runtime.generaldb.Strabon.class);