How to Build a Query using Proximity Operators

The examples shown are based on the Children & Happiness sample projects part 1. You can download and import it, if you want to follow along.

Example 1

Open the Query Tool by selecting the Analyze tab and from there click Query Tool.


Is positive and negative perception of parenthood related to the attitude whether having children contribute to happiness?

These aspects are captured by the code groups: "positive effects of parenting" and "negative effects of parenting", and the codes "children > happiness" and "children < happiness"

Select the operator Co-occurs in the ribbon.

Example Co-occur query step 1

As all proximity operators need two arguments, you see two nodes with a red dot that can be filled with codes or code groups. You recognize the active node by the blue frame.

Select the code "children > happiness" to fill the node on the left-hand side. You can also drag and drop a code or code group to the node, or click on the Add button in the ribbon. The results of this first part of the query will immediately be displayed in the result pane.

Select the code group "Positive effects of parenting" to fill the node on the left-hand side. The result of this query are 8 quotations.

Example Co-occur query step 1

The status bar at the bottom of the screen shows the total number of quotations this query results in.

You can read the query as follows:

Remember that the position of the code or code group in a query with proximity operators matters. The quotations displayed in the result pane are those quotations linked to the code (or argument) on the left-hand side of the query. Note that the Co-occurs icon shows a black and white field. The black field represents the quotations that are shown (see image).

If you got the arguments the wrong way around, you can swap them by clicking on the Swap button in the ribbon.

To see how the attitude "children > happiness" relate to "Negative effects of parenting", select the code group "Positive effects of parenting" and Delete it from the query.

Deleting an argument in a query

Replace it with the see code group "Negative effects of parenting". The result will be 0 quotations.

Next, test whether there is a relation between the attitude "children < happiness" and a negative perception of parenting by replacing the code on the left-hand side:

Testing hypotheses with a query

Example 2

In the following example, two proximity operators are used in one query.

Question Do respondents who mentioned positive effects of parenting also mention negative aspects?

As mentioned positive and negative effects do not necessary co-occur directly, the task is to find both aspects in the larger context of the entire comment written by each person. This larger context has been coded with the code "blog comment".

Select the operator Encloses in the ribbon. Enter the code "Blog comment" on the left-hand side, and the code group "Positive effects of parenting" on the right-hand side.

First step in the query with two proximity operators

Next, select the operator Co-occurs from the ribbon. The first query now becomes one of the arguments for the second part of the query. Add the code group "Negative effects of parenting" to the empty node.

Second step in the query with two proximity operators

The result shows 11 quotations (if you check the status bar on your screen). As the code "blog comments" has been entered on the left-hand side, each results reflects one comment. So we know that 11 respondents have been writing about both positive and negative effects of parenting.

You can rotate the layout of a query by clicking on the Rotate layout button in the ribbon.

Inspecting the Results of a Query

If you click on an operator node, the quotations resulting from the query will be displayed in the result pane. If you click on any other node in the query, the respective results of the selected node will be shown.

The results of a query are shown in the Quotation Reader. The full functionality of the quotation reader is also available here.

Options of the Result Pane

If you click on the Eye icon, you can change the view mode. Available options are:

  • single line
  • small preview
  • large preview
  • show quotation comments
  • show margin

When you click on the Burger icon you can export the results of the query to Excel.

Options in the result window

Removing a Query or an Argument

To delete a query, click on the operator node and select Delete in the ribbon, or the Delete key on your keyboard.

If you only want to delete an argument (i.e. a code or code group) from the query, click on the respective node and then on the Delete button in the ribbon, or the Delete key on your keyboard.

Delete query or an argument