index Back to help overviewhome Back to home page

CQL - The match list

Any CQL script must have exactly one match list at top level. The match list contains keyword parameters that control the matching of each game. The match list contains zero or more position lists. (Note that the CQL standard requires at least one position list.) A game will be matched only if all conditions in the match list are fullfilled. If positions lists are given, each of which must match at least one position in the game in order for the match list to match that game.

Note that most examples on this page are not compatible with the CQL standard, because this standard requires that at least one position list is contained.

Some of the keywords can be negated with a preceding exclamation, then this is an abbreviation; e.g.

(match !:ischess960)

is an abbreviation for

(match :not (match :ischess960))

The symbol in the title of a keyword description denotes that this keyword is an extension, it is not part of the CQL standard.

Index

:and
:annotator
:averagerating
:averagerating*
:birthyear  •:whitebirthyear  •:blackbirthyear
:cond
:comment
:country  •:whitecountry  •:blackcountry
:date
:deathyear  •:whitedeathyear  •:blackdeathyear
:eco
:eithercolor
:elo  •:whiteelo  •:blackelo
:event
:eventcategory
:eventcountry
:eventdate
:eventmode
:eventtype
:forany
:gamenumber
:gender  •:whitegender  •:blackgender
:goodgame
:hasannotation
:hascomments
:hasmarkers
:hasspecialmarkers
:hasvariations
:ischess960
:iscomputer  •:whiteiscomputer  •:blackiscomputer
:ishuman  •:whiteishuman  •:blackishuman
:isshufflechess
:not
:or
:output
:pgn
:player  •:whiteplayer  •:blackplayer
:plycount
:rating  •:whiterating  •:blackrating
:ratingdifference
:result
:round
:site
:startposition
:subround
:tag
:termination
:timemode
:title  •:whitetitle  •:blacktitle
:variant
:xor
:year

Logical keywords

:and
:cond
:not
:or
:xor

:and 

Takes a list of sub-match lists and matches only if each of them match. Note that a sub-match cannot contain position lists.

Example:

(match
  :and (
    (match :isshufflechess)
    (match :ischess960 :not))))

Search for Shuffle Chess games, not including Chess 960 positions. This example is identical to the following:

This keyword seems to be superfluous, but it may be useful inside :or, :xor, or :cond.

:cond 

This keyword will be used in the following general form:

:cond
  (match <Condition1>) (match <Expression1>)
  (match <Condition2>) (match <Expression2>)
  ...
  (match <Conditionk>) (match <Expressionk>)

:cond expects an arbitrary number of arguments. Each argument <Conditioni> will be called a clause, and each argument <Expressioni> is an association. Successively each clause will be evaluated until a matching clause is found, the associated expression is the result of the whole :cond expression. A game cannot match if no clause is matching. This means that the order of the lists inside an :cond is important. It is not allowed that an argument contains a position list.

Often the final pair will be expressed in the following form:

(match) (match <Expressionk>)

The empty list is matching any game. This case can be expressed in an abbreviated form, by omiting the second last argument (match). Then the result of the last expression will be evaluated if no clause is succeeding.

In fact the keyword :cond is redundant, because the following conversion with :or is equivalent:

(match :or (
  (match <Condition1> <Expression1>)
  (match <Condition2> <Expression2>)
  ...
  (match <Conditionk> <Expressionk>)))

But on the one hand, :cond is defined to be conform with the position list, and on the other hand, the evaluation of the :cond expression is more efficient (for example consider the case that <Condition1> will succeed, but not <Expression1>, then the :or expression will proceed with next list, while the :cond expression is delivering the result immediately).

One example for the usage of :cond:

(match
  :cond (
    (match :result 1-0) (match :whiteplayer "Kasparov, Gary")
    (match :result 0-1) (match :blackplayer "Kasparov, Gary")))

Match all games won by "Kasparov, Gary". This is only an example for the demonstration of :cond. In this case the following would be easier:

(match
  :eithercolor
  :result 1-0
  :whiteplayer "Kasparov, Gary")

See also: :or.

:not 

