Is it possible in Datalog Racket to import and use a knowledge base defined in a file x declared as "#lang datalog" into another file y declared as "#lang racket"?
ex:
;; x.rkt
#lang datalog
parent(john, douglas).
;; y.rkt
#lang racket
(require datalog)
(require "x.rkt")
;;(datalog parent (? (X douglas))) DOES NOT WORK
The exported theory from #lang datalog
is always named theory
, so your y.rkt
should be:
#lang racket
(require datalog
"x.rkt")
(datalog theory (? (parent X douglas)))
Note that we are querying the parent
table, so we need to specify it as (? (parent X douglas))
. (? (X douglas))
is incorrect.
Lastly, if you wish to rename the exported theory from x.rkt
, you can use rename-in
:
#lang racket
(require datalog
(rename-in "x.rkt" [theory my-thy]))
(datalog my-thy (? (parent X douglas)))