Template talk:RCDB

Latest comment: 6 years ago by Certes in topic Numeric page check

Numeric page check

edit

@Elisfkc: A quick question about the {{#ifexist:{{{1}}}|... enhancement. Is this checking for a WP article with a numeric title? I'm looking at {{RCDB|26|Colossus}} at the bottom of Twisted Colossus. That's looking for 26, which exists but has nothing to do with rollercoasters. Due to a bug in Wikimedia, checking for its existence also causes the page to appear in Special:WhatLinksHere/26, which can confuse editors doing disambiguation. Certes (talk) 12:27, 16 November 2017 (UTC)Reply

@Certes: What it is looking for is if the number (in this case 26) matches the number for the article's wikidata entry for the RCID property. If that is not working correctly, feel free to change it. --Elisfkc (talk) 02:20, 17 November 2017 (UTC)Reply
@Elisfkc: Is the template deliberately checking whether Wikipedia has a page of this (numeric) name, or does it just want to check whether the number has been filled in (in Wikidata or in the template parameter)? Perhaps all the #ifexist: conditions should be changed to #if: instead. Certes (talk) 18:07, 17 November 2017 (UTC)Reply
@Certes: It is supposed to be checking if the number has been filled in on the article's wikidata entry. --Elisfkc (talk) 16:38, 18 November 2017 (UTC)Reply

Tl;dr: I've found the problem but I can see no solution with the current Wikidata interface.

I think the template has two issues which hide themselves by neatly cancelling each other out in most cases.

  1. When Wikidata has an id, we try to use it in preference to template parameter 1. This is great when referring to the coaster described on the page, but not when referring to another coaster. For example, Medusa Steel Coaster#External links links two different coasters to 640.htm, because the Wikidata id property linked to the article is 640. The id parameter in {{RCDB|11664|Medusa Steel Coaster}} is ignored. (The Wikidata link may be wrong, as the coaster described in the article has id 11664, but let's ignore that for now.)
  2. As well as checking whether Wikidata has an id, we check whether there is a Wikipedia page with that numeric name. In the previous example, there is a page 640 (about the year AD 640), so everything behaves as described above. However, in Twisted Colossus#External links we have {{RCDB|26|Colossus}} describing a previous version of the coaster. The Wikidata id property for the article is 12282. However, there is as yet no article about the year 12282. So the id isn't detected, and we "correctly" link to 26.htm.

I managed to solve the second problem but can't release that change, as it only serves to unmask the first problem and make it worse.

We may be able to solve both problems together, but only if the spec is clear. A few questions:

  1. Is template parameter 1 (the id) really mandatory? I'm guessing that (for the coaster the article's about) it will become optional once Wikidata is in place.
  2. If we have both a template parameter 1 and a conflicting Wikdata id, which do we use? I think it has to be the parameter, so we can refer to a different coaster.

I've currently hit a brick wall in that the changes in {{RCDB/sandbox}} are not testable: it is difficult to get a Wikidata property for a page other than the one you're on, and you're not on that page when viewing the {{RCDB/testcases}} template. Also, beware that #property can return a comma-separated list of multiple ids rather than just one. After a great deal of searching I have found workarounds to either of these problems, but not both simultaneously. We may have to wait until the Wikidata interface is developed into a more usable form. Certes (talk) 19:22, 18 November 2017 (UTC)Reply

Here's a list of articles which link to multiple RCDB entries (at least one of must have an id not matching the main result from Wikidata):

- Certes (talk) 20:02, 18 November 2017 (UTC)Reply

@Certes: Honestly, if we could have something where the template is just checking to see if there is RCDB number on wikidata and make sure that there is a number on the article (like what was there before I started this), that would be good enough. While the original goal was to make this template act like {{coord}} (in that it would draw from Wikidata if no data is listed for it on the article), I am fine dropping that idea now. I am just trying to flag all of the pages that don't have an RCDB number on wikidata, so that I can put their RCDB number on there. Elisfkc (talk) 16:15, 20 November 2017 (UTC)Reply
Thanks for the clarification. I've had a go at that in the sandbox. This version never uses the id retrieved from Wikidata in the URL and doesn't even check that it matches parameter 1; it just adds the page to the naughty category if there is no id in Wikidata. Is that what's required for now? Certes (talk) 16:39, 20 November 2017 (UTC)Reply
@Certes: I think that's ok, but it should check for something to be in parameter 1 (there are a few pages that I added the template to before that pull from Wikidata and don't have their number on the article, so removing the pulling element will break the template. Just need to know which ones these are.) Also, if you know how to turn off the wikidata check for certain pages, that would be helpful too, as some pages, like the sandbox for the template, are currently in the category. Elisfkc (talk) 16:59, 20 November 2017 (UTC)Reply
I've added the property as a second choice when parameter 1 is blank. Also I've limited the category inclusion to main namespace. (The templates still show up in the category; I'm hoping that is temporary until an update job next runs.) Certes (talk) 18:07, 20 November 2017 (UTC)Reply
@Certes: Did you update the actual template? Because I don't see that in the history. Elisfkc (talk) 18:29, 20 November 2017 (UTC)Reply
No, just the {{RCDB/sandbox}} for now, in case what I did isn't what was required. Certes (talk) 19:15, 20 November 2017 (UTC)Reply
I've boldly updated the template. Twisted Colossus no longer links to 26! I've done some basic checks but if you spot anything, please let me know or just revert. Certes (talk) 17:20, 16 February 2018 (UTC)Reply