This keyword can be used in two forms: either it is included in a match list, or it has a sub-match list as parameter. In former case match if the containing match list would not match without the :not. In latter case: negate the result of the sub-match list match. The former form is defined only to be conform with CQL standard of keyword :not : position of position match.

Example:

(match :isshufflechess :not)

Search for games which do not start with a Shuffle Chess position. This example may be written in the second form:

(match :not (match :isshufflechess))

However this special example can be expressed in a quite simpler form:

(match !:isshufflechess)

:or 

Takes a list of sub-match lists and matches if at least one of them matches. Note that a sub-match cannot contain position lists.

Example:

(match
  :or (
    (match :event "FIDE-Wch*"
    (match :event "PCA-World Championchip*"))))

Search for world championchip games.

See also: :cond, :xor.

:xor 

Takes a list of sub-match lists and matches if exactly one of them matches. Note that a sub-match cannot contain position lists.

Example:

(match
  :xor (
    (match :hasmarkers !)   ; Brilliancy
    (match :hasmarkers ?))) ; Blunder

Match all games marked with Brilliancy, or Blunder, but not marked with both flags.

See also: :cond, :or

Event search related keywords

:event
:eventcategory
:eventcountry
:eventdate
:eventmode
:eventtype
:round
:site
:subround
:timemode

:event 

Search for games where the event matches given pattern.

This takes one parameter, either a double-quoted pattern, or a un-quoted string.

Un-quoted string: Match only games where the event name has as sub-string which the given parameter will match. The string match is case-insensitive.

Example:

:event Berlin

Match all games where the event names has as sub-string "Berlin".

Double-quoted pattern: Only games where the event name is matching the pattern will be found. For pattern matching see Pattern Matching.

:eventcategory 

Match all games where ths FIDE catageory of the belonging tournament is inside the range specification. In this case the numerical values can be given as roman numbers. A special meaning has value zero, this is matching games without a category specification.

Examples:

:eventcategory >=20
:eventcategory >=XX

In both cases all game will match, where the belonging tournament has a FIDE category of at least XX.

:eventcountry 

Match all games where the country of the event is matching one of the countries in the given comma-separated list. Country is either an IOC country code , or an ISO 3166-2 country code . Furthermore the special country codes UNK (IOC form), and xx (ISO 3166-2 form) are matching games where the country of the event is unknown. The CQL editor provides a feature for the input of country codes.

Examples:

:eventcountry dk,fi,no,se

Search for games played in Scandinavian events.

:eventcountry xx

Search for games where the country of the event is unknown.

See also: :site.

:eventdate 

This takes a range specifier denoting the range of dates that the event of the game must match.

For a detailed description of the date range see :date.

Example:

:eventdate 1930 1935

Search for historic games, with an event date at least 1930 and at most 1935.

:eventmode 

Match all games where the event mode is matching one of the modes in the given comma-separated list.

The event mode is one of:

  • unknown Event mode is unknown
    otb Over the board
    corr Correspondence
    email E-mail
    internet Internet Chess Server
    tele Telecommunication
    analysis Analysis
    composition Composition

The CQL editor provides a feature for the input of event modes.

Example:

:eventmode corr,email

Search for correspondence chess games, or games played via E-mail.

:eventtype 

Match all games where the event type is matching one of the types in the given comma-separated list.

The event type is one of:

  • unknown Event type is unknown
    game Individual Game
    match Match
    tourn Round Robin
    knockout Knockout Tournament
    swiss Swiss-System Tournament
    team Team Tournament
    schev Scheveningen-System Tournament
    simul Simultaneous Tournament

The CQL editor provides a feature for the input of event types.

Example:

:eventtype tourn,swiss

:round 

Search for games whose round specification is inside the given range specification. A special meaning has value zero, this is matching games without a round specification.

Examples:

(match :round 0)

Match all games without a round specification.

(match :round 0 1)

Match all games either without a round specification, or played in round 1.

See also: :subround.

:site 

Search for games where the site of the event matches given pattern.

This takes one parameter, either a double-quoted pattern, or a un-quoted string. For pattern matching see Pattern Matching.

See also: :eventcountry.

:subround 

