User:Zache/P180fromCategory

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Suggested depicts (P180) values for photos in this category: Turku (Q38511)https://commons.m.wikimedia.org/wiki/Category:Turku#P180=Q38511, municipality of Finland (Q856076)https://commons.m.wikimedia.org/wiki/Category:Turku#P180=Q856076, city (Q515)https://commons.m.wikimedia.org/wiki/Category:Turku#P180=Q515

Documentationview · edit · history · purge ]
This documentation is transcluded from User:Zache/P180fromCategory/doc.

Concept[edit]

The template is designed to try and derive suggested {{Q[P180}} values for images in a category by reading the wikidata items associated with those categories. The derived P180 values can then be used as proposed values for images in the category in a normalized way. Derived values can be used in conjunction with other methods, such as crowdsourcing, machine vision, and machine learning, to improve the accuracy of the final values used in photos.

In the proof-of-concept phase, the template will generate a hidden URL that can be read using SQL or an application programming interface (API).

Errors

In case of incorrect values, the user can try to fix error values by adding a wikidata item to the category and defining instance of (P31) category's main topic (P301), {P|P971}} values or reporting the errors on the talk page.

Usage[edit]

{{User:Zache/P180fromCategory|pagetitle|namespace}}

Parameters[edit]

{{{1|}}}
target pagetitle, default value is current page
{{{2|}}}
target namespace, default value is current namespace if {{{1}}} is not defined. If {{{1}}} is defined then default value is category.

Example[edit]

{{User:Zache/P180fromCategory}}

Without parameters
Suggested depicts (P180) values for photos in this category:
With pagetitle and namespace

{{User:Zache/P180fromCategory|Turku|0}}

Suggested depicts (P180) values for photos in this category: city or town (Q7930989)https://commons.m.wikimedia.org/wiki/0:Turku#P180=Q7930989, Turku (Q38511)https://commons.m.wikimedia.org/wiki/0:Turku#P180=Q38511, municipality of Finland (Q856076)https://commons.m.wikimedia.org/wiki/0:Turku#P180=Q856076, city (Q515)https://commons.m.wikimedia.org/wiki/0:Turku#P180=Q515
With pagetitle

{{User:Zache/P180fromCategory|Turku}}

Suggested depicts (P180) values for photos in this category: Turku (Q38511)https://commons.m.wikimedia.org/wiki/Category:Turku#P180=Q38511, municipality of Finland (Q856076)https://commons.m.wikimedia.org/wiki/Category:Turku#P180=Q856076, city (Q515)https://commons.m.wikimedia.org/wiki/Category:Turku#P180=Q515
Examples in pages

Logic[edit]

Reading data using SQL[edit]

SELECT 
   page_namespace, 
   page_id, 
   el_to 
FROM 
   externallinks, 
   page 
WHERE 
   page_id=el_from 
   AND page_namespace=2
   AND page_title="Zache/P180fromCategory"
   AND el_to LIKE "%#P%=Q%";