Search in sources :

Example 1 with QueryRewriteIndex

use of org.apache.jena.geosparql.implementation.index.QueryRewriteIndex in project jena by apache.

the class GenericPropertyFunctionTest method testQueryRewrite_geometry_feature.

/**
 * Test of queryRewrite method, of class GenericPropertyFunction.
 */
@Test
public void testQueryRewrite_geometry_feature() {
    Graph graph = model.getGraph();
    Node subject = GEOMETRY_A.asNode();
    Node predicate = Geo.SF_CONTAINS_NODE;
    Node object = FEATURE_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);
}
Also used : Graph(org.apache.jena.graph.Graph) QueryRewriteIndex(org.apache.jena.geosparql.implementation.index.QueryRewriteIndex) Node(org.apache.jena.graph.Node) SfContainsPF(org.apache.jena.geosparql.geo.topological.property_functions.simple_features.SfContainsPF) Test(org.junit.Test)

Example 2 with QueryRewriteIndex

use of org.apache.jena.geosparql.implementation.index.QueryRewriteIndex in project jena by apache.

the class GenericPropertyFunctionTest method testQueryRewrite_geometry_geometry.

/**
 * Test of queryRewrite method, of class GenericPropertyFunction.
 */
@Test
public void testQueryRewrite_geometry_geometry() {
    Graph graph = model.getGraph();
    Node subject = GEOMETRY_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);
}
Also used : Graph(org.apache.jena.graph.Graph) QueryRewriteIndex(org.apache.jena.geosparql.implementation.index.QueryRewriteIndex) Node(org.apache.jena.graph.Node) SfContainsPF(org.apache.jena.geosparql.geo.topological.property_functions.simple_features.SfContainsPF) Test(org.junit.Test)

Example 3 with QueryRewriteIndex

use of org.apache.jena.geosparql.implementation.index.QueryRewriteIndex in project jena by apache.

the class GenericPropertyFunctionTest method testQueryRewrite_geometry_feature_disabled.

/**
 * Test of queryRewrite method, of class GenericPropertyFunction.
 */
@Test
public void testQueryRewrite_geometry_feature_disabled() {
    GeoSPARQLConfig.setup(IndexOption.MEMORY, Boolean.FALSE);
    Graph graph = model.getGraph();
    Node subject = GEOMETRY_A.asNode();
    Node predicate = Geo.SF_CONTAINS_NODE;
    Node object = FEATURE_B.asNode();
    GenericPropertyFunction instance = new SfContainsPF();
    QueryRewriteIndex queryRewriteIndex = QueryRewriteIndex.createDefault();
    Boolean expResult = false;
    Boolean result = instance.queryRewrite(graph, subject, predicate, object, queryRewriteIndex);
    GeoSPARQLConfig.setup(IndexOption.MEMORY, Boolean.TRUE);
    assertEquals(expResult, result);
}
Also used : Graph(org.apache.jena.graph.Graph) QueryRewriteIndex(org.apache.jena.geosparql.implementation.index.QueryRewriteIndex) Node(org.apache.jena.graph.Node) SfContainsPF(org.apache.jena.geosparql.geo.topological.property_functions.simple_features.SfContainsPF) Test(org.junit.Test)

Example 4 with QueryRewriteIndex

use of org.apache.jena.geosparql.implementation.index.QueryRewriteIndex in project jena by apache.

the class GenericPropertyFunctionTest method testQueryRewrite_geometry_geometry_blank.

/**
 * Test of queryRewrite method, of class GenericPropertyFunction.
 */
@Test
public void testQueryRewrite_geometry_geometry_blank() {
    Graph graph = model.getGraph();
    Node subject = GEOMETRY_A.asNode();
    Node predicate = Geo.SF_CONTAINS_NODE;
    Node object = GEOMETRY_C_BLANK.asNode();
    GenericPropertyFunction instance = new SfContainsPF();
    QueryRewriteIndex queryRewriteIndex = QueryRewriteIndex.createDefault();
    Boolean expResult = true;
    Boolean result = instance.queryRewrite(graph, subject, predicate, object, queryRewriteIndex);
    assertEquals(expResult, result);
}
Also used : Graph(org.apache.jena.graph.Graph) QueryRewriteIndex(org.apache.jena.geosparql.implementation.index.QueryRewriteIndex) Node(org.apache.jena.graph.Node) SfContainsPF(org.apache.jena.geosparql.geo.topological.property_functions.simple_features.SfContainsPF) Test(org.junit.Test)

Example 5 with QueryRewriteIndex

use of org.apache.jena.geosparql.implementation.index.QueryRewriteIndex in project jena by apache.

the class GenericPropertyFunctionTest method testQueryRewrite_geometry_geometry_asserted_disabled.

/**
 * Test of queryRewrite method, of class GenericPropertyFunction.
 */
@Test
public void testQueryRewrite_geometry_geometry_asserted_disabled() {
    GeoSPARQLConfig.setup(IndexOption.MEMORY, Boolean.FALSE);
    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);
    GeoSPARQLConfig.setup(IndexOption.MEMORY, Boolean.TRUE);
    assertEquals(expResult, result);
}
Also used : Graph(org.apache.jena.graph.Graph) QueryRewriteIndex(org.apache.jena.geosparql.implementation.index.QueryRewriteIndex) Node(org.apache.jena.graph.Node) SfContainsPF(org.apache.jena.geosparql.geo.topological.property_functions.simple_features.SfContainsPF) Test(org.junit.Test)

Aggregations

QueryRewriteIndex (org.apache.jena.geosparql.implementation.index.QueryRewriteIndex)16 Graph (org.apache.jena.graph.Graph)16 Node (org.apache.jena.graph.Node)15 Test (org.junit.Test)15 SfContainsPF (org.apache.jena.geosparql.geo.topological.property_functions.simple_features.SfContainsPF)13 SfDisjointPF (org.apache.jena.geosparql.geo.topological.property_functions.simple_features.SfDisjointPF)2