Search for games whose sub-round specification is inside the given range specification. A special meaning has value zero, this is matching games without a sub-round specification. Games without a round specification cannot match ever.

Examples:

(match :subround 0)

Match all games without a sub-round specification.

(match :subround 0 1)

Match all games either without a sub-round specification, or played in sub-round 1.

See also: :round.

:timemode 

Search for games where the time mode is matching one of the modes in the given comma-separated list.

Time mode is one of:

  • unknown Time mode is unknown
    normal Normal
    rapid Rapid
    blitz Blitz
    bullet Bullet
    corr Correspondence

The CQL editor provides a feature for the input of time modes.

Example:

:timemode blitz,bullet

Search for blitz and bullet games.

Player search related keywords

:averagerating  •:averagerating*
:birthyear  •:whitebirthyear  •:blackbirthyear
:country  •:whitecountry  •:blackcountry
:deathyear  •:whitedeathyear  •:blackdeathyear
:elo  •:whiteelo  •:blackelo
:gender  •:whitegender  •:blackgender
:iscomputer  •:whiteiscomputer  •:blackiscomputer
:ishuman  •:whiteishuman  •:blackishuman
:player  •:whiteplayer  •:blackplayer
:rating  •:whiterating  •:blackrating
:ratingdifference
:title  •:whitetitle  •:blacktitle

:averagerating 

This variant of :rating expects the same arguments, but here the average rating of either players will match. If only one player has a rating rating then this will be the average.

Example:

:averagerating ELO –

Match all games where either players do not have an ELO rating.

See also: :averagerating*, :whiterating, :blackrating, :rating, :ratingdifference.

:averagerating* 

This variant of :averagerating expects the same arguments, but here only these games will match where both players have an rating score.

Examples:

:averagerating* ELO >=2500

Match all games where the players have an average ELO rating of at least 2500. But a game cannot match if at least pne of the players do not have an ELO rating.

See also: :averagerating, :whiterating, :blackrating, :rating, :ratingdifference.

:birthyear 

Search for games where one of the players is born in a year between the given ranges (⇒ range specifiers).

Example:

:birthyear >=1990

Search for games with at least one younger player, born 1990 or later.

See also: :whitebirthyear, :blackbirthyear, :deathyear.

:blackbirthyear 

Search for games where the black player was born in a year between the given ranges (⇒ range specifiers).

See also: :whitebirthyear, :birthyear, :blackdeathyear, :whitedeathyear, :deathyear.

:blackcountry 

Match all games where the nationality of the black player is matching one of the countries in given comma-separated list. A country will be specified either as IOC country code , or ISO 3166-2 country code . Furthermore the special country codes UNK (IOC form), and xx (ISO 3166-2 form) are matching games where the country of the black player is unknown. The CQL editor provides a feature for the input of country codes.

For examples see :country.

See also: :country, :whitecountry.

:blackdeathyear 

Search for games where the black player died in a year between the given ranges (⇒ range specifiers).

See also: :whitedeathyear, :deathyear, :blackbirthyear, :whitebirthyear, :birthyear.

:blackelo 

This keyword takes a range specifier; the ELO of the black player must be within its range. One special case:

See also: :whiteelo, :elo, :blackrating.

:blackgender 

Match all games where the gender of the black player is matching given gender. Gender is one of f (female), m (male, man), or x (unknown). For female also w (woman) may be used.

Example:

:blackgender f

Only search for games where the black player is female.

:blackgender x

Only search for games where the gender is unknown for at least one player.

See also: :whitegender, :gender.

:blackiscomputer 

Search for games where the black player is an engine.

This keyword can be used in a negated form; with a preceding exclamation mark. Example:

(match !:blackiscomputer)

Match games where the black player is not a chess engine.

See also: :iscomputer, :whiteiscomputer.

:blackishuman 

Search for games where the black player is a human.

This keyword can be used in a negated form; with a preceding exclamation mark. Example:

(match !:blackishuman)

Match games where the black player is not a human.

See also: :ishuman, :whiteishuman.

:blackplayer 

Search for games where the black player matches given name.

This takes one parameter, either a double-quoted pattern, or a un-quoted string. For pattern matching see Pattern Matching.

