Chess Query Language

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-2018 and is free. The CQL Manual is hosted by the Internet Archive.

The current version is 5.1 and the documentation and download of the executable can be found on the website of Gady Costeff.

=Sample query= (match :pgn input.pgn      :output output.pgn       :forany piece [Rr]       (position $piece[g2] :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)))             ) :shift :flip ) )
 * look for positions where a rook circles in a 4x3 rectangle
 * we use the rectangle g2, d2, d6, g6 together with shift and flip

=See also=
 * Portable Game Notation
 * SCID

=Publications=
 * Gady Costeff (2004). The Chess Query Language: CQL. ICGA Journal, Vol. 27, No. 4, pdf

=Forum Posts=
 * CQL Users? by Guy Haworth, CCC, August 11, 2004
 * CQL - Stalemate with 2 pieces pinned by James Constance, CCC, July 17, 2005
 * Chess Query Language by David Dahlem, CCC, August 13, 2011
 * Chess Query Language by Giovanni Lavorgna, CCC, May 07, 2016
 * Scid vs PC with CQL, build issue by Steven Atkinson, CCC, November 25, 2017 » Scid vs. PC

=External Links=
 * CQL Introduction by Gady Costeff
 * CQL Manual hosted by the Internet Archive
 * Chess Query Language from Tim Krabbé's Chess Site
 * Chess Query Language from Wikipedia
 * CQL VisualCQL by Emil Vlasák

=References= Up one Level