Search in sources :

Example 1 with EventQueryNode

use of org.apache.rya.indexing.geotemporal.model.EventQueryNode in project incubator-rya by apache.

the class GeoTemporalProviderTest method twoPatternsTwoFiltersNotValid_test.

@Test
public void twoPatternsTwoFiltersNotValid_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);
    // Only handles geo and temporal filters
    final String query = "PREFIX geo: <http://www.opengis.net/ont/geosparql#>" + "PREFIX geos: <http://www.opengis.net/def/function/geosparql/>" + "PREFIX text: <http://rdf.useekm.com/fts#text>" + "SELECT * WHERE { " + "?subj <" + tempPred + "> ?time ." + "?subj <" + GeoConstants.GEO_AS_WKT + "> ?loc . " + " FILTER(geos:sfContains(?loc, " + geo + ")) . " + " FILTER(text: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 2 with EventQueryNode

use of org.apache.rya.indexing.geotemporal.model.EventQueryNode in project incubator-rya by apache.

the class GeoTemporalProviderTest method twoNode_test.

@Test
public void twoNode_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 + ")) . " + " FILTER(geos:sfContains(?loc2, " + geo + ")) . " + " FILTER(time:equals(?time2, " + temp + ")) . " + "}";
    final QuerySegment<EventQueryNode> node = getQueryNode(query);
    final List<EventQueryNode> nodes = provider.getExternalSets(node);
    assertEquals(2, 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 3 with EventQueryNode

use of org.apache.rya.indexing.geotemporal.model.EventQueryNode in project incubator-rya by apache.

the class GeoTemporalProviderTest method twoPatternsTwoFilters_test.

/*
     * Simplest Happy Path test
     */
@Test
public void twoPatternsTwoFilters_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 + ")) . " + "}";
    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 4 with EventQueryNode

use of org.apache.rya.indexing.geotemporal.model.EventQueryNode 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 5 with EventQueryNode

use of org.apache.rya.indexing.geotemporal.model.EventQueryNode 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)

Aggregations

EventQueryNode (org.apache.rya.indexing.geotemporal.model.EventQueryNode)8 Test (org.junit.Test)8 URI (org.openrdf.model.URI)8 ValueFactory (org.openrdf.model.ValueFactory)8 ValueFactoryImpl (org.openrdf.model.impl.ValueFactoryImpl)8 TemporalInstantRfc3339 (org.apache.rya.indexing.TemporalInstantRfc3339)7 Value (org.openrdf.model.Value)7