This paper describes tolog, a query language for topic maps inspired by Prolog and very similar to Datalog. The language is based on binding variables by matching predicates against the topic map being queried, and contains predicates for querying any aspect of the Topic Maps Data Model (TMDM), and also has support for user-defined predicates. SQL-like features like aggregate functions, projection, ordering, and result set paging. The paper introduces a formal model for topic maps, called Q, and uses this to formally define the semantics of tolog. The built-in predicates are defined, as is the syntax, and some notes on optimization and implementation are provided.