See also: :player, :whiteplayer.

:blackrating 

Match all games where the given rating is between given score range of the black player. The first parameter is the rating system, the score range follows. For a detailed description see :rating.

See also: :whiterating, :rating, :averagerating, :ratingdifference.

:blacktitle 

Match all games where the title of the black player is matching one of the titles in the given comma-separated list. See :title for a more detailed description.

See also: :whitetitle, :title.

:country 

Match all games where the nationality one of the players is matching any country in given comma-separated list. Country is either an IOC country code , or an ISO 3166-2 country code . Furthermore the special country codes UNK (IOC form), and xx (ISO 3166-2 form) are matching games where the nationality of one player is unknown. The CQL editor provides a feature for the input of country codes.

Examples:

:country GER
:country de

In both examples, match all games where one of the players has a German nationality.

See also: :whitecountry, :blackcountry.

:deathyear 

Search for games where one of the players died in a year between the given ranges (⇒ range specifiers).

Example:

:deathyear 1800 1950

Search for games with ancient players, at least one of them died between 1800 and 1950.

See also: :whitedeathyear, :blackdeathyear, :whitebirthyear, :blackbirthyear, :birthyear.

:elo 

This parameter expects a range specifier; the ELO of at least one of the players must be within the specified range. One special case:

:elo 0

In this case all games will match where at least one of the players does not have an ELO rating.

See also: :blackelo, :whiteelo, :rating.

:gender 

Match all games where the gender of one player is matching given gender. Gender is one of f (female), m (male, man), or x (unknown). For female also w (woman) may be used.

For examples see :blackgender.

See also: :blackgender, :whitegender.

:iscomputer 

Search for games where one of the players is a engine.

This keyword can be used in a negated form; with a preceding exclamation mark. Example:

(match !:iscomputer)

Match all games where neither player is a chess engine.

See also: :whiteiscomputer, :blackiscomputer.

:ishuman 

Search for games where one of the players is a human.

This keyword can be used in a negated form; with a preceding exclamation mark. Example:

(match !:ishuman)

Match all games where neither player is human.

See also: :whiteishuman, :blackishuman.

:player

Search for games where one of the players matches given name. This takes one parameter, either a double-quoted pattern, or a un-quoted string.

Un-quoted string: Only games at least one of whose players names has as sub-string the given parameter will match. The string matching is case-insensitive. This form complies with the CQL standard.

Example:

:player coeff

Match all games where one of the player names has as sub-string "coeff".

Double-quoted pattern: Only games at least one of whose players names are matching the pattern will be found. For pattern matching see Pattern Matching.

note The form with double-quoted patterns does not comply with the CQL standard.

See also: :whiteplayer, :blackplayer.

:rating 

Match all games where one of the players has a score of given rating system which is between the specified score range (⇒ range specifiers). The first parameter is the rating system, then the score range follows.

Rating system is one of:

ELO FIDE Rating
DWZ German Rating (Deutsche Wertungszahl)
ECF English Chess Federation
ACF Australian Chess Federation
USCF United States Chess Federation
Rapid FIDE Rapid Rating
Blitz FIDE Blitz Rating
ICCF International Correspondence Chess Federation
Edo Historical Chess Rating

Example:

:rating ELO 2000 3000

Match all games where one of the players has an ELO rating between 2000 and 3000.

See also: :whiterating, :blackrating, :averagerating, :ratingdifference.

:ratingdifference 

Match all games where both players have an score of given rating system, and the difference is between the specified score range (see range specifiers). The first parameter is the rating system (see definition of :rating), then the score range follows.

Example:

:ratingdifference ELO <=500

Match all games where the ELO difference is at most 500.

See also: :whiterating, :blackrating, :rating, :averagerating.

:title 

Match all games where any title in the given comma-separated list is matching the title of one player. Title is one of:

