use of org.wikidata.query.rdf.common.WikibasePoint in project wikidata-query-rdf by wikimedia.
the class CoordinatePartBOp method get.
@Override
public IV get(IBindingSet bindingSet) {
final IV coord = getAndCheckLiteral(0, bindingSet);
final WikibasePoint point = pointFromIV(coord);
final BigdataValue result;
switch(part()) {
case GLOBE:
String globe = point.getGlobe();
if (globe == null) {
result = getValueFactory().createLiteral("");
} else {
result = getValueFactory().createURI(point.getGlobe());
}
break;
case LON:
result = getValueFactory().createLiteral(Double.parseDouble(point.getLongitude()));
break;
case LAT:
result = getValueFactory().createLiteral(Double.parseDouble(point.getLatitude()));
break;
default:
throw new IllegalArgumentException("Unknown part specified");
}
return super.asIV(result, bindingSet);
}
Aggregations