#How to Build a Query using a Mix of 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.

The instructions below are not as detailed, as it is assumed that you have read the examples for Boolean Queries and Proximity Queries.

Example 1

Question: Find all blog comments written by people who have one child AND who expressed the ambivalence of parenthood that contain a statement that having children made them happier.

The AND query needs to be embedded within the co-occurrence query:

Select the operator AND in the ribbon.

Add code or code groups to the empty nodes via double-click or drag and drop (here: "#fam: 1 child" and "parenthood: ambivalence").

Select the operator Co-occurs and enter a code/code group to the empty node (here: "children: > happiness"). Since the first AND query makes up the argument for the left-hand side of the query, the final query finds all quotations that are co-occurring with the quotations of the first argument.

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.

Example of a complex query

You can read the query as follows: Find all blog comments written by people who have one child AND who expressed the ambivalence of parenthood that contain a statement that having children made them happier.

To explore the data further, you can exchange the single nodes of the query, for example to see whether there are also comments that match the same criteria for people with two children; or to find comments where people with 1 / 2 or more children write that having children made them less happy.

Example of a complex query

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

Example 2

The aim is to find all blog comments written by people who have expressed that children make them happy, that are NOT coded with the code 'parenthood: ambivalence'

Here we have to define two conditions that both must apply:

Blog comments that enclose statements that children mean > happiness. All quotations that have not been coded with 'parenthood: ambivalence' As both conditions must be true, we need to use the AND operator to combine them:

Select the operator NOT in the ribbon.

Add code or code groups to the empty node via double-click or drag and drop (here: "parenthood: ambivalence")

Select the operator AND and instead of adding a code or code group to the empty node, extend the query by selecting the operator Encloses.

Add a code/code group to the empty nodes (here: "blog:comment" and "children: > happiness"). Here it matters again which code/code group is entered on the right or left-hand side of this sub query.

query example with the NOT operator

You can read the query as follows: Find all blog comments written by people who have expressed that children make them happy, that are NOT coded with the code 'parenthood: ambivalence'

To explore the data further, you can exchange for instance the code 'children: > happiness' with 'children: < happiness'.

query example with the NOT operator