NoneNo title
GM Grandmaster (FIDE)
IM International Master (FIDE)
FM Fide Master (FIDE)
CM Candidate Master (FIDE)
WGM Woman Grandmaster (FIDE)
WIM Woman International Master (FIDE)
WFM Woman Fide Master (FIDE)
WCM Woman Candidate Master (FIDE)
HGM Honorary Grandmaster (FIDE)
CGM Correspondence Grandmaster (ICCF)
CIM Correspondence International Master (ICCF)
CLGMCorrespondence Lady Grandmaster (ICCF)
CLIMCorrespondence Lady International Master (ICCF)
CSIMCorrespondence Senior International Master (ICCF)

Examples:

:title GM,IM

Search for all games with al least one GM or IM.

:title None

Search for all games where neither player have a title.

:whitebirthyear 

Search for games where the white player was born in a year between the given ranges (⇒ range specifiers).

See also: :blackbirthyear, :birthyear, :whitedeathyear, :blackdeathyear, :deathyear.

:whitecountry 

Match all games where the nationality of the white player is matching any country in given comma-separated list. Country is either an IOC country code , or an ISO 3166-2 country code . Furthermore the special country codes UNK (IOC form), and xx (ISO 3166-2 form) are matching games where the country of the white player is unknown. The CQL editor provides a feature for the input of country codes.

For examples see :country.

See also: :blackcountry, :country.

:whitedeathyear 

Search for games where the white player died in a year between the given ranges (⇒ range specifiers).

See also: :blackdeathyear, :deathyear, :whitebirthyear, :blackbirthyear, :birthyear.

:whiteelo 

This keyword takes a range specifier; the ELO of the white player must be be within its range.

See also: :blackelo, :elo, :whiterating.

:whitegender 

Match all games where the gender of the white player is matching given gender. Gender is one of f (female), m (male, man), or x (unknown). For female also w (woman) may be used.

For examples see :blackgender.

See also: :blackgender, :gender.

:whiteiscomputer 

Search for games where the white player is an engine.

This keyword can be used in a negated form; with a preceding exclamation mark. Example:

(match !:whiteiscomputer)

Match all games where the white player is not a chess engine.

See also: :iscomputer, :blackiscomputer.

:whiteishuman 

Search for games where the white player is a human.

This keyword can be used in a negated form; with a preceding exclamation mark. Example:

(match !:whiteishuman)

Match all games where the white player is not a human.

See also: :ishuman, :blackishuman.

:whiteplayer 

Search for games where the white player matches given name.

This takes one parameter, either a double-quoted pattern, or a un-quoted string. For pattern matching see Pattern Matching.

See also: :blackplayer, :player.

:whiterating 

Match all games where the given rating is between given score range of the white player. The first parameter is the rating system, then the score range follows. The first argument is the rating system, and the second argument is the range specification. For a detaillierte description see :rating.

See also: :blackrating, :rating, :averagerating, :ratingdifference.

:whitetitle 

Match all games where the title of the white player is matching one of the titles in the given comma-separated list. See :title for a more detailed description.

See also: :blacktitle, :title.

:annotator
:date
:eco
:gamenumber
:hasmarkers
:hasspecialmarkers
:plycount
:result
:termination
:variant
:year

:annotator 

Search for games where the annotator matches given name.

This takes one parameter, either a double-quoted pattern, or a un-quoted string. See :player for a detailed description.

Examples:

:annotator Capablanca

Search for games where one of the player names has a sub-string matching the name "Capablanca".

:annotator "?*"

Search for games with any annotator, this means that games without an annotator are excluded.

:annotator ""

Search for games without an annotator (nevertheless these games may contain annotations).

:annotator "*"

This criterion will find any game (hence it is not useful).

See also: :hascomments.

:date 

This takes a range specifier denoting the range of dates that the game must match.

The range specifier has one of the following forms:

2010-10-27 Denoting a single date.
>=2010-10-27 A single date can be preceded by a comparative operator, which has the same meaning an in range specification.
2010-10-01 2010-10-31 Denoting a range of dates, inclusive the ranges.
2010-10-01 .. 2010-11-01 Denoting a range of dates, inclusive the former date, exlusive the latter date.

Note that in third form it is not required that the former date is less than the latter date. Also note that the empty range (for example 2010-10-01 .. 2010-10-01) is not allowed.

A date has the following syntax:

