Strabon

changeset 951:ef699a403d15 temporals

completed the implementation of the new "periodIntersects" function that is mapped to the "overlaps" funtion of Postgres Temporal. Added respective test.
author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr>
date Fri Mar 29 18:34:02 2013 +0200 (2013-03-29)
parents b473371456f0
children 800120faf87f
files generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java runtime/src/test/java/eu/earthobservatory/runtime/postgres/temporals/TemporalRelationTests.java
line diff
     1.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java	Fri Mar 29 18:11:22 2013 +0200
     1.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java	Fri Mar 29 18:34:02 2013 +0200
     1.3 @@ -64,6 +64,7 @@
     1.4  import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.relation.OverrightPeriodFunc;
     1.5  import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.relation.PeriodContainedByFunc;
     1.6  import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.relation.PeriodContainsFunc;
     1.7 +import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.relation.PeriodIntersectsFunc;
     1.8  import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.relation.TemporalConstants;
     1.9  import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.relation.TemporalRelationFunc;
    1.10  import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.relation.finishesFunc;
    1.11 @@ -1137,6 +1138,10 @@
    1.12  		{
    1.13  			return periodOverlaps(leftArg, rightArg);
    1.14  		}
    1.15 +		else if(function instanceof PeriodIntersectsFunc)
    1.16 +		{
    1.17 +			return periodIntersects(leftArg, rightArg);
    1.18 +		}
    1.19  		else if(function instanceof MeetsFunc)
    1.20  		{
    1.21  			return meets(leftArg, rightArg);
     2.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/postgres/temporals/TemporalRelationTests.java	Fri Mar 29 18:11:22 2013 +0200
     2.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/postgres/temporals/TemporalRelationTests.java	Fri Mar 29 18:34:02 2013 +0200
     2.3 @@ -329,25 +329,26 @@
     2.4  			"WHERE { "+
     2.5  				"?x1 ?y1 ?z1 ?t1 . "+
     2.6  				"?x2 ?y2 ?z2 ?t2 . "+
     2.7 -				"FILTER(strdf:PeriodIntersects(?t1, ?t2) && str(?x1) != str(?x2))."+
     2.8 +				"FILTER(strdf:PeriodIntersects(?t1, ?t2) && str(?x1) < str(?x2))."+
     2.9  				"}";
    2.10  		
    2.11  		ArrayList<String> bindings = (ArrayList<String>) strabon.query(strabon.queryRewriting(query),strabon.getSailRepoConnection());
    2.12  	
    2.13 -		//assertEquals(6, bindings.size());
    2.14 +		assertEquals(7, bindings.size());
    2.15  		//assertTrue(-1 < bindings.indexOf(""));
    2.16 -		for(String result: bindings)
    2.17 +		/*for(String result: bindings)
    2.18  		{
    2.19  			System.out.println(result.toString());
    2.20 -		}
    2.21 +		}*/
    2.22  		
    2.23 -		/*assertTrue(-1 < bindings.indexOf("[x2=http://example.org/item7;x1=http://example.org/item3]"));
    2.24 +		assertTrue(-1 < bindings.indexOf("[x2=http://example.org/item7;x1=http://example.org/item3]"));
    2.25  		assertTrue(-1 < bindings.indexOf("[x2=http://example.org/item7;x1=http://example.org/item1]"));
    2.26  		assertTrue(-1 < bindings.indexOf("[x2=http://example.org/item3;x1=http://example.org/item2]"));
    2.27 -		assertTrue(-1 < bindings.indexOf("[x2=http://example.org/item1;x1=http://example.org/item2]"));
    2.28 +		assertTrue(-1 < bindings.indexOf("[x2=http://example.org/item3;x1=http://example.org/item1]"));
    2.29 +		assertTrue(-1 < bindings.indexOf("[x2=http://example.org/item2;x1=http://example.org/item1]"));
    2.30  		assertTrue(-1 < bindings.indexOf("[x2=http://example.org/item7;x1=http://example.org/item2]"));
    2.31  		assertTrue(-1 < bindings.indexOf("[x2=http://example.org/item8;x1=http://example.org/item2]"));
    2.32 -		*/
    2.33 +		
    2.34  	}
    2.35  	
    2.36  	@Test