The informative Topic Maps website maintained by
Michel Biezunski (InfoLoom) and
Steven R. Newcomb (Coolheads Consulting)

A draft statement of requirements for a comprehensive topic map query language.

Proposers: Michel Biezunski and Steven R. Newcomb.

Note: As detailed below within square brackets [], the results of certain query types can become parameters to certain subsequent queries.

Note: "Scope matching expressions" are discussed at the end of the list.

Three Kinds of Queries

(1) Queries that return "hit lists" where each "hit" is a topic:

  • (a) What topics have "[list of names or query returning a hit list of names]" as a name within "[scope matching expression]"?
  • (b) What topics have "[list of occurrences or query returning a hit list of occurrences]" as an occurrence within "[scope matching expression]"?
  • (c) What topics play the role "[list of association role topics or query returning a hit list of association role topics]" in "[list of association type topics or query returning a hit list of association type topics]" associations within "[scope matching expression]"?
  • (d) What topics play the role "[list of association role topics or query returning a hit list of association role topics]" in "[list of association type topics or query returning a hit list of association type topics]" associations wherein "[list of topics or query returning a hit list of topics]" plays "[list of association role topics or query returning a hit list of association role topics]" within "[scope matching expression]"? (This is a refinement of (c), above.)
  • (e) What topics are members of the set of topics that constitutes the scope within which "[list of topics or query returning a hit list of topics]" has the name "[list of names or query returning a hit list of names]"? (Returns a hit list of topics which is the union of the sets of topics that are the selected scopes.)
  • (f) What topics are members of the set of topics that constitutes the scope within which "[list of topics or query returning a hit list of topics]" has the occurrence "[list of occurrences or query returning a hit list of occurrences]"? (Returns a hit list of topics which is the union of the sets of topics that are the selected scopes.)
  • (g) What topics are members of the set of topics that constitutes the scope within which "[list of topics or query returning a hit list of topics]" plays the role "[list of association role topics or query returning a hit list of association role topics]" in "[list of association type topics or query returning a hit list of association type topics]" associations within "[scope matching expression]"? (Returns a hit list of topics which is the union of the sets of topics that are the selected scopes.)
  • (h) What topics are members of the set of topics that constitutes the scope within which "[list of topics or query returning a hit list of topics]" plays the role "[list of association role topics or query returning a hit list of association role topics]" in "[list of association type topics or query returning a hit list of association type topics]" associations wherein "[list of topics or query returning a hit list of topics]" plays (other) "[list of association role topics or query returning a hit list of association role topics]" within "[scope matching expression]"? (Returns a hit list of topics which is the union of the sets of topics that are the selected scopes.)
  • (i) What topic(s) has/have "[list of occurrences or query returning a hit list of occurrences]" as its/their subject indicators?
  • (j) What topic(s) has/have "[list of occurrences or query returning a hit list of occurrences]" as its/their subject constituters?
  • (k) What topics are association type topics?
  • (l) What topics are the association types of "[list of associations or query returning a hit list of associations]"?
  • (m) What topics are association role types?
  • (n) What topics are association role types in "[list of association type topics or query returning a hit list of association type topics]"?
  • (o) What topics play the role "[list of association role topics]" in association "[list of associations or query returning a hit list of associations]"?
  • (p) What topics play the role "[list of association role topics]" in association type "[list of association type topics or query returning a hit list of association type topics]"?

(2) Miscellaneous queries. These return "hit lists" where each "hit" is a topic name, a topic occurrence, or a topic's "subject indicator" or "subject constituter":

  • (a) What are the names of "[list of topics or query returning a hit list of topics]" within "[scope matching expression]". (Returns a hit list wherein each hit is a name of a topic, and the topic of which it is a name.)
  • (b) What are the occurrences of "[list of topics or query returning a hit list of topics]" within "[scope matching expression]". (Returns a hit list wherein each hit is an occurrence, and the topic of which it is an occurrence.)
  • (c) What are the subject indicators of "[topic or query returning a hit list containing exactly one topic]"? (Returns a hit list in which each hit is a subject indicator.)
  • (d) What is the subject constituter of "[topic or query returning a hit list containing exactly one topic]"? (Returns a hit list which is either empty or contains exactly one hit, which is the subject constituter.)

(3) Queries that return "hit lists" where each "hit" is an association between topics:

  • (a) What associations exist within "[scope matching expression]".
  • (b) In which associations does "[list of topics or query returning a hit list of topics]" play a role within "[scope matching expression]". (Returns a hit list of associations and the roles played in each.)
  • (c) In which associations does "[list of topics or query returning a hit list of topics]" play the role "[list of association role topics or query returning a list of association role topics]" within "[scope matching expression]"? (Returns a hit list of associations.)
  • (d) Which associations are of type "[list of association type topics or query returning a hit list of association type topics]"? (Returns a hit list of associations.)

Scope Matching Expressions

The "scope matching expression" feature of many of the above query types is an extremely important aspect of topic map queries. As explained above, a scope is a set of topics used to establish the valid context(s) within which a topic name, a topic occurrence, or an association with one or more other topics, has such a name, occurrence, or role in an association. (Remember: topics do not have scope; rather, their characteristics -- names, occurrences, and the roles they play in associations -- have scope.) Scopes are simply sets of topics, but using them in powerful queries may involve some complexity. Like any other term in a query expression, a scope matching expression is used to suppress the reporting of unwanted "hits". Scope matching expressions may consist of any of the following kinds of selections, arbitrarily grouped (parenthesized) to control the order of operations, joined by logical AND and OR connectors, and optionally negated:

  • (1) Match any scope.
  • (2) Match any scope in which any "[integer]" or more of "[topic list or query returning a hit list of topics]" appear.
  • (3) Match any scope in which any "[integer]" or fewer of "[topic list or query returning a hit list of topics]" appear.
  • (4) Match any scope in which exactly "[integer]" of "[topic list or query returning a hit list of topics]" appear.