<year>'−'<month>'−'<day>(<sign><num>'y')?(<sign><num>'m')?(<sign><num>'d')?

<year> specifies the year (four digits)
<month> specifies the month (two digits)
<day> specifies the day of the month (two digits)
<sign> is either '−' or '+'
<num> is any positive number, denoting an increment or decrement
d specifies to increment/decrement the day
m specifies to increment/decrement the month
y specifies to increment/decrement the year

Moreover the special date ranges , and * are permitted – see range specifiers for a description.

Examples:

:date 2010-10-01

Search for all games played on October 1, 2010.

:date >=2010-10-01

Search for all games played after September 30, 2010.

:date 2010-10-01 .. 2010-11-01

Search for all games played in October 2010: between October 1, 2010 (inclusive), and November 1, 2010 (exclusive).

:date 2010-10-01 .. 2010-10-01+1m

Also search for all games played in October 2010; the latter range (2010-10-01+1m is November 1, 2010) is excluded. +1m denotes the increment for the month.

:date 2010-10-27 .. 2010-10-27-43d

Search for all games between September 14, 2010 (exclusive; 2010-10-27-43d is September 14, 2010), and October 27, 2010 (inclusive). This is an example for the following case: we know that the tournament has finished on October 27, 2010, and the duration of this tournament was exact 43 days. This example is exploiting that the first date specifier of a range can be greater than the last date specifier.

:date

Search for games which are blank dated.

See also: :year.

:eco 

This takes a comma-separated list of range specifiers denoting the ECO code range that the game must match.

Examples for ECO code ranges:

A00ECO code A00
B00-99ECO code range B00 to B99

Furthermore the special ranges , and * are permitted – see range sepcifiers for a description. But these special ranges cannot be part of a list, however they are replacing a list of ranges.

Examples:

:eco A00

Search explicitely all games with ECO code A00.

:eco A11-39

Search only for games starting with an English opening.

:eco B00-99,C00-99

Match all games with an ECO code either within B00 and B99 (half-open games), or within C00 and C99 (open games).

:eco *

Match all games without a blank ECO code, this means that games without an assigned ECO code are excluded.

:gamenumber

This takes a range specifier. Only games whose number within the database lies within the range specifier (⇒ range specifiers) are considered.

Note that in case of PGN databases the game number may occur more than once, because of chess variants. Possibly the search should be restricted with keyword :variant.

Examples:

:gamenumber 1000
:gamenumber 1 100

:hasmarkers 

Search for games which has one of the markers set specified in the given comma separated list of tokens (⇒ game markers). If no parameter is given, we will search for any marker.

A token is one of:

w White Opening
b Black Opening
m Middle Game
e End Game
N Novelty
p Pawn Structure
T Tactics
K King Side
Q Queen Side
! Brilliancy
? Blunder
U User
* Best Game
D Decided Tournament
G Model Game
S Strategy
^ Attack
~ Sacrifice
= Defense
M Material
P Piece Play

The CQL editor provides a feature for the input of game markers.

Examples:

:hasmarkers w,b

Search for games with marker White Opening or Black Opening (or both).

:hasmarkers

Search for games with any marker set; this means games without any game marker are excluded.

:hasspecialmarkers 

Search for games which has one of the special markers set specified in the given comma-separated list.

A special marker is one of:

