Chess Query Language

Also known as: CQL

A specialized language for describing chess patterns and finding the games or studies that contain them.

This page is temporarily shown in English. Complete localization will be added in a later stage.

Explanation

Chess Query Language, abbreviated CQL, lets a user formulate a precise chess query. A query is a formal description of what to find, such as a piece on a particular square, a move sequence, a position containing check, or a combination of conditions. CQL is designed to search for patterns inside collections of games and studies.

The basic workflow has two parts: write the pattern in CQL, then run the cql program on a PGN file. PGN means Portable Game Notation, a text format for recording games. CQL produces another file containing the matching games. The language can describe pieces, squares, and sequences, swap colors, reflect the board, and use repetition similar to regular expressions, rules that say how many times part of a pattern may repeat.

CQL is not a question written in everyday language, a notation for recording a game, or a database by itself. Its writing rules must be learned, and the query defines exactly what counts as a match. A query that is too rigid can miss equivalent examples; one that is too broad can return positions with only a superficial resemblance.

Usage and context

CQL is especially useful when the target depends on chess geometry or move order and cannot be described well by fields such as player, date, or opening.

Common confusions

Natural-language search

CQL does not interpret a free-form request such as find beautiful sacrifices. Its grammar must state which pieces, squares, moves, or relationships form the pattern.

Storage format

CQL describes a search. Games are read from and written to another format, normally PGN.

Sources

Related terms

© MindZug 2026