Available Operators for Querying Data

Knowing about the available operators is important when using the Code Co-occurrence Tools, the Query Tool, when creating Smart Codes and Smart Groups. The following types of operators are available:

  • Boolean operators allow combinations of keywords according to set operations. They are the most common operators used in information retrieval systems.

  • Proximity operators are used to analyze the spatial relations (e.g., distance, within/enclosing, overlapping, co-occurrence) between coded data segments.

Boolean Operators

Boolean Operators ATLAS.ti Mac OR, AND, ONE OF (exactly one of the following is true) and NOT

  • OR, AND, and ONE OF (exactly one of the following is true) are binary operators which need exactly two operands as input.
  • NOT needs only one operand.
  • Codes, code groups, or smart codes can be used as operands in a query.

AND: ALL of the following are true

The AND operator finds quotations that match ALL the conditions specified in the query. This means you have applied two or more codes to the same quotation.

Example: All quotations coded with both 'code A' AND 'code B' .

The AND operator is very selective and often produces an empty result set as it requires that the selected codes have all been applied to exactly the same data segment. It produces best results when combined with less restrictive operators or when the overall number of the available text segments is large.

OR: ANY of the following are true

The OR operator does not really match the everyday usage of OR. Its meaning is At least one of..., including the case where ALL conditions match. The OR operator retrieves all quotations that are coded with any of the codes used in the expression.

Example: All quotations coded with 'code A' OR 'code B'. The result list will contain all quotations coded with 'code A' and all quotations coded with 'code B', or quotations coded with both codes.

ONE OF: Exactly one of the following is true

The ONE OF operator asks that EXACTLY one of the conditions must meet. It translates into the everyday either-or.

Example: All quotations coded with EITHER 'code A' OR 'code B' (but not with both).

NOT: None of the following are true

The NOT operator tests for the absence of a condition. Technically, it subtracts the findings of the non-negated term from all data segments available. Given 1000 quotations in the project and 20 quotations assigned to 'code A', the query NOT 'code A' retrieves 980 quotations - those which are not coded with 'code A'.

The operator can be used with an arbitrary expression as in the argument NOT ('code A' OR 'code B') which is the equivalent of neither 'code A' nor 'code B'.

See Example 2 in the section Building Complex Queries.

Proximity Operators

Video Tutorial: Proximity Operators and Example Queries
Proximity Operators ATLAS.ti Mac
Proximity describes the spatial relation< between quotations. Quotations can be embedded in one another, one may follow another, etc. The operators in this section exploit these relationships. They require two operands as their arguments.

Proximity operators differ from the other operators in one important aspect: Proximity operators are non-commutative. This property makes their usage a little more difficult to learn.

  • Quotations enclosing quotations: A ENCLOSES B retrieves all quotations coded with A that contain quotations coded with B.

  • Quotations being enclosed by quotations: A being enclosed by B (WITHIN) retrieves all quotations coded with A that are contained within data segments coded with B.

  • Overlaps (quotation overlapping at start): A OVERLAPS B retrieves all quotations coded with A that overlap quotations coded with B

  • Overlapped by (quotations overlapping at the end): A OVERLAPPED BY B retrieves all quotations coded with A that are overlapped by quotations coded with B.

  • Co-Occurs: Often when interested in the relation between two or more codes, you don't really care whether something overlaps or is overlapped by, or is within or encloses. It this is the case, you simply use the Co-occurs operator.

Co-occur is essentially a short-cut for a combination of the four proximity operators discussed above, plus the operator AND. AND is a Boolean operator, but also finds co-occurrence, namely all coded segments that overlap 100%.

The more general co-occurrence operator is quite useful when working with transcripts. In interviews, people often jump back and forth in time or between contexts, and therefore it often does not make much sense to use the very specific embedding or overlap operators. With other types of data they are however quite useful. Think of video data where it might be important whether action A was already going on before action B started or vice versa. Or if you have coded longer sections in your data like biographical time periods in a person's life and then did some more fine-grained coding within these time periods. Then the WITHIN operator comes in very handy. The same applies when working with pre-coded survey or focus group data. Using WITHIN, you can for instance find all data segments coded with 'topic x' WITHIN 'question 5'; or all data segments coded with 'code A' WITHIN 'speaker unit: Tom'.

Non-commutativity of proximity operators

Non-commutativity requires a certain input sequence for the operands. While A OR B is equal to B OR A, this does not hold for any of the proximity operators: A FOLLOWS B is not equal to B FOLLOWS A. When building a query, always enter the expressions in the order in which they appear in their natural language manifestation.

Another important characteristic for these operators when using the query tool is the specification of the operand for which you want the quotations retrieved. A WITHIN B specifies the constraint, but you must also specify if you want the quotations for the As or the Bs. This is done implicitly by the sequence.

If you enter the query 'A Co-occur B', all quotations coded with A are retrieved.

If you enter 'B co-occur A', all quotations coded with B are retrieved.

For example, if you want to retrieve all segments coded with codes of the code group 'Positive effects of parenting' for all comments written by people with 1 child: 'No. of children: 1 child', the query yields 11 quotations:

Sequence of codes in co-occurrence query ex1 As results, you will get all quotations coded with the codes of the code group 'Positive effects of parenting'.

If you enter the codes in a different order - the code 'No. of children: 1 child' first - then the query retrieves 10 quotations. This is not a mistake, because this time the result will be all quotations coded with the code 'No. of children: 1 child'.

Sequence of codes in co-occurrence query ex2

In the Query Tool, you need to enter the code whose content you are most interested in the first line.