Jump to content

User:Robert.Allen/Draft

From Wikipedia, the free encyclopedia

Proposal to improve Wikipedia's ISBN Magic

[edit]
Problems to be addressed
  • Searches of Wikipedia with ISBN-10s do not find the corresponding ISBN-13s and vice-versa.
  • When hyphenated ISBNs wrap at the hyphens (which only occurs in some browsers, e.g., Safari), it makes them more difficult to read and more difficult to select and copy.
  • Hyphens make it more difficult to search for the ISBNs on the Wikipedia with web search engines, e.g. Google or Yahoo, since quoted hyphenated search strings often must be used to find the target ISBNs.
Proposed enhancements

  Modify Wikisoftware so that:

  • Hidden ISBNs are added in the formats which are not displayed: ISBN-10s and ISBN-13s, hyphenated and unhyphenated, which will serve as targets of web search engines regardless of the format used as the search string. (A hidden alternative hyphenated target will only be added when the ISBN in the edit window text contains hyphens.)
  • ISBNs are displayed using "nowrap".
Example 1
  • ISBN 0-8288-2586-6
  • current code: <a href="/wiki/Special:BookSources/0828825866" class="internal mw-magiclink-isbn">ISBN 0-8288-2586-6</a>
  • proposed code: <a href="/wiki/Special:BookSources/0828825866" class="internal mw-magiclink-isbn"><span class="nowrap">0-8288-2586-6</span><span style="display:none">978-0-8288-2586-3 9780828825863 0828825866</span></a>
Example 2
  • ISBN 978-0-8288-2586-3
  • current code: <a href="/wiki/Special:BookSources/9780828825863" class="internal mw-magiclink-isbn">{{ISBN|978-0-8288-2586-3}}</a>
  • proposed code: <a href="/wiki/Special:BookSources/9780828825863" class="internal mw-magiclink-isbn"><span class="nowrap">978-0-8288-2586-3</span><span style="display:none">9780828825863 0-8288-2586-6 0828825866</span></a>
Advantages
  • The solution will be automatic and invisible to editors. The hidden numbers will not appear in the edit window as a source of confusion.
  • Editors can add ISBNs with or without hyphens.
  • Bots can still be used to add hyphens to ISBNs that lack them, thus bringing Wikipedia into conformance with the ISBN standard.
  • Either ISBN-10s or ISBN-13s can be added by editors, since the hidden search targets can be derived from either (except for ISBNs which do not have an ISBN-10).
Disadvantages
  • The hidden ISBNs are not typically found by the local browser page search function.
Questions
  • Will the interconversion of ISBNs and/or formatting have a significant adverse impact on Wikipedia performance?

For a more detailed description of the calculations that would be required see User:Robert.Allen/Draft#ISBN proposal details.

ISBN proposal details

[edit]

Procedure outline

[edit]
  • remove any hyphens or spaces from the ISBN
  • determine the length of the ISBN
  • if the length = 10, then derive the ISBN-13 (see below)
    • if the ISBN to be displayed has hyphens or spaces, add the unhyphenated ISBN-10 and the hyphenated and unhyphenated ISBN-13 as hidden search targets
  • if the length = 13, and the first three digits = "978", then derive the ISBN-10 (see below)
    • if the ISBN to be displayed has hyphens or spaces, add the unhyphenated ISBN-13 and the hyphenated and unhyphenated ISBN-10 as a hidden search targets
  • if the ISBN to be displayed lacks hyphens (which presumably will only occur before a bot has added the hyphens)
    • if it has 10 digits, add the unhyphenated ISBN-13 as a hidden search target
    • if it has 13 digits, add the unhyphenated ISBN-10 as a hidden search target
    • Notes:
      • adding hyphens to unhyphenated ISBNs usually requires a web lookup, slowing performance, so using bots is preferable for this step
      • this is an additional reason why the displayed form, which appears in the edit window, should eventually be a hyphenated ISBN, since this allows the Wikisoftware to easily add all three alternative formats

Converting ISBN-10 to ISBN-13

[edit]

This ISBN-10

can be converted to an ISBN-13 using the following steps:

  • remove the final check digit
  • add the "978-" prefix
  • calculate the new check digit using this algorithm:

The calculation of an ISBN-13 check digit begins with the first 12 digits of the thirteen-digit ISBN (thus excluding the check digit itself). Each digit, from left to right, is alternately multiplied by 1 or 3, then those products are summed modulo 10 to give a value ranging from 0 to 9. Subtracted from 10, that leaves a result from 1 to 10. A zero (0) replaces a ten (10), so, in all cases, a single check digit results.

s = 9×1 + 7×3 + 8×1 + 0×3 + 8×1 + 2×3 + 8×1 + 8×3 + 2×1 + 5×3 + 8×1 + 6×3
  =   9 +  21 +   8 +   0 +   8 +   6 +   8 +  24 +   2 +  15 +   8 +  18
  = 127
127 / 10 = 12 remainder 7
10 –  7 = 3
  • if the result is 10, the check digit is 0
  • add the new check digit to the final position
  • the hidden ISBN search targets are:
978-0-8288-2586-3
9780828825863
0828825866

Converting ISBN-13 to ISBN-10

[edit]

This ISBN-13:

can be converted to an ISBN-10 using the following steps:

  • check for the 978 prefix
  • if the 978 prefix does not exist, an ISBN-10 does not exist and cannot be added
  • remove the "978-" prefix
  • remove the final check digit
  • calculate the new check digit using this algorithm:

Each of the first nine digits of the ten-digit ISBN — excluding the check digit, itself — is multiplied by a number in a sequence from 10 to 2, and the remainder of the sum, with respect to 11, is computed. The check digit is 11 minus the remainder.

s = 0x10 + 8x9 + 2x8 + 8x7 + 8x6 + 2x5 + 5x4 + 8x3 + 6x2
  =    0 +  72 +  16 +  56 +  48 +  10 +  20 +  24 +  12
  = 258
258 / 11 = 23 remainder 5
11 - 5 = 6
  • if the result is 10, the check digit is "X"
  • add the new check digit to the final position
  • the hidden ISBN search targets are:
0-8288-2586-6
0828825866
9780828825863