Home * Chess * Chess Query Language

The Chess Query Language (CQL) is a structured query language to search for games, problems, and studies that match specific themes from a collection in Portable Game Notation. CQL was developed by Gady Costeff and Lewis Stiller. It is Copyright (c) 2003-2004 and is free. The CQL Manual is hosted by the Internet Archive [1] [2].

Sample query

[3] [4]
;; look for positions where a rook circles in a 4x3 rectangle
;; we use the rectangle g2, d2, d6, g6 together with shift and flip
(match :pgn input.pgn
       :output output.pgn
       :forany piece [Rr]
        :and (
              (position :gappedsequence ((position :movefrom $piece[g6,d2] :moveto ?g2)))
              (position :gappedsequence ((position :movefrom $piece[d6,g2] :moveto ?d2)))
              (position :gappedsequence ((position :movefrom $piece[d6,g2] :moveto ?g6)))
              (position :gappedsequence ((position :movefrom $piece[g6,d2] :moveto ?d6)))

See also


Forum Posts

External Links


  1. ^ Chess Query Language by Giovanni Lavorgna, CCC, May 07, 2016
  2. ^ CQL Manual hosted by the Internet Archive
  3. ^ Sample CQL files (Internet Archive)
  4. ^ An html version of rookrectangle.cql (Internet Archive)

What links here?

Up one Level