Search in sources :

Example 11 with TemporalInstantRfc3339

use of org.apache.rya.indexing.TemporalInstantRfc3339 in project incubator-rya by apache.

the class GeoTemporalProviderTest method twoPatternsOneFilter_test.

@Test
public void twoPatternsOneFilter_test() throws Exception {
    final ValueFactory vf = new ValueFactoryImpl();
    final Value geo = vf.createLiteral("Point(0 0)", GeoConstants.XMLSCHEMA_OGC_WKT);
    final Value temp = vf.createLiteral(new TemporalInstantRfc3339(2015, 12, 30, 12, 00, 0).toString());
    final URI tempPred = vf.createURI(URI_PROPERTY_AT_TIME);
    final String query = "PREFIX geo: <http://www.opengis.net/ont/geosparql#>" + "PREFIX geos: <http://www.opengis.net/def/function/geosparql/>" + "PREFIX time: <tag:rya-rdf.org,2015:temporal#>" + "SELECT * WHERE { " + "?subj <" + tempPred + "> ?time ." + "?subj <" + GeoConstants.GEO_AS_WKT + "> ?loc . " + " FILTER(geos:sfContains(?loc, " + geo + ")) . " + "}";
    final QuerySegment<EventQueryNode> node = getQueryNode(query);
    final List<EventQueryNode> nodes = provider.getExternalSets(node);
    assertEquals(0, nodes.size());
}
Also used : ValueFactoryImpl(org.openrdf.model.impl.ValueFactoryImpl) Value(org.openrdf.model.Value) TemporalInstantRfc3339(org.apache.rya.indexing.TemporalInstantRfc3339) ValueFactory(org.openrdf.model.ValueFactory) EventQueryNode(org.apache.rya.indexing.geotemporal.model.EventQueryNode) URI(org.openrdf.model.URI) Test(org.junit.Test)

Example 12 with TemporalInstantRfc3339

use of org.apache.rya.indexing.TemporalInstantRfc3339 in project incubator-rya by apache.

the class GeoTemporalProviderTest method twoSubjOneFilter_test.

@Test
public void twoSubjOneFilter_test() throws Exception {
    final ValueFactory vf = new ValueFactoryImpl();
    final Value geo = vf.createLiteral("Point(0 0)", GeoConstants.XMLSCHEMA_OGC_WKT);
    final Value temp = vf.createLiteral(new TemporalInstantRfc3339(2015, 12, 30, 12, 00, 0).toString());
    final URI tempPred = vf.createURI(URI_PROPERTY_AT_TIME);
    final String query = "PREFIX geo: <http://www.opengis.net/ont/geosparql#>" + "PREFIX geos: <http://www.opengis.net/def/function/geosparql/>" + "PREFIX time: <tag:rya-rdf.org,2015:temporal#>" + "SELECT * WHERE { " + "?subj <" + tempPred + "> ?time ." + "?subj <" + GeoConstants.GEO_AS_WKT + "> ?loc . " + "?subj2 <" + tempPred + "> ?time2 ." + "?subj2 <" + GeoConstants.GEO_AS_WKT + "> ?loc2 . " + " FILTER(geos:sfContains(?loc, " + geo + ")) . " + " FILTER(time:equals(?time, " + temp + ")) . " + "}";
    final QuerySegment<EventQueryNode> node = getQueryNode(query);
    final List<EventQueryNode> nodes = provider.getExternalSets(node);
    assertEquals(1, nodes.size());
}
Also used : ValueFactoryImpl(org.openrdf.model.impl.ValueFactoryImpl) Value(org.openrdf.model.Value) TemporalInstantRfc3339(org.apache.rya.indexing.TemporalInstantRfc3339) ValueFactory(org.openrdf.model.ValueFactory) EventQueryNode(org.apache.rya.indexing.geotemporal.model.EventQueryNode) URI(org.openrdf.model.URI) Test(org.junit.Test)

Example 13 with TemporalInstantRfc3339

use of org.apache.rya.indexing.TemporalInstantRfc3339 in project incubator-rya by apache.

the class GeoTemporalProviderTest method twoSubjectMultiFilter_test.

@Test
public void twoSubjectMultiFilter_test() throws Exception {
    final ValueFactory vf = new ValueFactoryImpl();
    final Value geo = vf.createLiteral("Point(0 0)", GeoConstants.XMLSCHEMA_OGC_WKT);
    final Value temp = vf.createLiteral(new TemporalInstantRfc3339(2015, 12, 30, 12, 00, 0).toString());
    final URI tempPred = vf.createURI(URI_PROPERTY_AT_TIME);
    final String query = "PREFIX geo: <http://www.opengis.net/ont/geosparql#>" + "PREFIX geos: <http://www.opengis.net/def/function/geosparql/>" + "PREFIX time: <tag:rya-rdf.org,2015:temporal#>" + "SELECT * WHERE { " + "?subj <" + tempPred + "> ?time ." + "?subj <" + GeoConstants.GEO_AS_WKT + "> ?loc . " + " FILTER(geos:sfContains(?loc, " + geo + ")) . " + " FILTER(time:equals(?time, " + temp + ")) . " + " FILTER(geos:sfWithin(?loc, " + geo + ")) . " + " FILTER(time:before(?time, " + temp + ")) . " + "}";
    final QuerySegment<EventQueryNode> node = getQueryNode(query);
    final List<EventQueryNode> nodes = provider.getExternalSets(node);
    assertEquals(1, nodes.size());
}
Also used : ValueFactoryImpl(org.openrdf.model.impl.ValueFactoryImpl) Value(org.openrdf.model.Value) TemporalInstantRfc3339(org.apache.rya.indexing.TemporalInstantRfc3339) ValueFactory(org.openrdf.model.ValueFactory) EventQueryNode(org.apache.rya.indexing.geotemporal.model.EventQueryNode) URI(org.openrdf.model.URI) Test(org.junit.Test)

