Wikidata talk:AutoList/List of queries

From Wikidata
Jump to navigation Jump to search

Categories[edit]

I'd like some category-based example autolist queries. For instance, w:it:Categoria:Nati nel 1901 items without Property:P569 set. --Nemo 15:54, 25 April 2014 (UTC)[reply]

As we can now edit from Autolist, I thought it could be useful to have a more structed page about queries that can be used for maintenance, so I started Wikidata:Periodical cleanup. --Zolo (talk) 20:31, 19 May 2014 (UTC)[reply]

New url[edit]

The url of autolist (autolist1) has changed. I suppose there is a reason to do so, but it has ruined all existing permalinks - even those of "useful lists" in this page. I suggest making redirects to keep all links working - if possible.--Pere prlpz (talk) 15:58, 14 October 2014 (UTC)[reply]

It might have been changed because existing links kept crashing the server. --- Jura 17:17, 14 October 2014 (UTC)[reply]
My permalinks (on my home) are redirected to the new root URL. Might have been added since. --LBE (talk) 21:50, 14 October 2014 (UTC)[reply]


Syntax question[edit]

How can I limit the results of claim[31:202444,31:11879590,31:12308941,31:3409032] and claim[31:4167410,31:101352] on Autolist (currently 7078 given names) to items being used in P:P735?

I tried a version with TREE, but this gave me the items that have P735. --- Jura 13:05, 19 November 2014 (UTC)[reply]

I think that it is not possible directly with the syntax described at [1] for the following reasons:
  • The inverse of the CLAIM command is not available. An approximation, which may return more results than desired, is possible using the TREE command, however:
  • Unlike CLAIM, the TREE command does not support subqueries.
You will therefore need two queries:
  1. Query: claim[735:(claim[31:202444,31:11879590,31:12308941,31:3409032 and claim[31:4167410,31:101352])] &props=735]
    • Ignore the returned item dictionary and look at the props dictionary, which contains the statements (value pairs). Make the list of the values on the right side of each pair (JavaScript should be usable for that) and supply them into the next query.
  2. Query: items[result of the previous step and claim[31:202444,31:11879590,31:12308941,31:3409032] and claim[31:4167410,31:101352]]
Hope that helps, Petr Matas 00:29, 21 November 2014 (UTC)[reply]
BTW, introducing the inverse of given name (P735) should solve your problem as well. Petr Matas 01:00, 21 November 2014 (UTC)[reply]
Thanks for your detailed explanation.
Not sure if the inverse P735 will ever happen. That's what Reasonator is for ;) --- Jura 23:00, 23 November 2014 (UTC)[reply]

Bug?[edit]

Why is it that Query: claim[361:18552670] does not return Bunker Battery Den Hoorn (Q17460014)? Petr Matas 21:54, 20 November 2014 (UTC)[reply]

Order by ?[edit]

Hello, Is it possible to order the results by label ? --Scoopfinder (talk) 21:38, 27 December 2014 (UTC)[reply]

Hello Scoopfinder, I don't think so, but it would be nice if Autolist could do that. Petr Matas 06:57, 29 December 2014 (UTC)[reply]


How to optimize[edit]

How can I get this to run: http://quarry.wmflabs.org/query/2857 ?

I had a version selecting just English labels which took about 6 minutes (max is 10 minutes). --- Jura 22:58, 29 March 2015 (UTC)[reply]

Maybe WHERE pl_from = ... as the first condition. If this doesn't help, start it with FROM pagelinks JOIN wb_terms ON pl_from = ... AND ... WHERE. Matěj Suchánek (talk) 11:52, 30 March 2015 (UTC)[reply]
Thanks for loooking into it. I gave it a try, but it still failed. Finally, I managed to avoid "concat", but adding another table. --- Jura 17:44, 30 March 2015 (UTC)[reply]


Query for official residences of governors[edit]

Sample of an official residence: Indiana Governor's Residence (Q14688448)

I'd like to expand to list to all official residences of governors.

  • All US governors can be found with: claim[279:889821] (autolist)
  • How do I combine the two?

I tried claim[366:481289]{claim[642:(claim[279:889821])]} but this fails. A list of the residences can be found at governors_of_US_states. --- Jura 14:36, 17 August 2015 (UTC)[reply]