Answers.Body: <blockquote>
  <p>Question: Is there a way I can search this up myself?</p>
  </blockquote>
  <p>Yes. There is a tool called <a href="https://en.wikipedia.org/wiki/Chess_Query_Language" rel="nofollow noreferrer">CQL</a> (Chess Query Language) which allows you to search a PGN file database of games for games that match some set of criteria in the same way that SQL allows you to search a relational database for records which match a set of criteria.</p>
  <p>The <a href="http://www.gadycosteff.com/cql/" rel="nofollow noreferrer">CQL User Guide</a> describes what CQL does, how to <a href="http://www.gadycosteff.com/cql/download.html" rel="nofollow noreferrer">download</a> and install CQL, how to use it and gives <a href="http://www.gadycosteff.com/cql/" rel="nofollow noreferrer">example CQL queries</a> to get you started.</p>
  <p>Tim Krabbe also has a <a href="https://timkr.home.xs4all.nl/chess2/cql.htm" rel="nofollow noreferrer">useful page</a> on his website describing how he has used the tool to find interesting positions and games.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-12-13T23:03:51.113Z
Answers.Text: Just a further note. Of the "Big Two" commercial databases, Chess Assistant supports CQL directly while ChessBase, as of v15, does not (though if you hit the "Advanced" button under  "Search Games" you get to set search parameters that should fit your needs).
Answers.UserDisplayName: Arlen
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-12-13T11:54:33.987Z
Answers.LastActivityDate: 2022-01-01T20:35:03.700Z
Answers.LastEditDate: 2022-01-01T20:35:03.700Z
Answers.UserDisplayName: Brian Towers
Body: <p>I would like to generalise <a href="https://chess.stackexchange.com/questions/13918/what-are-examples-of-grandmaster-games-where-both-black-and-white-castle-opposit">What are examples of grandmaster games where both Black and White castle opposite sides and the queenside players loses?</a></p>
  <p><strong>Question</strong>: Is there a way I can search this up myself?</p>
  <p>Like perhaps in the chessgames, chesstempo, lichess or chessdotcom database or perhaps youtube via <a href="https://my.chessvision.ai/search" rel="nofollow noreferrer">chessvision</a> (You can select the theme 'opposite site castling'), I plug in parameters like</p>
  <ol>
  <li><p>Title/rating parameter: both (or at least 1 of the) players, say, Alice and Bob, obtained the title of GM or have a certain rating (either at the time of the game or later on in life)</p>
  </li>
  <li><p>Some middlegame parameter: Alice castled queenside while Bob castled kingside</p>
  </li>
  <li><p>Winning parameter: Alice lost.</p>
  </li>
  <li><p>Date parameter: games from date t to date t+X</p>
  </li>
  <li><p>Perhaps also some endgame parameter: Like they reached a rook endgame or a bishop vs knight endgame.</p>
  </li>
  </ol>
  <p><strong>Ideal answer</strong>: I'm asking if there's a readily available way to do this. Like someone's already made this kind of thing where we can plug in these themes/parameters.</p>
  <p><strong>Next best thing/s</strong>: Well I suppose there's manually downloading perhaps some grandmaster database and then we write script in python or something that searches O-O vs O-O-O and then use the same way lichess or chessvision identifies 'rook endgame' or 'bishop vs knight endgame'. In this case, please give whatever suggestions you can.</p>
  
Tags: <statistics><database><cql>
Title: Generalise 'grandmaster games (...) castle opposite sides and the queenside players loses?' to finding games based on themes
ThreadText: # Generalise 'grandmaster games (...) castle opposite sides and the queenside players loses?' to finding games based on themes
  
  (Asked by: username_0 on 2021-12-13)
  
  I would like to generalise [What are examples of grandmaster games where both Black and White castle opposite sides and the queenside players loses?](https://chess.stackexchange.com/questions/13918/what-are-examples-of-grandmaster-games-where-both-black-and-white-castle-opposit)
  
  **Question**: Is there a way I can search this up myself?
  
  Like perhaps in the chessgames, chesstempo, lichess or chessdotcom database or perhaps youtube via [chessvision](https://my.chessvision.ai/search) (You can select the theme 'opposite site castling'), I plug in parameters like
  
  1. Title/rating parameter: both (or at least 1 of the) players, say, Alice and Bob, obtained the title of GM or have a certain rating (either at the time of the game or later on in life)
  2. Some middlegame parameter: Alice castled queenside while Bob castled kingside
  3. Winning parameter: Alice lost.
  4. Date parameter: games from date t to date t+X
  5. Perhaps also some endgame parameter: Like they reached a rook endgame or a bishop vs knight endgame.
  
  **Ideal answer**: I'm asking if there's a readily available way to do this. Like someone's already made this kind of thing where we can plug in these themes/parameters.
  
  **Next best thing/s**: Well I suppose there's manually downloading perhaps some grandmaster database and then we write script in python or something that searches O-O vs O-O-O and then use the same way lichess or chessvision identifies 'rook endgame' or 'bishop vs knight endgame'. In this case, please give whatever suggestions you can.
  
  **Tags:** statistics, database, cql
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-12-13. Score: 9 | Accepted answer
  
  > Question: Is there a way I can search this up myself?
  
  Yes. There is a tool called [CQL](https://en.wikipedia.org/wiki/Chess_Query_Language) (Chess Query Language) which allows you to search a PGN file database of games for games that match some set of criteria in the same way that SQL allows you to search a relational database for records which match a set of criteria.
  
  The [CQL User Guide](http://www.gadycosteff.com/cql/) describes what CQL does, how to [download](http://www.gadycosteff.com/cql/download.html) and install CQL, how to use it and gives [example CQL queries](http://www.gadycosteff.com/cql/) to get you started.
  
  Tim Krabbe also has a [useful page](https://timkr.home.xs4all.nl/chess2/cql.htm) on his website describing how he has used the tool to find interesting positions and games.
  
  > **Comments:**
  > **username_2**: Just a further note. Of the "Big Two" commercial databases, Chess Assistant supports CQL directly while ChessBase, as of v15, does not (though if you hit the "Advanced" button under  "Search Games" you get to set search parameters that should fit your needs).  
  
  ---
  
  