use of org.wikidata.query.rdf.blazegraph.inline.literal.WKTSerializer in project wikidata-query-rdf by wikimedia.
the class GeoService method getGlobeNode.
/**
* Create globe node with appropriate value for coordSystem.
*/
protected TermNode getGlobeNode(BigdataValueFactory vf, ServiceParams serviceParams) {
final TermNode globeNode = serviceParams.get(GLOBE_PARAM, null);
if (globeNode == null) {
return new DummyConstantNode(vf.createLiteral(WKTSerializer.NO_GLOBE));
}
if (!globeNode.isConstant()) {
// FIXME: add support for this
throw new IllegalArgumentException("Non-constant globe value is not supported yet.");
}
BigdataValue v = globeNode.getValue();
if (v instanceof BigdataURI) {
WKTSerializer ser = new WKTSerializer();
try {
return new DummyConstantNode(vf.createLiteral(ser.trimCoordURI(v.stringValue())));
} catch (GeoSpatialSearchException e) {
// Unexpectedly wrong URI - still pass it along
return globeNode;
}
}
return globeNode;
}
Aggregations