What's New in CQL 6.1

CQL 6.1 has four main improvements compared to CQL 6.0:
  1. string support. CQL 6.1 has a number of facilities for manipulating and searching strings of characters.
  2. custom tags. CQL 6.1 allows for the creation and querying of custom PGN tags.
  3. file I/O. CQL 6.1 can interface to external programs using files.
  4. HHdbVI interface. CQL 6.1 has a number of new filters for more conveniently accessing the HHdbVI database.

Strings in CQL 6.1

string manipulation

In CQL, strings are a first-class data type, and most of the new features of this release rely on them. You can manipulate strings in a variety of ways. You can concatenate, compare, and sort them. Strings can be persistent. You can parse integers or squares. You can convert to and from ASCII. You can use str to convert any CQL expression into a string. You can index individual characters or ranges of characters in a string.

Most important, using the new ~~ operator, you can perform regular expression matching on strings, including accessing capture groups. This lets you do things like access the fields in a FEN; parse a comment to get a computer-generated evaluation; process custom PGN tags; and parse external files. A new iterator, ~~ form of while, allows one to iterate through all the regular expression matches in a string.

See this table for a list of all the new filters that manipulate strings.

More powerful PGN tag query facilities

CQL 6.1 offers considerable new functionality for querying PGN tags (or metadata) associated with a particular game.

You can query custom tags or arbitrary tags using the tag filter:

    x= tag "MyCustomPGNTag"

You can use regex matching to perform regular expression matching on any tag:

    player ~~ "K.*ov"
    date ~~ "19[5-9]\d"
You can sort by a tag value:
    sort date
    sort min player white

New built-in PGN tag filters include date, eco, eventdate.

Set custom tags

You can define and set the value of your own custom PGN tag:
    settag "NumberChecks" Nchecks
The value of these custom tags can be queried and manipulated with tag.

read and write files; use dictionaries

You can read and write external files. You can store the information you get in dictionaries, which associate keys to values. You can use these features to do things like compare different games in a file, or query the fen from the current position against an external database.

HhdbVI interface

CQL 6.1 includes an interface to HHdbVI, the Heijden study database. The hhdb interface provides built in functionality for accessing and sorting by study award; gbr code; composer; soundness; etc.

Miscellaneous features

CQL 6.1 includes a number of new convenience features: assert; initialposition; removecomment; isbound; isunbound; unbind; []; standard form of while; persistent sets; more concise if syntax; more consistent syntax and much more efficient implementation for {m,n} to denote repetition inside line; quiet parameter to echo quiet, find quiet, line quiet, message quiet, persistent quiet, sort quiet.

New command line options include -nosettag; -noremovecomment, -assign.

Other features include support for the Z0 syntax for inputting null moves and improved error reporting in some cases.

Back-compatibility with CQL 6.0

CQL 6.1 is generally back compatible with CQL 6.0. The back compatibility is achieved primarily by treating heretofore mandatory string arguments to certain filters as optional parameters. For example, in CQL 6.0
site "Zee"

would match any game whose "Site" tag value contained the string Zee. This filter does exactly the same thing in CQL 6.1, but the way it does it is different. The filter

has value equal to the site of the game, as a string. The argument "Zee" is an optional implicit search parameter:
site "Zee"
    "Zee" in site