The query Command

The query command creates a reusable object from the query expression parameter of a scan command ( molfile scan , dataset scan , etc.). All commands where such a query expression can be used as a string parameter alternatively accept the handle or reference of a query object in its place.

Additionally, query objects offer method to translate the query from the native toolkit syntax into other formats, such as SQL .


set qh [query create “structure >= c1ncccc1”]
set n [molfile scan $fh $qh count]

This is the list of currently officially supported subcommands:

query create

query create ?querystring?

Create a new query object from a query expression entered as a string. It is possible to omit the query string or pass en empty string or Null . In that case, a query which always matches is created.


set qh [query create {and {E_NMOLECULES = 1} {structure >= c1ncccc1}}]

query delete

query delete all
query delete ?qhandlelist?...

Delete query objects. The special parameter all may be used to delete all queries currently registered in the application. Alternatively, any number of lists of query handles may be specified for specific query deletions.

The command returns the number of deleted queries.


query delete $qhandle

query get

query get qhandle attribute

Get an attribute value of the query objects. Besides the settable attributes listed under query set , the following attributes are read-only:

query list

query list ?pattern?

Return a list of the handles of all currently existing query objects in the application. If desired, the list can be filtered by a string pattern.

query print

query print qhandle

Return the string representation of the query in native toolkit format.

query ref


Python only method to get a query reference from a handle or another identifier.

query set

query set qhandle ?attribute value?...
query set qhandle attributedict
q.att = value
q[att] = value

Configure the query object. The following attributes can be set and also read via query get :

query subcommands

query subcommands

Lists all subcommands of the query command. Note that this command does not require a query handle.