use of org.apache.jena.geosparql.implementation.GeometryWrapper in project jena by apache.
the class GenericSpatialBoxPropertyFunctionTest method testExtractObjectArguments_5args_pos4_fail.
/**
* Test of extractObjectArguments method, of class
* GenericSpatialBoxPropertyFunction.
*/
@Test(expected = ExprEvalException.class)
public void testExtractObjectArguments_5args_pos4_fail() {
GenericSpatialBoxPropertyFunction instance = new WithinBoxPF();
Node predicate = NodeFactory.createURI(SpatialExtension.WITHIN_BOX_PROP);
// Geometry and Envelope parameters
float latMin = 0;
float lonMin = 1;
float latMax = 2;
float lonMax = 3;
int limit = 10;
List<Node> objectNodes = Arrays.asList(NodeValue.makeFloat(latMin).asNode(), NodeValue.makeFloat(lonMin).asNode(), NodeValue.makeFloat(latMax).asNode(), NodeValue.makeFloat(lonMax).asNode(), NodeValue.makeString("10").asNode());
PropFuncArg object = new PropFuncArg(objectNodes);
// Function arguments
Literal geometry = ConvertLatLonBox.toLiteral(latMin, lonMin, latMax, lonMax);
GeometryWrapper geometryWrapper = GeometryWrapper.extract(geometry);
SearchEnvelope searchEnvelope = SearchEnvelope.build(geometryWrapper, SpatialIndexTestData.WGS_84_SRS_INFO);
SpatialArguments expResult = new SpatialArguments(limit, geometryWrapper, searchEnvelope);
SpatialArguments result = instance.extractObjectArguments(predicate, object, SpatialIndexTestData.WGS_84_SRS_INFO);
// assertEquals(expResult, result);
}
use of org.apache.jena.geosparql.implementation.GeometryWrapper in project jena by apache.
the class GenericSpatialBoxPropertyFunctionTest method testExtractObjectArguments_4args.
/**
* Test of extractObjectArguments method, of class
* GenericSpatialBoxPropertyFunction.
*/
@Test
public void testExtractObjectArguments_4args() {
GenericSpatialBoxPropertyFunction instance = new WithinBoxPF();
Node predicate = NodeFactory.createURI(SpatialExtension.WITHIN_BOX_PROP);
// Geometry and Envelope parameters
float latMin = 0;
float lonMin = 1;
float latMax = 2;
float lonMax = 3;
int limit = -1;
List<Node> objectNodes = Arrays.asList(NodeValue.makeFloat(latMin).asNode(), NodeValue.makeFloat(lonMin).asNode(), NodeValue.makeFloat(latMax).asNode(), NodeValue.makeFloat(lonMax).asNode());
PropFuncArg object = new PropFuncArg(objectNodes);
// Function arguments
Literal geometry = ConvertLatLonBox.toLiteral(latMin, lonMin, latMax, lonMax);
GeometryWrapper geometryWrapper = GeometryWrapper.extract(geometry);
SearchEnvelope searchEnvelope = SearchEnvelope.build(geometryWrapper, SpatialIndexTestData.WGS_84_SRS_INFO);
SpatialArguments expResult = new SpatialArguments(limit, geometryWrapper, searchEnvelope);
SpatialArguments result = instance.extractObjectArguments(predicate, object, SpatialIndexTestData.WGS_84_SRS_INFO);
assertEquals(expResult, result);
}
use of org.apache.jena.geosparql.implementation.GeometryWrapper in project jena by apache.
the class NearbyFFTest method testRelate_OSGB.
/**
* Test of relate method, of class NearbyFF.
*/
@Test
public void testRelate_OSGB() {
GeometryWrapper geometry1 = GeometryWrapper.extract("<http://www.opengis.net/def/crs/EPSG/0/27700> POINT(0.0 0.0)", WKTDatatype.URI);
GeometryWrapper geometry2 = GeometryWrapper.extract("<http://www.opengis.net/def/crs/EPSG/0/27700> POINT(10000.0 0.0)", WKTDatatype.URI);
;
double radius = 10.1;
String unitsURI = Unit_URI.KILOMETER_URL;
boolean expResult = true;
boolean result = NearbyFF.relate(geometry1, geometry2, radius, unitsURI);
assertEquals(expResult, result);
}
use of org.apache.jena.geosparql.implementation.GeometryWrapper in project jena by apache.
the class NearbyFFTest method testRelate_fail.
/**
* Test of relate method, of class NearbyFF.
*/
@Test
public void testRelate_fail() {
GeometryWrapper geometry1 = GeometryWrapper.extract("<http://www.opengis.net/def/crs/EPSG/0/4326> POINT(10.0 20.0)", WKTDatatype.URI);
GeometryWrapper geometry2 = GeometryWrapper.extract("<http://www.opengis.net/def/crs/EPSG/0/4326> POINT(10.0 30.0)", WKTDatatype.URI);
;
double radius = 5.0;
String unitsURI = Unit_URI.KILOMETER_URL;
boolean expResult = false;
boolean result = NearbyFF.relate(geometry1, geometry2, radius, unitsURI);
assertEquals(expResult, result);
}
use of org.apache.jena.geosparql.implementation.GeometryWrapper in project jena by apache.
the class EqualsFFTest method testRelate_point_point.
@Test
public void testRelate_point_point() throws FactoryException, MismatchedDimensionException, TransformException {
GeometryWrapper subjectGeometryWrapper = GeometryWrapper.extract(ResourceFactory.createTypedLiteral("<http://www.opengis.net/def/crs/EPSG/0/27700> POINT(60 60)", WKTDatatype.INSTANCE));
GeometryWrapper objectGeometryWrapper = GeometryWrapper.extract(ResourceFactory.createTypedLiteral("<http://www.opengis.net/def/crs/EPSG/0/27700> POINT(60 60)", WKTDatatype.INSTANCE));
EqualsFF instance = new EqualsFF();
Boolean expResult = true;
Boolean result = instance.relate(subjectGeometryWrapper, objectGeometryWrapper);
assertEquals(expResult, result);
}
Aggregations