http://franz.com/ns/allegrograph/3.0/geospatial/fn/haversineKilometers

Returns the distance between the two points in kilometers, according to the Haversine formula.

For example:

prefix geofn: <http://franz.com/ns/allegrograph/3.0/geospatial/fn/>  
select ?distance \{  
  bind(geofn:toPointLonLat(<http://ex#bar>, 56.0, 42.0) as ?p1 )  
  bind(geofn:toPointLonLat(<http://ex#bar>, 57.0, 42.5) as ?p2 )  
  bind(geofn:haversineKilometers(?p1, ?p2) as ?distance)  
\} 

p1 and p2 must both be bound to geospatial UPIs.

Notes

The following namespace abbreviations are used:

The SPARQL magic properties reference has additional information on using AllegroGraph magic properties and functions.