jackrusher / mundaneum

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

Enhancement Suggestion: add a Values clause #13

Closed zachcp closed 2 years ago

zachcp commented 5 years ago

Jack,

It would be nice to be able to pass in multiple values to a query. It seems you have provided one example of how to do it, but I wonder if it would be worth adding aVALUES option - here is an example although I realize this gets in to symbol resolution which you seem to have been used only explicitly within template calls.

zach cp

SELECT  ?compoundLabel 
WHERE {

 ?compound  wdt:P235 ?inchi .
 VALUES ?inchi {"QFJCIRLUMZQUOT-HPLJOQBZSA-N" 
                "MTCJZZBQNCXKAP-KSYZLYKTSA-N" 
                "YNCMLFHHXWETLD-UHFFFAOYSA-N" }
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . }
}
(def inchikeys
    {"QFJCIRLUMZQUOT-HPLJOQBZSA-N" 
     "MTCJZZBQNCXKAP-KSYZLYKTSA-N" 
     "YNCMLFHHXWETLD-UHFFFAOYSA-N" }

(query
    '[:select ?compoundLabel
      :where [[?compound (wdt :InChIKey) ?inchi]]
      :values ?inchi inchikeys])
jackrusher commented 5 years ago

Good idea! This should be a pretty easy contrib if you want to give it a try?

zachcp commented 5 years ago

sure!

jackrusher commented 2 years ago

Solved by move to Flint.