jackrusher / mundaneum

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

Academy Award/Nobel Prize query returns [] #1

Closed daveliepmann closed 7 years ago

daveliepmann commented 7 years ago

From core.clj line 57:

(query
 '[:select :distinct ?pLabel
   :where [[?p (wdt :award-received) / (wdt :subclass-of) * (entity "Nobel Prize")
            _  (wdt :award-received) / (wdt :subclass-of) * (entity "Academy Awards")]]])
=> []

stringify-query of that returns "".

jackrusher commented 7 years ago

For me stringify-query returns:

(mundaneum.query/stringify-query
 '[:select :distinct ?pLabel
   :where [[?p (wdt :award-received) / (wdt :subclass-of) * (entity "Nobel Prize")
            _ (wdt :award-received) / (wdt :subclass-of) * (entity "Academy Awards")]]])
=> "SELECT DISTINCT  ?pLabel \nWHERE {\n ?p  wdt:P166 /  wdt:P279 *  wd:Q7191 ;  wdt:P166 /  wdt:P279 *  wd:Q19020 .\n SERVICE wikibase:label { bd:serviceParam wikibase:language \"en,de,fr,es,it,ca,nl\" . }\n}"

... but the query itself returns []. I imagine this represents a data change on their end. Will investigate.

daveliepmann commented 7 years ago

Talk page of P166 suggests that it's due to change from subclass-of to instance-of; testing confirms it. Note substitution of "instance" for "subclass":

  (query
   '[:select :distinct ?pLabel
     :where [[?p (wdt :award-received) / (wdt :instance-of) * (entity "Nobel Prize")
               _ (wdt :award-received) / (wdt :instance-of) * (entity "Academy Awards")]]])
=>  [{:pLabel "Bob Dylan"} {:pLabel "George Bernard Shaw"}]

I don't understand why it works for you.

jackrusher commented 7 years ago

The query returns [] for me too! The change to :instance-of happened after I wrote this demo code. :)

daveliepmann commented 7 years ago

Oops, conflated the "fragile af" stringify-query difference with the return values