Answers.Body: <p>I'm still working out the full answer, but this is a start:</p>
  <pre><code>flipcolor {
      wtm check ng3 Pg2 Ph2 Kh1 r attack (q g1) not {
          square $x in h3-8 a on $x
      }
      result 0-1
  }
  </code></pre>
  <p>This gets down to 13 games from over 2 million and includes the Karpov - Taimanov game. I still haven't figured out a way to deal with the rook, but
  this gets a game list small enough to look through. The not square bits could be taken out to expand the search to a couple of hundred games, that was just looking for the h file to not be blocked by black pieces for the later rook move.</p>
  <p>I used the above in the latest Scid vs. PC codebase, which has CQL support by adding <code>cql()</code> to the beginning and running it in the CQL search vs. what is ChessBase Big Database 2017 updated last month.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-21T22:59:22.830Z
Answers.Text: thanks! I get similar results in ScidVsPC-19, although on a different dataset.
Answers.UserDisplayName: Joe
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-22T01:41:22.540Z
Answers.Text: Other possibilities would be to look for a bishop attacking the g1 square instead of the queen. With the bishop attacking g1 and having a r on the board I find 20 games, and with the bishop and a q on the board I find 11 games. The first games that came up in both of those searches have the combination. I haven't looked at the other games.
Answers.UserDisplayName: Jerry Snitselaar
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-20T17:55:06.877Z
Answers.LastActivityDate: 2022-01-05T14:42:32.693Z
Answers.LastEditDate: 2022-01-05T14:42:32.693Z
Answers.UserDisplayName: Jerry Snitselaar
Body: <p>I am looking to search for combinations similar to the one in <a href="http://www.chessgames.com/perl/chessgame?gid=1067980" rel="nofollow noreferrer">Karpov - Taimanov, 1977</a> - a knight check, is followed by opening of an 'h' file, and the rook comes with decisive effect because attacker's queen covers the diagonal. I am only learning CQL and any tips on how to get started on constructing a query would be much appreciated -</p>
  <pre><code>[Event &quot;October Revolution 60th Anniversary&quot;]
  [Site &quot;Leningrad URS&quot;]
  [Date &quot;1977.06.25&quot;]
  [EventDate &quot;1977.??.??&quot;]
  [Round &quot;1&quot;]
  [Result &quot;0-1&quot;]
  [White &quot;Anatoly Karpov&quot;]
  [Black &quot;Mark Taimanov&quot;]
  [ECO &quot;B32&quot;]
  [WhiteElo &quot;?&quot;]
  [BlackElo &quot;?&quot;]
  [PlyCount &quot;76&quot;]
  [FEN &quot; &quot;]
  
  1. e4 c5 2. Nf3 Nc6 3. d4 cxd4 4. Nxd4 a6 5. c4 e5 6. Nb3 Nf6
  7. Nc3 Bb4 8. f3 O-O 9. Be3 d6 10. Rc1 b6 11. Bd3 Bc5 12. Qd2
  Be6 13. Nxc5 bxc5 14. O-O Nd4 15. Nd5 Nd7 16. f4 Rb8 17. f5
  Bxd5 18. cxd5 Qb6 19. Rf2 f6 20. Rc4 a5 21. Ra4 Ra8 22. Qe1
  Ra7 23. b3 Rfa8 24. Rb2 Qc7 25. Bd2 Nb6 26. Rxa5 c4 27. Bf1
  Rxa5 28. Bxa5 Qc5 29. Bxb6 Qxb6 30. Kh1 cxb3 31. axb3 g6
  32. fxg6 hxg6 33. b4 Kg7 34. b5 f5 35. exf5 Nxf5 36. Rb3 Qd4
  37. b6 Ra1 38. Rb1 Ng3+ {analysis: 39. hxg3 Ra8} 0-1
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-09-04T15:19:13.607Z
Comments.Text: What is CQL? If you are talking about Structured Query Language ("SQL", "See-qual", "Ess-Que-El"), then good luck writing a query for that.
Comments.UserDisplayName: Priyome
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-09-06T03:38:52.763Z
Comments.Text: @priyome, Chess Query Language. There have been some other questions concerning it on the site if you're curious.
Comments.UserDisplayName: ETD
Tags: <tactics><cql>
Title: What is the CQL syntax for combinations where king is checked along a file, and the square near it is attacked by bishop or queen?
ThreadText: # What is the CQL syntax for combinations where king is checked along a file, and the square near it is attacked by bishop or queen?
  
  (Asked by: username_0 on 2017-09-02)
  
  I am looking to search for combinations similar to the one in Karpov - Taimanov, 1977 - a knight check, is followed by opening of an 'h' file, and the rook comes with decisive effect because attacker's queen covers the diagonal. I am only learning CQL and any tips on how to get started on constructing a query would be much appreciated -
  [Event "October Revolution 60th Anniversary"]
  [Site "Leningrad URS"]
  [Date "1977.06.25"]
  [EventDate "1977.??.??"]
  [Round "1"]
  [Result "0-1"]
  [White "Anatoly Karpov"]
  [Black "Mark Taimanov"]
  [ECO "B32"]
  [WhiteElo "?"]
  [BlackElo "?"]
  [PlyCount "76"]
  [FEN " "]
  
  1. e4 c5 2. Nf3 Nc6 3. d4 cxd4 4. Nxd4 a6 5. c4 e5 6. Nb3 Nf6
  7. Nc3 Bb4 8. f3 O-O 9. Be3 d6 10. Rc1 b6 11. Bd3 Bc5 12. Qd2
  Be6 13. Nxc5 bxc5 14. O-O Nd4 15. Nd5 Nd7 16. f4 Rb8 17. f5
  Bxd5 18. cxd5 Qb6 19. Rf2 f6 20. Rc4 a5 21. Ra4 Ra8 22. Qe1
  Ra7 23. b3 Rfa8 24. Rb2 Qc7 25. Bd2 Nb6 26. Rxa5 c4 27. Bf1
  Rxa5 28. Bxa5 Qc5 29. Bxb6 Qxb6 30. Kh1 cxb3 31. axb3 g6
  32. fxg6 hxg6 33. b4 Kg7 34. b5 f5 35. exf5 Nxf5 36. Rb3 Qd4
  37. b6 Ra1 38. Rb1 Ng3+ {analysis: 39. hxg3 Ra8} 0-1
  
  **Tags:** tactics, cql
  
  > **Comments:**
  > **username_1**: What is CQL? If you are talking about Structured Query Language ("SQL", "See-qual", "Ess-Que-El"), then good luck writing a query for that.  
  > **username_2**: @priyome, Chess Query Language. There have been some other questions concerning it on the site if you're curious.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2018-07-20. Score: 3 | Accepted answer
  
  I'm still working out the full answer, but this is a start:
  flipcolor {
      wtm check ng3 Pg2 Ph2 Kh1 r attack (q g1) not {
          square $x in h3-8 a on $x
      }
      result 0-1
  }
  
  This gets down to 13 games from over 2 million and includes the Karpov - Taimanov game. I still haven't figured out a way to deal with the rook, but
  this gets a game list small enough to look through. The not square bits could be taken out to expand the search to a couple of hundred games, that was just looking for the h file to not be blocked by black pieces for the later rook move.
  I used the above in the latest Scid vs. PC codebase, which has CQL support by adding cql() to the beginning and running it in the CQL search vs. what is ChessBase Big Database 2017 updated last month.
  
  > **Comments:**
  > **username_0**: thanks! I get similar results in ScidVsPC-19, although on a different dataset.  
  > **username_3**: Other possibilities would be to look for a bishop attacking the g1 square instead of the queen. With the bishop attacking g1 and having a r on the board I find 20 games, and with the bishop and a q on the board I find 11 games. The first games that came up in both of those searches have the combination. I haven't looked at the other games.  
  
  ---
  
  