deleted Game marked for deletion.
changed Game has been changed in this session.
addedd Game has been added in this session.
illegalmove Game contains an illegal move.
invalidmove Game contains an invalid move (support of children's chess).

Note that invalidmove is not including illegal moves. The CQL editor provides a feature for the input of special markers.

Example:

:not (match :hasspecialmarkers invalidmove)

Search for games without invalid moves, but illegal moves (like illegal castling) are allowed.

:plycount 

Search for games with a ply count between the given range (⇒ range specifiers).

Example:

:plycount 40 60

This is matching short games, with no less than 20 moves, and no more than 30 moves.

:result

Match all games where the result of the game is matching one of the results in the given comma-separated list.

note The CQL standard does allow only a single result as parameter.

Result is one of:

1/2 drawn game
1-0 game in which white wins
0-1 game in which black wins
0-0 game lost for both players (not part of CQL standard)
* game with unknown result (not part of CQL standard)

The parameter 1/2 may be written-out with 1/2-1/2.

Examples:

:result 1/2

Match all drawn games.

:result 1-0,0-1

Match all games in which one side has won.

:termination 

Match all games where the termination reason is matching one of the reasons in the given comma-separated list.

The termination reason is one of:

unknown Termination reason is unknown
normal Game terminated in a normal fashion
abandoned Game is abandoned
adjudication Adjudication
disconnection Disconnection
emergency Abandoned due to an emergency
rulesinfraction Decided due to a rules infraction
timeforfeit One or both players forfeits on time
unplayed One of the players claimed a draw
unplayed Point given for game with no opponent
unterminated Unterminated

Example:

:termination unknown,normal

Search all games where it is not known that the game did not terminate in an abnormal fashion.

:variant 

Only search in games matching any chess variant in given comma-separated list.

Supported variants are:

normal Normal Chess
threecheck Three-check Chess
kingofthehill King-of-the-Hill
dropchess Drop Chess
crazyhouse Crazyhouse
chessgi Chessgi
antichess Antichess
suicide Suicide
giveaway Giveaway
losers Losers

Example:

:variant suicide,giveaway,losers

Restrict the search to Antichess games.

:year

This takes a range specifier denoting the range of years that the game must match (⇒ range specifiers).

Examples:

:year 2000
:year 2000 2010

See also: :date.

Game data search related keywords

:comment
:goodgame
:hasannotation
:hascomments
:hasvariations
:ischess960
:isshufflechess
:startposition
:tag

:comment 

Search all games containing at least one comment with a sub-string which is matching the given pattern. For pattern matching see Pattern Matching. The pattern must be enclosed in double quotes.

Beispiel:

:comment "decisive game"

This will find a game, for example, which contains the commentary "This decisive game started with a suprise.".

:goodgame 

This corresponds approximately the estimation of ChessBase about good games, and is equivalent to:

(match
  ; Only games with a normal time mode.
  :timemode normal, corr
  ; No simultaneous games.
  :not (match :eventtype simul)
  ; No games with less than 16 half moves.
  :plycount 16 unlimited
  ; No drawn games with less than 40 half moves.
  :or (
    (match :result 1/2 :not)
    (match :plycount 40 unlimited))
  ; Only games where one player has a major title,
  ; or a good rating score.
  :or (
    (match :title IM,GM,WIM,WGM,CIM,CGM)
    (match :rating ELO 2350 unlimited)
    (match :rating DWZ 2350 unlimited)
    (match :rating ECF 220 unlimited)
    (match :rating ICCF 2350 unlimited)
    (match :rating USCF 2375 unlimited)))

This keyword can be used in a negated form; with a preceding exclamation mark. Example:

(match !:goodgame)

Match all games with less quality.

:hasannotation 

Search for games with symbolic annotations (⇒ NAG annotation values).

This keyword can be used in a negated form; with a preceding exclamation mark. Example:

(match !:hasannotation)

Match all games which are without symbolic annotations.

See also: :hascomments, :hasvariations.

:hascomments 

Search for commented games. Note that a commented game must not have an annotator (⇒ :annotator).

This keyword allows a list of ISO 639-2  language codes as an optional parameter. The following codes are extensions:

xxLanguage independent commentary
yyAny language but English (this is not including language independent commentaries)

The CQL editor provides a feature for the input of language codes.

Examples:

:hascomments

Search for games with commentaries.

:hascomments de,en

Search for games with commentaries in German or in English language.

See also: :hasannotation, :hasvariations.

:hasvariations 

Search for games containing sub-variations.

This keyword can be used in a negated form; with a preceding exclamation mark. Example:

(match !:hasvariations)

Match all games not containing sub-variations.

See also: :hasannotation, :hascomments.

:ischess960 

Search for games starting with a Chess 960 position. This includes the standard start position.

This keyword can be used in a negated form; with a preceding exclamation mark. Example:

(match !:ischess960)

Match alle games not starting with a Chess 960 position.

See also: :isshufflechess.

:isshufflechess 

Search for games starting with a Shuffle Chess position. This includes Chess 960 positions.

This keyword can be used in a negated form; with a preceding exclamation mark. Example:

(match !:isshufflechess)

Match alle games not starting with a Shuffle Chess position.

See also: :ischess960.

:startposition 

This will take a comma-separated list of start positions. A start position is either a position number, or a FICS variant identifier.

If the position number is zero then games not beginning with a Shuffle Chess position will be matched. Otherwise the position number between 1 and 3840 is denoting a Shuffle Chess position. If the number is less or equal than 960 (but not null), then it is a Chess 960 position number. A special meaning has *: this symbol is excluding Shuffle Chess positions and (supported) FICS variants (see below).

The Shuffle Chess position number is derived from the Chess 960 position number in the following way:

  1. The king is between the two rooks, and all castling rights are given: this is a Chess 960 position. Thus the position number is between 1 and 960.
  2. The king is right from the rooks: the number for this Shuffle Chess position is between 961 and 1920.
  3. The king is left from the rooks: the number for this Shuffle Chess position is between 1921 and 2880.
  4. The king is between the two rooks, but no castling rights are given: add 3×960 to the corresponding Chess 960 position, thus the position number is between 2881 and 3840.

For chess variants Suicide and Giveaway a special rule applies: in this case a position number N is also matching N−3×960, if N > 3×960. This is simplifying the search for standard start positions; see example below. Note that a start position in these chess variants cannot have a position number equal or less than 960.

It is also possible to specifiy a FICS variant identifier for the start position. The supported positions are:

misc/bishops-only endings/kbbk
misc/knights-only endings/kbnk
misc/little-game pawns/pawns-only
misc/no-queens pawns/wild-five
misc/pawns-only wild/5
misc/pyramid wild/7
misc/queen-rooks wild/8
misc/queens-only wild/19
misc/rooks-only
misc/runaway

Examples:

:startposition 518

Search for games beginning with a standard start position. In case of chess variants Suicide and Giveaway this will also match position number 3398 (this is the standard start position for Suicide and Giveaway games).

:startposition 518,3398

Search for games beginning with a standard start position, with or without castling rights. Here the search will also find in Normal Chess the start position 3398, in contrast to preceding example.

:startposition misc/runaway

Search for games with FICS variant misc/runaway.

:startposition 0 :not

Search for games beginning with any start position: this means that the first game position of these games must be a Shuffle Chess position.

:startposition *

Search for games beginning with any supported start position: this means that the first game position in these games is either a Shuffle Chess position, or a (supported) FICS variant.

See also: :ischess960, :isshufflechess.

:tag 

Match all games where an additional PGN tag exists, which is matching the first argument, and whose value is matching the second argument. If the second argument is not given, then find all games with the given tag independent from the value of this tag.

This optional second parameter is either a double-quoted pattern, or a un-quoted string. For pattern matching see Pattern Matching.

As a special value for the first argument * is allowed. This will match any PGN tag name.

Examples:

:tag Source

Match all games where the PGN tag Source is defined.

:tag WhiteTeamCountry USA

Match all games with PGN tag WhiteTeamCountry, whose value is matching USA.

:tag * :not

Match all games not containing any additional PGN tag.

:tag * USA

Match all games with any additional PGN tag and value USA.

Transformation keywords

:eithercolor

:eithercolor 

Apply a color flip. This color flip transformation does not apply to position lists.

As an example this made the following search possible:

(match (
  :result 1-0
  :whiteelo <=2300
  :blackelo >=2600
  :eithercolor))

Match all games where one player with ELO rating 2300 or less is defeating a player with ELO rating 2600 or more.

Tagging related keywords

:forany

:forany

This takes two parameters, a tag name and a piecetype designator. This feature is described on page Tagging.

Meaningless keywords

:output
:pgn

:output

This takes one parameter which denotes the name of a file.

This keyword is supported to be compatible with CQL standard, and does not have any meaning in CQL-S.

:pgn

This takes one parameter which denotes the name of a file.

This keyword is supported to be compatible with CQL standard, and does not have any meaning in CQL-S.