Strabon

changeset 830:b3748ac1ad80 temporals

1) forgot to add some files in the previous commit
2) added tha java implementation of the temporal extension functions of stSPARQL
3) added jtemporal jar in pom.xml

Happy New Year :)
author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr>
date Wed Jan 02 13:52:03 2013 +0200 (2013-01-02)
parents 6c14a06b32be
children 734773ad75bb
files evaluation/lib/jtemporal.jar evaluation/pom.xml evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPeriod.java evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/temporal/stsparql/relation/MeetsFunc.java evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/temporal/stsparql/relation/finishesFunc.java evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/temporal/stsparql/relation/startsFunc.java generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/temporal/GeneralDBSqlFinishes.java generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/temporal/GeneralDBSqlMeets.java generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/temporal/GeneralDBSqlStarts.java
line diff
     1.1 Binary file evaluation/lib/jtemporal.jar has changed
     2.1 --- a/evaluation/pom.xml	Fri Dec 21 14:16:24 2012 +0200
     2.2 +++ b/evaluation/pom.xml	Wed Jan 02 13:52:03 2013 +0200
     2.3 @@ -12,7 +12,6 @@
     2.4  	<artifactId>sesame-queryalgebra-evaluation-spatial</artifactId>
     2.5  	<name>OpenRDF Sesame: Query algebra - evaluation -spatial</name>
     2.6  	<description>Spatial Extension Functions - stSPARQL </description>
     2.7 -	<packaging>jar</packaging>
     2.8  
     2.9  	<dependencies>
    2.10  		<dependency>
    2.11 @@ -66,6 +65,13 @@
    2.12  	<groupId>com.sun.xml.bind</groupId>
    2.13  	<artifactId>jaxb-impl</artifactId>
    2.14  </dependency>
    2.15 +		<dependency>
    2.16 +			<groupId>jtemporal</groupId>
    2.17 +			<artifactId>jtemporal</artifactId>
    2.18 +			<version>1.0</version>
    2.19 +			<scope>system</scope>
    2.20 +			<systemPath>${basedir}/lib/jtemporal.jar</systemPath>
    2.21 +		</dependency>
    2.22  	</dependencies>
    2.23  	<modules>
    2.24  	</modules>
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPeriod.java	Wed Jan 02 13:52:03 2013 +0200
     3.3 @@ -0,0 +1,127 @@
     3.4 +package org.openrdf.query.algebra.evaluation.function.spatial;
     3.5 +
     3.6 +
     3.7 +import net.sf.jtemporal.Instant;
     3.8 +import net.sf.jtemporal.Period;
     3.9 +
    3.10 +import org.openrdf.model.Value;
    3.11 +
    3.12 +
    3.13 +/**
    3.14 + * This class provides a java implementation of a set of temporal functinos using the JTemporal library. 
    3.15 + * This implementation is respective to the Postgresql Temporal implementation of these functions
    3.16 + * 
    3.17 + * @author Konstantina Bereta <Konstantina.Brereta@di.uoa.gr>
    3.18 + *
    3.19 + */
    3.20 +public class StrabonPeriod implements Value {
    3.21 +	
    3.22 +	private Period period;
    3.23 +
    3.24 +	public StrabonPeriod()
    3.25 +	{
    3.26 +		this.period = null;
    3.27 +	}
    3.28 +	public StrabonPeriod(Instant start, Instant end)
    3.29 +	{
    3.30 +		this.period = new Period(start, end);
    3.31 +	}
    3.32 +	public Period getPeriod() {
    3.33 +		return period;
    3.34 +	}
    3.35 +	public Instant getStart()
    3.36 +	{
    3.37 +		return period.getStart();
    3.38 +	}
    3.39 +	public Instant getEnd()
    3.40 +	{
    3.41 +		return period.getStart();
    3.42 +	}
    3.43 +	
    3.44 +	public void setPeriod(Period period) {
    3.45 +		this.period = period;
    3.46 +	}
    3.47 +
    3.48 +	@Override
    3.49 +	public String stringValue() 
    3.50 +	{
    3.51 +		// TODO Auto-generated method stub
    3.52 +		return period.toString();
    3.53 +	}
    3.54 +
    3.55 +	public static StrabonPeriod union(StrabonPeriod A, StrabonPeriod B)
    3.56 +	{
    3.57 +		StrabonPeriod period = new StrabonPeriod();
    3.58 +		period.setPeriod( A.getPeriod().union(B.getPeriod()));
    3.59 +		return period;
    3.60 +	}
    3.61 +	public static StrabonPeriod intersection(StrabonPeriod A, StrabonPeriod B)
    3.62 +	{
    3.63 +		StrabonPeriod period = new StrabonPeriod();
    3.64 +		period.setPeriod( A.getPeriod().intersect(B.getPeriod()));
    3.65 +		return period;
    3.66 +	}
    3.67 +	public static StrabonPeriod except(StrabonPeriod A, StrabonPeriod B)
    3.68 +	{
    3.69 +		StrabonPeriod period = new StrabonPeriod();
    3.70 +		period.setPeriod( A.getPeriod().except(B.getPeriod()));
    3.71 +		return period;
    3.72 +	}
    3.73 +	public static StrabonPeriod precedingPeriod(StrabonPeriod A, StrabonPeriod B)
    3.74 +	{
    3.75 +		StrabonPeriod period = new StrabonPeriod();
    3.76 +		period.setPeriod( A.getPeriod().precedingPeriod(B.getPeriod()));
    3.77 +		return period;
    3.78 +	}
    3.79 +	public static StrabonPeriod succedingPeriod(StrabonPeriod A, StrabonPeriod B)
    3.80 +	{
    3.81 +		StrabonPeriod period = new StrabonPeriod();
    3.82 +		period.setPeriod( A.getPeriod().succedingPeriod(B.getPeriod()));
    3.83 +		return period;
    3.84 +	}
    3.85 +	public static int compareTo(StrabonPeriod A, StrabonPeriod B)
    3.86 +	{
    3.87 +		return A.getPeriod().compareTo(B.getPeriod());
    3.88 +	}
    3.89 +	public static boolean contains(StrabonPeriod A, Instant B)
    3.90 +	{
    3.91 +		return A.getPeriod().contains(B);
    3.92 +	}
    3.93 +	public static boolean contains(StrabonPeriod A, StrabonPeriod B)
    3.94 +	{
    3.95 +		return A.getPeriod().contains(B.getPeriod());
    3.96 +	}
    3.97 +	public static boolean equals(StrabonPeriod A, StrabonPeriod B)
    3.98 +	{
    3.99 +		return A.getPeriod().equals(B.getPeriod());
   3.100 +	}
   3.101 +	public static boolean meets(StrabonPeriod A, StrabonPeriod B)
   3.102 +	{
   3.103 +		return A.getPeriod().meets(B.getPeriod());
   3.104 +	}
   3.105 +	public static boolean meetsAfter(StrabonPeriod A, StrabonPeriod B)
   3.106 +	{
   3.107 +		return A.getPeriod().meetsAfter(B.getPeriod());
   3.108 +	}
   3.109 +	public static boolean meetsBefore(StrabonPeriod A, StrabonPeriod B)
   3.110 +	{
   3.111 +		return A.getPeriod().meetsBefore(B.getPeriod());
   3.112 +	}
   3.113 +	public static boolean overlaps(StrabonPeriod A, StrabonPeriod B)
   3.114 +	{
   3.115 +		return A.getPeriod().overlaps(B.getPeriod());
   3.116 +	}
   3.117 +	public static boolean precedes(StrabonPeriod A, Instant B)
   3.118 +	{
   3.119 +		return A.getPeriod().precedes(B);
   3.120 +	}
   3.121 +	public static boolean precedes(StrabonPeriod A, StrabonPeriod B)
   3.122 +	{
   3.123 +		return A.getPeriod().precedes(B.getPeriod());
   3.124 +	}
   3.125 +	public static boolean succedes(StrabonPeriod A, StrabonPeriod B)
   3.126 +	{
   3.127 +		return A.getPeriod().succeeds(B.getPeriod());
   3.128 +	}
   3.129 +	
   3.130 +}
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/temporal/stsparql/relation/MeetsFunc.java	Wed Jan 02 13:52:03 2013 +0200
     4.3 @@ -0,0 +1,13 @@
     4.4 +package org.openrdf.query.algebra.evaluation.function.temporal.stsparql.relation;
     4.5 +
     4.6 +public class MeetsFunc extends TemporalRelationFunc {
     4.7 +	
     4.8 +    
     4.9 +	@Override
    4.10 +	public String getURI() {
    4.11 +	
    4.12 +		return TemporalConstants.meets;
    4.13 +	}
    4.14 +
    4.15 +
    4.16 +}
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/temporal/stsparql/relation/finishesFunc.java	Wed Jan 02 13:52:03 2013 +0200
     5.3 @@ -0,0 +1,13 @@
     5.4 +package org.openrdf.query.algebra.evaluation.function.temporal.stsparql.relation;
     5.5 +
     5.6 +public class finishesFunc extends TemporalRelationFunc {
     5.7 +	
     5.8 +    
     5.9 +	@Override
    5.10 +	public String getURI() {
    5.11 +	
    5.12 +		return TemporalConstants.finishes;
    5.13 +	}
    5.14 +
    5.15 +
    5.16 +}
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/temporal/stsparql/relation/startsFunc.java	Wed Jan 02 13:52:03 2013 +0200
     6.3 @@ -0,0 +1,13 @@
     6.4 +package org.openrdf.query.algebra.evaluation.function.temporal.stsparql.relation;
     6.5 +
     6.6 +public class startsFunc extends TemporalRelationFunc {
     6.7 +	
     6.8 +    
     6.9 +	@Override
    6.10 +	public String getURI() {
    6.11 +	
    6.12 +		return TemporalConstants.starts;
    6.13 +	}
    6.14 +
    6.15 +
    6.16 +}
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/temporal/GeneralDBSqlFinishes.java	Wed Jan 02 13:52:03 2013 +0200
     7.3 @@ -0,0 +1,42 @@
     7.4 +/**
     7.5 + * This Source Code Form is subject to the terms of the Mozilla Public
     7.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     7.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
     7.8 + *
     7.9 + * Copyright (C) 2012, Pyravlos Team
    7.10 + *
    7.11 + * http://www.strabon.di.uoa.gr/
    7.12 + */
    7.13 +package org.openrdf.sail.generaldb.algebra.temporal;
    7.14 +
    7.15 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr;
    7.16 +
    7.17 +/**
    7.18 + * @author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr>
    7.19 + *
    7.20 + */
    7.21 +public class GeneralDBSqlFinishes extends GeneralDBSqlTemporal{
    7.22 +
    7.23 +	public GeneralDBSqlFinishes(GeneralDBSqlExpr left, GeneralDBSqlExpr right) {
    7.24 +		super(left, right);
    7.25 +	}
    7.26 +
    7.27 +	/* (non-Javadoc)
    7.28 +	 * @see org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlTemporal#getOperator()
    7.29 +	 */
    7.30 +	@Override
    7.31 +	public String getOperator() {
    7.32 +		
    7.33 +		return null;
    7.34 +	}
    7.35 +
    7.36 +	/* (non-Javadoc)
    7.37 +	 * @see org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlTemporal#getPostgresFunction()
    7.38 +	 */
    7.39 +	@Override
    7.40 +	public String getPostgresFunction() {
    7.41 +		// TODO Auto-generated method stub
    7.42 +		return "finishes";
    7.43 +	}
    7.44 +
    7.45 +}
    7.46 \ No newline at end of file
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/temporal/GeneralDBSqlMeets.java	Wed Jan 02 13:52:03 2013 +0200
     8.3 @@ -0,0 +1,42 @@
     8.4 +/**
     8.5 + * This Source Code Form is subject to the terms of the Mozilla Public
     8.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     8.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
     8.8 + *
     8.9 + * Copyright (C) 2012, Pyravlos Team
    8.10 + *
    8.11 + * http://www.strabon.di.uoa.gr/
    8.12 + */
    8.13 +package org.openrdf.sail.generaldb.algebra.temporal;
    8.14 +
    8.15 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr;
    8.16 +
    8.17 +/**
    8.18 + * @author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr>
    8.19 + *
    8.20 + */
    8.21 +public class GeneralDBSqlMeets extends GeneralDBSqlTemporal{
    8.22 +
    8.23 +	public GeneralDBSqlMeets(GeneralDBSqlExpr left, GeneralDBSqlExpr right) {
    8.24 +		super(left, right);
    8.25 +	}
    8.26 +
    8.27 +	/* (non-Javadoc)
    8.28 +	 * @see org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlTemporal#getOperator()
    8.29 +	 */
    8.30 +	@Override
    8.31 +	public String getOperator() {
    8.32 +		
    8.33 +		return null;
    8.34 +	}
    8.35 +
    8.36 +	/* (non-Javadoc)
    8.37 +	 * @see org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlTemporal#getPostgresFunction()
    8.38 +	 */
    8.39 +	@Override
    8.40 +	public String getPostgresFunction() {
    8.41 +		// TODO Auto-generated method stub
    8.42 +		return "meets";
    8.43 +	}
    8.44 +
    8.45 +}
    8.46 \ No newline at end of file
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/temporal/GeneralDBSqlStarts.java	Wed Jan 02 13:52:03 2013 +0200
     9.3 @@ -0,0 +1,42 @@
     9.4 +/**
     9.5 + * This Source Code Form is subject to the terms of the Mozilla Public
     9.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     9.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
     9.8 + *
     9.9 + * Copyright (C) 2012, Pyravlos Team
    9.10 + *
    9.11 + * http://www.strabon.di.uoa.gr/
    9.12 + */
    9.13 +package org.openrdf.sail.generaldb.algebra.temporal;
    9.14 +
    9.15 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr;
    9.16 +
    9.17 +/**
    9.18 + * @author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr>
    9.19 + *
    9.20 + */
    9.21 +public class GeneralDBSqlStarts extends GeneralDBSqlTemporal{
    9.22 +
    9.23 +	public GeneralDBSqlStarts(GeneralDBSqlExpr left, GeneralDBSqlExpr right) {
    9.24 +		super(left, right);
    9.25 +	}
    9.26 +
    9.27 +	/* (non-Javadoc)
    9.28 +	 * @see org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlTemporal#getOperator()
    9.29 +	 */
    9.30 +	@Override
    9.31 +	public String getOperator() {
    9.32 +		
    9.33 +		return null;
    9.34 +	}
    9.35 +
    9.36 +	/* (non-Javadoc)
    9.37 +	 * @see org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlTemporal#getPostgresFunction()
    9.38 +	 */
    9.39 +	@Override
    9.40 +	public String getPostgresFunction() {
    9.41 +		// TODO Auto-generated method stub
    9.42 +		return "starts";
    9.43 +	}
    9.44 +
    9.45 +}
    9.46 \ No newline at end of file