use of org.apache.jena.geosparql.implementation.index.QueryRewriteIndex in project jena by apache.
the class GenericPropertyFunctionTest method testQueryRewrite_feature_geometry.
/**
* Test of queryRewrite method, of class GenericPropertyFunction.
*/
@Test
public void testQueryRewrite_feature_geometry() {
Graph graph = model.getGraph();
Node subject = FEATURE_A.asNode();
Node predicate = Geo.SF_CONTAINS_NODE;
Node object = GEOMETRY_B.asNode();
GenericPropertyFunction instance = new SfContainsPF();
QueryRewriteIndex queryRewriteIndex = QueryRewriteIndex.createDefault();
Boolean expResult = true;
Boolean result = instance.queryRewrite(graph, subject, predicate, object, queryRewriteIndex);
assertEquals(expResult, result);
}
use of org.apache.jena.geosparql.implementation.index.QueryRewriteIndex in project jena by apache.
the class GenericPropertyFunctionTest method testQueryRewrite_geometry_geometry_asserted.
/**
* Test of queryRewrite method, of class GenericPropertyFunction.
*/
@Test
public void testQueryRewrite_geometry_geometry_asserted() {
Graph graph = model.getGraph();
Node subject = GEOMETRY_A.asNode();
Node predicate = Geo.SF_CONTAINS_NODE;
Node object = GEOMETRY_F.asNode();
GenericPropertyFunction instance = new SfContainsPF();
QueryRewriteIndex queryRewriteIndex = QueryRewriteIndex.createDefault();
Boolean expResult = true;
Boolean result = instance.queryRewrite(graph, subject, predicate, object, queryRewriteIndex);
assertEquals(expResult, result);
}
use of org.apache.jena.geosparql.implementation.index.QueryRewriteIndex in project jena by apache.
the class GenericPropertyFunction method bothBound.
private QueryIterator bothBound(Binding binding, Node subject, Node predicate, Node object, ExecutionContext execCxt) {
Graph graph = execCxt.getActiveGraph();
QueryRewriteIndex queryRewriteIndex = QueryRewriteIndex.retrieve(execCxt);
Boolean isPositiveResult = queryRewrite(graph, subject, predicate, object, queryRewriteIndex);
if (isPositiveResult) {
// Filter function test succeded so retain binding.
return QueryIterSingleton.create(binding, execCxt);
} else {
// Filter function test failed so null result.
return QueryIterNullIterator.create(execCxt);
}
}
use of org.apache.jena.geosparql.implementation.index.QueryRewriteIndex in project jena by apache.
the class GenericPropertyFunctionTest method testQueryRewrite_geometry_feature_false.
/**
* Test of queryRewrite method, of class GenericPropertyFunction.
*/
@Test
public void testQueryRewrite_geometry_feature_false() {
Graph graph = model.getGraph();
Node subject = GEOMETRY_A.asNode();
Node predicate = Geo.SF_CONTAINS_NODE;
Node object = FEATURE_D.asNode();
GenericPropertyFunction instance = new SfContainsPF();
QueryRewriteIndex queryRewriteIndex = QueryRewriteIndex.createDefault();
Boolean expResult = false;
Boolean result = instance.queryRewrite(graph, subject, predicate, object, queryRewriteIndex);
assertEquals(expResult, result);
}
use of org.apache.jena.geosparql.implementation.index.QueryRewriteIndex in project jena by apache.
the class GenericPropertyFunctionTest method testQueryRewrite_feature_feature_false.
/**
* Test of queryRewrite method, of class GenericPropertyFunction.
*/
@Test
public void testQueryRewrite_feature_feature_false() {
Graph graph = model.getGraph();
Node subject = FEATURE_A.asNode();
Node predicate = Geo.SF_CONTAINS_NODE;
Node object = FEATURE_D.asNode();
GenericPropertyFunction instance = new SfContainsPF();
QueryRewriteIndex queryRewriteIndex = QueryRewriteIndex.createDefault();
Boolean expResult = false;
Boolean result = instance.queryRewrite(graph, subject, predicate, object, queryRewriteIndex);
assertEquals(expResult, result);
}
Aggregations