Property talk:P8

From OpenStreetMap Wiki
Jump to navigation Jump to search

Usage in JOSM

JOSM started using this property for its Tag2Link functionality in 2020-01 (15806). –Simon04 (talk) 20:26, 15 February 2020 (UTC)

Value formatter

Hi all, hi User:Yurik, is there a way to specify a value formatter. For instance, the P8 for Item:Q604 requires its values to be formatted as 16 digit numbers with leading zero inserted. Can this be represented using a qualifier (value formatter = %016d)? See this JOSM ticket: (talk) 20:31, 15 February 2020 (UTC)

I don’t think it can be done downstream (except with some JavaScript hack), as PropertyInfoSnakUrlExpander.php doesn’t contain any customization methods. However, doing it upstream would be IMO also for Wikidata’s benefit (this may be a strong argument for upstream developers), as several external identifiers on Wikidata currently have to be piped through Wikimedia Toolforge for proper URL formatting, which can probably avoided for some with a simple printf-style format string. Maybe the most straightforward way would be simply allowing printf-style format parameters in the URL itself (while keeping support for $1) instead of adding another qualifier. —Tacsipacsi (talk) 21:17, 15 February 2020 (UTC)
Hi Tacsipacsi, thanks your your detailed response and analysis. For the OSM Wiki, the value formatter support in PropertyInfoSnakUrlExpander might be no be needed, since the data items on this wiki are mainly for OSM keys and general OSM values. Thus, there will be few items in this wiki that actually benefit from the formatter URL. However, I see the formatter URL's importance for software and tools dealing with OSM data (such as JOSM, see above). In order to not hard-code those specific value formatters, I'd favour a good representation within OSM wiki Wikibase. Thanks! –Simon04 (talk) 19:15, 17 February 2020 (UTC)
The formatter URL (P8) could use the Wikidata External ID redirector to parse the value with regex.
So it possible to remove spaces i.e. in ref:FR:SIRET=439 975 640 00921 to build this working URL

Example: NGA id formatter URL that break the value i.e. 113-272 into 2 parts to build the following URL parameters ?volume=113&featureNumber=272
--Pyrog (talk) 16:50, 24 October 2020 (UTC)
Agree, I don't think there is a way for the built-in formatter to specify pattern formatting. Moreover, I don't think we should add it unless supported by upstream (Wikibase/Wikidata). On the other hand, we could add extra property qualifier like "minimum digits length". This way OSM wiki can analyze that qualifier and use Lua to format the link accordingly. --Yurik (talk) 17:30, 18 February 2020 (UTC)
The value validation regex (P13) specify the format of a value.
Editors could use it to warn the user.
One could imagine that the API itself use it to clean the value ?
--Pyrog (talk) 16:25, 24 October 2020 (UTC)


I've setup a small osmlab project which extracts the formatter URLs from Wikidata and OSM Wikibase: (talk) 09:29, 6 April 2020 (UTC)