Wikidata talk:Database reports/Administrative territorial entity

Version 1 edit

(copy from User_talk:Ladsgroup to document development of the list) Related to Wikidata:Administrative territorial entity#Subclasses:

For all subclasses could you create a table with columns

  • Item // e.g. province or territory of Canada (Q2879)
  • country (P17), if any // e.g. Canada (Q16)
  • English label split at " of ", first part // e.g. province or territory
  • Count direct // e.g. claim[31:2879] = 0
  • Count all // e.g. claim[31:(tree[2879][][279])] = 13
  • Direct instance with the lowest Q-number // e.g. Quebec (Q176) (Note: this would not be in the same row as the above examples, since it is not a direct instance)

Save this table to Wikidata:Administrative territorial entity/List of subclasses Tamawashi (talk) 14:54, 5 July 2014 (UTC)Reply

OK, tomorrow you will have it. Amir (talk) 17:05, 5 July 2014 (UTC)Reply

I made it (it's not complete because It will be huge if I would go on). some changes are needed. for example what do you think about splitting it up to several pages? Amir (talk) 23:08, 5 July 2014 (UTC)Reply

Version 2 edit

Splitting the table:

Could you also make some changes to table layout:

  • turn the values in the country column into direct links having the English label, e.g. [[Q16|Canada]], to reduce script errors in the page
  • make the table sortable [1]
  • split the column Label into three to allow sorting:
    • English label (first part)
    • English label (split)
      • first occurrence of one of: " in the ", " of the ", " in ", " of "
    • English label (second part)
    • If no split term is found, then put all into first part.
  • change column label "Example" to "Direct instance with lowest Q-number"
  • sort the entries by Q-number, so in edit history (diff) one will better see changes
  • add a column Q-number in front so one can return to the initial sort order
  • less important: link the count values to autolist2, and pass the underlying WDQ

Tamawashi (talk) 06:04, 6 July 2014 (UTC)Reply

It is possible even though not very easy. Just some issues: in sortable tables Q1000 comes before Q2, What do you want to do? using Template:Q is better i18n for example see this page in German language [2] I don't know which one is better in this case(link or template) and I think breaking down the list the way you said (by splitting into two: with ISO and without ISO) won't solve anything. Amir (talk) 20:19, 6 July 2014 (UTC)Reply

@Ladsgroup: Splitting has disadvantages anyway and if splitting in two tables doesn't remove the script errors, then for now I would prefer to have one table for all subclasses and go without i18n. Compare:
Sorting works if only the plain number is used. So I would say replace all Q-templates with [[Q<Q-number>|<English label>]]. i18n with dynamic rendering would be an extra task, maybe even by programming a page in Lua and obtaining all required data dynamically. It would also be helpful to have counts of the subclasses, if one sorts descending by "#s (all)" the root item would be on top.
!# -- row number for tracking added or removed subclasses
!Q -- q number for linking and tracking of subclasses, initial sort by that value to see in page history diff which subclasses were added or removed
!en (1) -- first part of the label, for grouping by type
!en (2) -- indicating split value, first occurrence of one of " in the ", " of the ", " in ", " of "
!en (3) -- if splitting was done, third part of label, to see the full label
!Country (Q) -- for grouping by country, Q-number since label might be empty or different Q may have same label
!Country (en) -- for reading by humans
!#s (direct) -- quantity of direct subclasses
!#s (all) -- quantity of all subclasses, descending sort lists root item first
!#i (direct) -- quantity of direct instances
!#i (all) -- quantity of all instances
!i with lowest Q number (en) -- instance with the lowest Q number, label in English
# Q en (1) en (2) en (3) Country (Q) Country (en) #s (direct) #s (all) #i (direct) #i (all) i with lowest Q number (en)
1 532 village - - 134237 232682 Breighton
2 2879 province or territory of Canada 16 Canada 0 13 -
3 5098 province of Indonesia 252 Indonesia 33 33 Aceh

Tamawashi (talk) 10:53, 7 July 2014 (UTC)Reply

I did it (not completely) with some modifications, check it. Amir (talk) 15:03, 7 July 2014 (UTC)Reply

@Ladsgroup: The label splitting as described above and subclass counts would be really helpful. Most items that have subclasses will have no direct instances, if they have one can check why. And label splitting allows grouping by class name (district/province/department) and then sorting by any other column. This is not possible with the normal label. Tamawashi (talk) 15:32, 7 July 2014 (UTC)Reply

@Tamawashi: I made some changes. about splitting the title, I think it's useless because either you want the country of type of subdivision, type of subdivision can be obtained via the title itself (because It starts with the subdivision type) or the country, which we already split them. Splitting them just makes extra columns. Amir (talk) 22:39, 7 July 2014 (UTC)Reply

@Ladsgroup: - The class label could be in the form "district of Baku", the information that the class belongs to Baku does not exist in other columns. Some of the class labels also are -inconsistently- in plural "districts of Someplace". Both information can only be derived from that label. Tamawashi (talk) 07:20, 8 July 2014 (UTC)Reply

@Tamawashi: ok. This is the prototype. It'll be finished very soon Wikidata:Administrative territorial entity/List of subclasses/sandAmir (talk) 13:29, 8 July 2014 (UTC)Reply

@Ladsgroup: - it almost duplicates the English labels, which just makes the page larger and adds no information, beside the split string. But the split string should be present, because it may need editing, the meaning of "in"/"of" is either the same or not. If it is the same, then one term should be used, if not, then tracking is needed. Tamawashi (talk) 04:58, 9 July 2014 (UTC)Reply

Version 3 edit

<!-- This section can be copied from the wikitable-code into pre-tags and helps to keep columns and documentation that is visible on the page to stay in sync  -->
<!-- using [[Template:Q]] for every item in the list would lead to script errors, therefore use English labels -->
!# <!-- row number for tracking added or removed subclasses -->
<!-- values from item page -->
!i/Q <!-- Q-number for linking and tracking of subclasses, initial sort by that value to see in page history diff which subclasses were added or removed -->
<!-- BEGIN:English label -->
!i/en (1) <!-- first part of the label, for grouping by type, split at first occurrence of an element from array(" in the ", " of the ", " in ", " of ") -->
!i/en (2) <!-- split value, if any. The meaning of "in"/"of" is either the same or not. 
 If it is the same, then it improves readability if on term is used. 
 If it is not the same, then tracking is needed --> 
!i/en (3) <!-- if splitting was done, third part of label, to see the full label -->
<!-- END:English label -->
!i/[[Property:P17|P17]] (Q) <!-- for grouping by country, Q-number since different Q may have same label ; [[P17]]/<Q-number>-->
!i/[[Property:P17|P17]] (en) <!-- for reading by humans ; [[P17]]/en label -->
<!-- values from referring page(s) -->
!r/[[Property:P279|P279]] (Qty direct) <!-- quantity of direct subclasses ; wdy=claim[279:<Q-number>] -->
!r/[[Property:P279|P279]] (Qty all) <!-- quantity of all subclasses, descending sort lists root item first ; wdy=claim[279:(tree[<Q-number>][][279])] -->
!r/[[Property:P31|P31]] (Qty direct) <!-- quantity of direct instances ; wdy=claim[31:<Q-number>] -->
!r/[[Property:P31|P31]] (Qty all) <!-- quantity of all instances ; wdy=claim[31:(tree[<Q-number>][][279])] -->
!r/[[Property:P31|P31]] with lowest Q number (en) <!-- instance with the lowest Q, label in English, 
if no label exists the text says "(no label for Q<number>)" ; wdy=claim[31:(tree[<Q-number>][][279])]/<Q-number>+en label -->
# i/Q i/en (1) i/en (2) i/en (3) i/P17 (Q) i/P17 (en) r/P279 (Qty direct) r/P279 (Qty all) r/P31 (Qty direct) r/P31 (Qty all) r/P31 with lowest Q number (en)
1 532 village - - 134237 232682 Breighton
2 2879 province or territory of Canada 16 Canada 0 13 -
3 5098 province of Indonesia 252 Indonesia 33 33 Aceh

Tamawashi (talk) 10:45, 8 July 2014 (UTC)Reply

Return to the project page "Database reports/Administrative territorial entity".