jackrusher / mundaneum

A clojure wrapper around WikiData
BSD Zero Clause License
127 stars 16 forks source link

`query` errors unless all vars in it's namespace are loaded unaliased #10

Closed den1k closed 4 years ago

den1k commented 4 years ago

In the REPL, this does not work:

(require '[mundaneum.query :as mq])

(mq/query '[:select ?work ?workLabel
            :where [[?work (wdt :author) (entity "James Joyce")]]
            :limit 10])

;; errors: Unable to resolve symbol: entity in this context

This works:

(require '[mundaneum.query :refer :all])

(query '[:select ?work ?workLabel
         :where [[?work (wdt :author) (entity "James Joyce")]]
         :limit 10])

This is not about the query function but rather the resolution of vars inside the quoted query vector.

jackrusher commented 4 years ago

Ah, it turns out that whether one requires :all or not changes the behavior of eval inside the required namespace (!). Fixed in latest.