Wikipedia:Reference desk/Archives/Computing/2020 February 29

Computing desk
< February 28 << Jan | February | Mar >> Current desk >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


February 29

edit

Short descriptions, Wikidata, and SQL/SPARQL

edit

Hi, I would like to know how to search for items on Wikidata with descriptions longer than, say, 150 characters; I've noticed that the very long ones tend to be unsuitable for use as short descriptions on Wikipedia. (example example) I've tried writing something based on the quarry query for descriptions of length 1, but had absolutely no success. (My knowledge of SQL is very minimal.) I would be grateful for any assistance or pointers. Cheers, gnu57 15:34, 29 February 2020 (UTC)[reply]

Doesn't LENGTH(term_text) > 150 work? 2602:24A:DE47:B270:A096:24F4:F986:C62A (talk) 00:49, 1 March 2020 (UTC)[reply]
I tried that a while ago; when I submit the query, it runs for a long time and eventually times out without completing. Cheers, gnu57 01:04, 1 March 2020 (UTC)[reply]
There is probably no index on the term length, i.e. it's doing a linear scan. Your options: 1) create index or ask someone to create one (it will be even slower than the linear scan, but will allow future such queries to run fast); 2) get your timeout increased or get someone with higher limits to run the query for you; or 3) download the db to your own machine and run the queries on your own db instance. The last is the best if you want to muck with the data a lot, but of course it's more work and takes resources (your own machine or VM, basically). 173.228.123.39 (talk) 00:56, 2 March 2020 (UTC)[reply]