Open main menu

Wikidata:Property proposal/Portable Game Notation

Portable Game Notation description of chess gameEdit

Originally proposed at Wikidata:Property proposal/Generic

Descriptionmove of a chess game provided as a string in Portable Game Notation
Data typeString
Template parameterhe:תבנית:pgn
Domainchess game (Q2683596)
ExampleImmortal Game (Q723704) → "e4 e5" / series ordinal (P1545) 1

→ "f4 exf4" / series ordinal (P1545) 2

→ "Bc4 Qh4" / series ordinal (P1545) 3


Following preliminary discussion in hewiki (@קיפודנחש:, @Yoavd:), we would like to create a chess database in Wikidata. The intention is to have a chess game such as Immortal Game (Q723704) with pgn description that include the Movetext - e.g the actual moves of the game as:

1. e4 e5 2. f4 exf4 3. Bc4 Qh4 4. Kf1 b5 5. Bxb5 Nf6 6. Nf3 Qh6 7. d3 Nh5 8. Nh4 Qg5 9. Nf5 c6 10. g4 Nf6 11. Rg1 cxb5 12. h4 Qg6 13. h5 Qg5 14. Qf3 Ng8 15. Bxf4 Qf6 16. Nc3 Bc5 17. Nd5 Qxb2 18. Bd6 Bxg1 19. e5 Qxa1 20. Ke2 Na6 21. Nxg7 Kd8 22. Qf6 Nxf6 23. Be7


  • movetext should follow PGN format
  • the moves SHOULD NOT contain comments (comments are language specific / make the text longer)
  • The PGN text will be used either to feed chess widget (example: Immortal Game; press "expand" to see the chess widget) or feed lua templates to show specific move. (JS: dynamic widget, lua: static image).
  • Assuming each move takes 8-12 chars, a 60 moves game would take ~720 chars which seems to be not too long value.

Eran (talk) 17:58, 11 April 2018 (UTC)


Would the objective be to set up a general chess database, or just to have the data for chess games that have items for other reasons (e.g. existing article)? Some chess databases have many millions of games, and deciding to have an item for each in order to have the pgn description is a big decision. --Yair rand (talk) 19:57, 11 April 2018 (UTC)
This is good question, IMO chess games entities should have some notability - e.g either existing article, or tightly related to existing article (example: game played in context of existing article 42nd Chess Olympiad (Q2109886)). Anyway, whether it is limited to entity of existing articles/related entities or any chess game, pgn property would be useful. Eran (talk) 20:37, 11 April 2018 (UTC)
We can discuss a criteria like - all games that BOTH players are above 2300-2400 ELO. For older games we could choose other criteria (players were among the top 15 players of their time). The idea is to upload about 7-8 million games including correspondence chess games. The main reason not to include comments (and variations) is that they are under copyright and the games are free. --Yoavd (talk) 12:51, 12 April 2018 (UTC)
  •   Support David (talk) 14:48, 12 April 2018 (UTC)
  •   Support I think this makes sense, though I'm not sure the property label here is the right one to indicate this is a description of the item in this notation. Note there is a (I think 400 character?) length limit for strings, would that be a constraint? ArthurPSmith (talk) 19:48, 12 April 2018 (UTC)
    • ArthurPSmith: Thank you, I didn't notice the 400 chars limit previously, but looking in Wikibase code it seems you are right (the default limit is 400). This is still valuable for short games (~400/12=33 moves) or chess openings. Eran (talk) 06:13, 13 April 2018 (UTC)
  • Maybe one string per move with a qualifier for the move number could work?
    --- Jura 15:29, 7 June 2018 (UTC)
@ערן, Yoavd: Jura's suggestion is a good one - we use the qualifier series ordinal (P1545) to sequence many things in wikidata now; this would make extracting the information a little more complicated, but it allows any game to be recorded this way. Here's how I suggest it could look:
Immortal Game (Q723704) → "e4 e5" / series ordinal (P1545) 1
             →  "Rg1 cxb5" / series ordinal (P1545) 11
does this work for you? ArthurPSmith (talk) 18:10, 7 June 2018 (UTC)
Sure! This is the way moves are numbered. Just remember that the number of moves can reach 3 digits. --Yoavd (talk) 09:47, 8 June 2018 (UTC)
Sounds very good idea to have it with qualifier and this elegantly solves the length issues. Eran (talk) 13:53, 8 June 2018 (UTC)

@Yair rand, ArthurPSmith, Jura1, ערן, Yoavd, ديفيد عادل وهبة خليل 2:   Done: Portable Game Notation (P5286). − Pintoch (talk) 09:15, 10 June 2018 (UTC)

Pintoch - Thanks a lot - !! --Yoavd (talk) 11:02, 10 June 2018 (UTC)
Pintoch: thanks! I added an example to Q723704. (working on a script to easily load it to more games) Eran (talk) 17:27, 10 June 2018 (UTC)
  • If we have this, should we also have FEN?
    --- Jura 19:22, 10 June 2018 (UTC)
    • Jura, good point. I think we should also have FEN, which may be useful to describe the starting state. (@קיפודנחש: also mentioned it in hewiki). Eran (talk) 17:24, 11 June 2018 (UTC)