Example 14 with TemporalInstantRfc3339

use of org.apache.rya.indexing.TemporalInstantRfc3339 in project incubator-rya by apache.

the class GeoTemporalProviderTest method onePatternTwoFilters_test.

@Test
public void onePatternTwoFilters_test() throws Exception {
    final ValueFactory vf = new ValueFactoryImpl();
    final Value geo = vf.createLiteral("Point(0 0)", GeoConstants.XMLSCHEMA_OGC_WKT);
    final Value temp = vf.createLiteral(new TemporalInstantRfc3339(2015, 12, 30, 12, 00, 0).toString());
    final URI tempPred = vf.createURI(URI_PROPERTY_AT_TIME);
    final String query = "PREFIX geo: <http://www.opengis.net/ont/geosparql#>" + "PREFIX geos: <http://www.opengis.net/def/function/geosparql/>" + "PREFIX time: <tag:rya-rdf.org,2015:temporal#>" + "SELECT * WHERE { " + "?subj <" + tempPred + "> ?time ." + " FILTER(geos:sfContains(?loc, " + geo + ")) . " + " FILTER(time:equals(?time, " + temp + ")) . " + "}";
    final QuerySegment<EventQueryNode> node = getQueryNode(query);
    final List<EventQueryNode> nodes = provider.getExternalSets(node);
    assertEquals(0, nodes.size());
}
Also used : ValueFactoryImpl(org.openrdf.model.impl.ValueFactoryImpl) Value(org.openrdf.model.Value) TemporalInstantRfc3339(org.apache.rya.indexing.TemporalInstantRfc3339) ValueFactory(org.openrdf.model.ValueFactory) EventQueryNode(org.apache.rya.indexing.geotemporal.model.EventQueryNode) URI(org.openrdf.model.URI) Test(org.junit.Test)

Example 15 with TemporalInstantRfc3339

use of org.apache.rya.indexing.TemporalInstantRfc3339 in project incubator-rya by apache.

the class MongoGeoTemporalIndexIT method addStatements.

private void addStatements(final SailRepositoryConnection conn) throws Exception {
    URI subject = VF.createURI("urn:event1");
    final URI predicate = VF.createURI(URI_PROPERTY_AT_TIME);
    Value object = VF.createLiteral(new TemporalInstantRfc3339(2015, 12, 30, 12, 00, 0).toString());
    conn.add(VF.createStatement(subject, predicate, object));
    object = VF.createLiteral("Point(0 0)", GeoConstants.XMLSCHEMA_OGC_WKT);
    conn.add(VF.createStatement(subject, GeoConstants.GEO_AS_WKT, object));
    subject = VF.createURI("urn:event2");
    object = VF.createLiteral(new TemporalInstantRfc3339(2015, 12, 30, 12, 00, 0).toString());
    conn.add(VF.createStatement(subject, predicate, object));
    object = VF.createLiteral("Point(1 1)", GeoConstants.XMLSCHEMA_OGC_WKT);
    conn.add(VF.createStatement(subject, GeoConstants.GEO_AS_WKT, object));
}
Also used : Value(org.openrdf.model.Value) TemporalInstantRfc3339(org.apache.rya.indexing.TemporalInstantRfc3339) URI(org.openrdf.model.URI) RyaURI(org.apache.rya.api.domain.RyaURI)

Aggregations

TemporalInstantRfc3339 (org.apache.rya.indexing.TemporalInstantRfc3339)34 Test (org.junit.Test)26 TemporalInstant (org.apache.rya.indexing.TemporalInstant)21 RyaURI (org.apache.rya.api.domain.RyaURI)15 Geometry (com.vividsolutions.jts.geom.Geometry)13 Coordinate (com.vividsolutions.jts.geom.Coordinate)12 TemporalInterval (org.apache.rya.indexing.TemporalInterval)12 EventStorage (org.apache.rya.indexing.geotemporal.storage.EventStorage)11 URI (org.openrdf.model.URI)11 Event (org.apache.rya.indexing.geotemporal.model.Event)9 Value (org.openrdf.model.Value)9 ValueFactory (org.openrdf.model.ValueFactory)9 ValueFactoryImpl (org.openrdf.model.impl.ValueFactoryImpl)9 EventQueryNode (org.apache.rya.indexing.geotemporal.model.EventQueryNode)7 DateTime (org.joda.time.DateTime)5 MongoEventStorage (org.apache.rya.indexing.geotemporal.mongo.MongoEventStorage)4 BindingSet (org.openrdf.query.BindingSet)4 QueryEvaluationException (org.openrdf.query.QueryEvaluationException)4 MapBindingSet (org.openrdf.query.impl.MapBindingSet)4 IOException (java.io.IOException)3