Allegrograph Exploration Requests

I have several triples that represent the locations of several cities. I want to remove a Prolog request, for example

(select (?x ?y ?dist) 
(q- ?x !exns:geolocation ?locx)
(q- ?y !exns:geolocation ?locy)
(geo-distance ?locx ?locy ?dist))

but I get this error:

Server returned 400: attempt to call '#:geo-distance/3' which is an undefined function.

I would like to understand how to use geospatial reasoning methods, such as geo-distance(I suggested that it was built-in because it uses it here . Isn't that so?) In the Prolog request because it is currently a mystery to me, and I did not find good examples for this.

I use the Python API, BTW and in the Python API tutorial they use the method getStatementsto extract triples in a circle of some radius. I want to be able to do such things in a Prolog request and Python API, and not in AllegroCL. I would like to create web applications, and I do not know how to do this in AllegroCL, but I do not know how in Python.

+3
source share
1 answer

Unable to execute Prolog geospatial requests from the Python API. To do this, you need to use the Allegro Common Lisp IDE.

EDIT: Not so!

With AllegroGraph 4.6 you can do it! The problem is that I used AllegroGraph 3.3, so I'm an idiot.

Prolog, API Python AllegroGraph 4.6:

(<-- (geo-distance ?point1 ?point2 ?dist)
      (lisp ?dist (let (lon1 lat1 lon2 lat2)
           (setf (values lon1 lat1) (upi->longitude-latitude ?point1))
           (setf (values lon2 lat2) (upi->longitude-latitude ?point2))
           (haversine-miles lon1 lat1 lon2 lat2))))

!

+1

All Articles