use of org.apache.jena.query.QuerySolution in project jena by apache.
the class SouthPFTest method testExecEvaluated.
/**
* Test of execEvaluated method, of class SouthPF.
*/
@Test
public void testExecEvaluated() {
Dataset dataset = SpatialIndexTestData.createTestDataset();
String query = "PREFIX spatial: <http://jena.apache.org/spatial#>\n" + "\n" + "SELECT ?subj\n" + "WHERE{\n" + " ?subj spatial:south(48.857487 2.373047) .\n" + "}ORDER by ?subj";
List<Resource> result = new ArrayList<>();
try (QueryExecution qe = QueryExecutionFactory.create(query, dataset)) {
ResultSet rs = qe.execSelect();
while (rs.hasNext()) {
QuerySolution qs = rs.nextSolution();
Resource feature = qs.getResource("subj");
result.add(feature);
}
}
List<Resource> expResult = Arrays.asList(SpatialIndexTestData.AUCKLAND_FEATURE, SpatialIndexTestData.HONOLULU_FEATURE, SpatialIndexTestData.NEW_YORK_FEATURE, SpatialIndexTestData.PERTH_FEATURE);
assertEquals(expResult, result);
}
use of org.apache.jena.query.QuerySolution in project jena by apache.
the class WestPFTest method testExecEvaluated.
/**
* Test of execEvaluated method, of class WestPF.
*/
@Test
public void testExecEvaluated() {
Dataset dataset = SpatialIndexTestData.createTestDataset();
String query = "PREFIX spatial: <http://jena.apache.org/spatial#>\n" + "\n" + "SELECT ?subj\n" + "WHERE{\n" + " ?subj spatial:west(48.857487 2.373047) .\n" + "}ORDER by ?subj";
List<Resource> result = new ArrayList<>();
try (QueryExecution qe = QueryExecutionFactory.create(query, dataset)) {
ResultSet rs = qe.execSelect();
while (rs.hasNext()) {
QuerySolution qs = rs.nextSolution();
Resource feature = qs.getResource("subj");
result.add(feature);
}
}
List<Resource> expResult = Arrays.asList(SpatialIndexTestData.HONOLULU_FEATURE, SpatialIndexTestData.LONDON_FEATURE, SpatialIndexTestData.NEW_YORK_FEATURE);
assertEquals(expResult, result);
}
use of org.apache.jena.query.QuerySolution in project jena by apache.
the class NearbyPFTest method testExecEvaluated.
/**
* Test of execEvaluated method, of class NearbyPF.
*/
@Test
public void testExecEvaluated() {
Dataset dataset = SpatialIndexTestData.createTestDataset();
String query = "PREFIX spatial: <http://jena.apache.org/spatial#>\n" + "\n" + "SELECT ?subj\n" + "WHERE{\n" + " ?subj spatial:nearby(48.857487 2.373047 350) .\n" + "}ORDER by ?subj";
List<Resource> result = new ArrayList<>();
try (QueryExecution qe = QueryExecutionFactory.create(query, dataset)) {
ResultSet rs = qe.execSelect();
while (rs.hasNext()) {
QuerySolution qs = rs.nextSolution();
Resource feature = qs.getResource("subj");
result.add(feature);
}
}
List<Resource> expResult = Arrays.asList(SpatialIndexTestData.LONDON_FEATURE);
assertEquals(expResult, result);
}
use of org.apache.jena.query.QuerySolution in project jena by apache.
the class IntersectBoxPFTest method testExecEvaluated.
/**
* Test of execEvaluated method, of class IntersectBox.
*/
@Test
public void testExecEvaluated() {
Dataset dataset = SpatialIndexTestData.createTestDataset();
String query = "PREFIX spatial: <http://jena.apache.org/spatial#>\n" + "\n" + "SELECT ?subj\n" + "WHERE{\n" + " ?subj spatial:intersectBox(51.4 -0.13 51.6 -0.12) .\n" + "}ORDER by ?subj";
List<Resource> result = new ArrayList<>();
try (QueryExecution qe = QueryExecutionFactory.create(query, dataset)) {
ResultSet rs = qe.execSelect();
while (rs.hasNext()) {
QuerySolution qs = rs.nextSolution();
Resource feature = qs.getResource("subj");
result.add(feature);
}
}
List<Resource> expResult = Arrays.asList(SpatialIndexTestData.LONDON_FEATURE);
assertEquals(expResult, result);
}
use of org.apache.jena.query.QuerySolution in project jena by apache.
the class WithinBoxPFTest method testExecEvaluated.
/**
* Test of execEvaluated method, of class WithinBoxPF.
*/
@Test
public void testExecEvaluated() {
Dataset dataset = SpatialIndexTestData.createTestDataset();
String query = "PREFIX spatial: <http://jena.apache.org/spatial#>\n" + "\n" + "SELECT ?subj\n" + "WHERE{\n" + " ?subj spatial:withinBox(51.4 -0.13 51.6 -0.12) .\n" + "}ORDER by ?subj";
List<Resource> result = new ArrayList<>();
try (QueryExecution qe = QueryExecutionFactory.create(query, dataset)) {
ResultSet rs = qe.execSelect();
while (rs.hasNext()) {
QuerySolution qs = rs.nextSolution();
Resource feature = qs.getResource("subj");
result.add(feature);
}
}
List<Resource> expResult = Arrays.asList(SpatialIndexTestData.LONDON_FEATURE);
assertEquals(expResult, result);
}
Aggregations