X <http://franz.com/ns/allegrograph/5.0/geo/nd/fn#haversineLatLonLoc>
( lat lon loc &rest rest )
Returns the haversine distance between <lat
, lon
> and the location specified by the nD encoded literal loc
. lat
and lon
must be bound to numeric values, and the datatype encoding of loc
must have one :latitude and one :longitude type ordinate.
For example:
PREFIX ndfn: <http://franz.com/ns/allegrograph/5.0/geo/nd/fn#>
PREFIX ex: <http://ex.com/>
PREFIX : <http://franz.com/ns/keyword#>
SELECT ?distance {
ex:WashingtonMonument ex:location ?loc .
bind(ndfn:haversineLatLonLoc(38.889, -77.035, ?loc, :miles) as ?distance)
}
An optional fourth argument may be
Notes
The following namespace abbreviations are used:
- fti - <http://franz.com/ns/allegrograph/2.2/textindex/>
- geo - <http://franz.com/ns/allegrograph/3.0/geospatial/>
- geofn - <http://franz.com/ns/allegrograph/3.0/geospatial/fn/>
- nd - <http://franz.com/ns/allegrograph/5.0/geo/nd#>
- ndfn - <http://franz.com/ns/allegrograph/5.0/geo/nd/fn#>
- sna - <http://franz.com/ns/allegrograph/4.11/sna/>
The SPARQL magic properties reference has additional information on using AllegroGraph magic properties and functions.