use of com.bigdata.rdf.internal.gis.CoordinateDD in project wikidata-query-rdf by wikimedia.
the class WikibaseDistanceBOp method get.
@Override
public IV get(IBindingSet bindingSet) {
final IV left = getAndCheckLiteral(0, bindingSet);
final IV right = getAndCheckLiteral(1, bindingSet);
final CoordinateDD leftPoint = getCoordinateFromIV(left);
final CoordinateDD rightPoint = getCoordinateFromIV(right);
// TODO: allow to supply Units
final double distance;
if (leftPoint.equals(rightPoint) || veryClose(leftPoint, rightPoint)) {
distance = 0;
} else {
distance = leftPoint.distance(rightPoint, UNITS.Kilometers);
}
final BigdataLiteral dist = getValueFactory().createLiteral(distance);
return super.asIV(dist, bindingSet);
}
Aggregations