Module talk:PropertyChain

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

Prototype

[edit]

Copied from Commons_talk:Batch_uploading/Geograph#Reverse_geocoding
Multichill I got a little prototype at Module:PropertyChain:

--Jarekt (talk) 21:51, 9 April 2020 (UTC)[reply]

Really nice. I would like to be able to set a stop condition. In this case when the located in the administrative territorial entity (P131) is the same as country (P17) on the first item.
So I can make {{#invoke:PropertyChain|PropertyChain|qID=Q817840|pID=P131|endpID=P17}} (BennebroekBloemendaalNorth HollandNetherlandsKingdom of the Netherlands) should stop Netherlands (Q55) (and include this item.
Not sure about the visual part if we show it in files like File:Talsarnau Chapel - geograph.org.uk - 6000168.jpg. May just the location with the pencil and than small between () the output of this template?
Multichill (talk) 08:49, 10 April 2020 (UTC)[reply]

Multichill Now the code has 2 stopping criteria: endpID and endqID

--Jarekt (talk) 14:45, 13 April 2020 (UTC)[reply]

@Jarekt: coming back to this one. I would like to add it to {{Geograph from structured data}}.
What do you think the best approach would be? Maybe a helper function in this module so that it grabs location of creation (P1071) and starts form there?
It should probably look like: "Talsarnau (TalsarnauGwyneddWalesUnited Kingdom)". Or any better ideas? Multichill (talk) 16:33, 25 April 2020 (UTC)[reply]
One off wikidata modules should be able to look up a property and return it as a item ID. I will try to see how. --Jarekt (talk) 01:22, 27 April 2020 (UTC)[reply]
Multichill, I think I got this, thanks to user:RexxS's advice again. See File:Talsarnau Chapel - geograph.org.uk - 6000168.jpg or any other file using {{Geograph from structured data}}, and let me know if this is what you had in mind. --Jarekt (talk) 02:04, 27 April 2020 (UTC)[reply]
Just in case you run into the same problems as I did when a town is in a region that is part of two higher level regions, there is code in Module:WikidataIB in the location function (lines 1484 to 1635) that usually resolves it.
The last example at Module talk:WikidataIB/testing #location shows how that works. Cheers --RexxS (talk) 02:33, 27 April 2020 (UTC)[reply]