Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (ns wikidataexplore.core
- (:require [mundaneum.query :refer [describe entity label property query]]
- [backtick :refer [template]]
- [clj-time.format :as tf]))
- ;; Nobel Prizes by recipient's place of birth
- (query
- '[:select ?countryLabel (count ?p :as ?count)
- :where [[?p (wdt :award-received) ?awd]
- [?awd (wdt :instance-of) (entity "Nobel Prize")]
- [?p (wdt :place-of-birth) ?birthplace]
- [?birthplace (wdt :country) ?country]]
- :group-by ?countryLabel
- :order-by (desc ?count)])
- ;; attempting to group-by using both country and award subtype
- (query
- '[:select ?awdLabel ?CountryLabel (count ?p :as ?count)
- :where [[?p (wdt :award-received) ?awd]
- [?awd (wdt :instance-of) (entity "Nobel Prize")]
- [?p (wdt :place-of-birth) ?birthplace]
- [?birthplace (wdt :country) ?country]]
- :group-by ?awdLabel ?countryLabel
- :order-by (desc ?count)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement