Treebank StudioDocumentation

Relations

This page defines every relation of PaCQL exactly: when it holds, what it does with punctuation, traces and words, how its negation works, and how it compares with CorpusSearch. The reference gives the same relations in short tables, and the tutorial introduces them with examples.

Every line of a query is one of four kinds:

Reading the definitions

Trees and notation

A corpus is a set of trees. A tree has nodes, each with a label, and terminals: the words, punctuation marks and empty categories (*T*-1, *pro*, 0) at the bottom of the tree. Terminals are not nodes in PaCQL. A terminal belongs to the node right above it, and one-node relations such as idomsleaf reach it from there. The terminals of a tree are numbered 1, 2, 3, … from left to right, all of them, including punctuation and empty categories. The definitions use this notation for nodes x, y:

x ⊳ yx immediately dominates y: x is the mother of y, written mother(y) = x
x ⊳⁺ yx dominates y: there is a chain x ⊳ … ⊳ y of one or more steps (so never x ⊳⁺ x)
children(x)what stands right under x, nodes and terminals, in order
children°(x)children(x) without the skipped nodes (terminals and traces stay)
first(x), last(x)the numbers of the first and the last terminal under x. Every node has at least one terminal under it
label(x)x's label without a final -n index: NP-SBJ-1 is NP-SBJ. A gapping index stays: IP-MAT=1 is IP-MAT=1
idx(s)the index of a label or terminal s: the number after its last - or =, if s ends in one (NP-SBJ-1, IP-MAT=1, *T*-1: 1); otherwise none
word(x)the terminal that is x's first child, if its first child is a terminal; otherwise x has no word. In corpora with lemmas, without the lemma
lemma(x)the lemma of that terminal, if it has one
words(x)the words under x: terminals that are not punctuation, CODE, empty categories or markup. A word split by the annotation (mál$ $inu) counts as one

Skipped nodes are punctuation and CODE nodes. Which labels these are is set for each corpus. As in CorpusSearch (its ignore_nodes), broad patterns do not match them, and the relations that count or look at neighbours pass over them, as each entry below says.

Patterns

A name such as NP-SBJ or IP-(MAT|SUB) is a pattern for labels. L(P) is the set of labels that the pattern P matches:

  1. P is a regular expression (Python's syntax) that must match the whole label(x). NP does not match NP-SBJ; NP.* does. A|B means exactly A or exactly B. A ^ after another character is a character of the label (IPCHG: N^A^SG).
  2. If the labels that P matches include any label of a node that is not skipped, the labels of skipped nodes are left out, except a label written exactly as P. Otherwise all are kept. So .* matches no punctuation; , and \. match only punctuation; . matches C, P and the period.
  3. !P matches the labels that .* matches and P does not: L(!P) = L(.*) − L(P).
  4. A number prefix makes a separate name with the same pattern: [1]NP.* and [2]NP.* both mean NP.*. ![1]P and [1]!P are the same.

Words and lemmas are matched in the same way: a regular expression for the whole word or lemma. In single quotes case is ignored ('guð' matches guð and Guð). In double quotes, or without quotes, it is not. A word pattern !w matches a word (or lemma) that is there and that w does not match: for a word s, s ≠ none and s ∉ W(w), where W(w) is the set of words w matches. In quotes the ! goes inside: '!hann', 'í !gær'. A lone ! is the exclamation mark. The same holds for the kinds of empty category (idomsempty !T: an empty category of another kind).

Names and results

Each name in a query stands for one node. A name is introduced by a two-node relation (both its sides) or by an exists line. One-node relations and negated lines only test nodes that other lines name.

A binding assigns a node of one tree to every name, so that:

  1. different names get different nodes, also when their patterns overlap;
  2. each node fits its name: its label is in L(name), or, for a name introduced by an exists line, it passes that line's test;
  3. every line of the section holds.

The first name of the first line is the anchor, unless another name is made the anchor by prefixing it with @. The query has one result for each node that is the anchor of at least one binding, however many bindings it has. The other nodes only have to exist; nothing is used up, so one node can serve several anchors.

A first section with no two-node relations, only one-node relations, finds the node of each line anywhere in the tree, as an exists line would. Once a section has a two-node relation, every name in a one-node relation must also appear in a two-node relation (so a mistyped name is reported rather than searched for elsewhere).

After an empty line that follows the main query section, other sections can follow. This includes coding sections, which code variables that appear in the structure being matched, resulting in columns in the tsv output that can be used in statistical analysis, disjunction sections (either:/or:) and negation sections none:.

It is an important principle in the design of this query language that there is only one result per anchor. Since the anchor is the first name of the first line, (unless another anchor is explicitly selected with the @-prefix, see below) it matters what is written first. It is common to search for a pattern associated with a clause whose label starts with IP-. It is natural to start such a query with a name that matches this clause type and build the query from that with the IP- node, e.g. IP-MAT (finite main clause) or IP-INF (infinitival clause), as the anchor. The following queries illustrate the importance of which node is the anchor. The first query has IP-MAT (the main clause) as the anchor, because it is the first name, and it returns 60,368 rows in IcePaHC 2024.03. For any IP-MAT, the query returns a result if it dominates any NP (NP.*), i.e., the result count reflects how many main clauses dominate noun phrases.

IP-MAT doms NP.*
This second query is the same except here the @-prefix is used to make the noun phrase the anchor. In the same corpus, this returns 324,148 results, which reflects how many noun phrases are dominated by a main clause. There are many more noun phrases than main clauses and most noun phrases are dominated by main clauses; note that doms matches at any depth in the tree, including inside subordinate clauses.
IP-MAT doms @NP.*

While the @-prefix is a convenient way to change which node is the anchor, it is worthwile to point out that the query below is equivalent to the previous one. The name NP.* is the same in both lines, so both lines are about the same node, and both must be true to return a result. Since NP.* is now the first name of the first line, it is the anchor, even without using the @-prefix to pick out an anchor. Here, labelexists is an exists line: it finds a node whose label matches NP.* anywhere in the tree. The second line adds that this noun phrase is dominated by a main clause. This query returns the exact same 324,148 results.

NP.* labelexists
IP-MAT doms NP.*
Only one name in the query can have the @ prefix. The anchor symbol can be written before any occurrence of that name, and if the name has other prefixes, @ must be the first one (e.g., preceding a number prefix (@[2]NP), label negation (@!PRO), or both, in either order (@[1]!PRO or @![1]PRO).

Negation

A two-node relation can be negated with !: A !idoms B. A must be named by a line that is not negated. What the line means depends on B:

The Logical operations page sets out how negation works together with and and or.

A one-node relation can also be negated, apart from the two lowest string relations: A !rel v keeps the node a only if the relation does not hold for it (NP-SBJ !domsstring 'hann': the subject does not contain hann). The node is found as without the !: by another line, or by the line itself when the section has no two-node relation. A negated exists line says that no node of the tree passes its test (exists).

The second bullet above means that the B node in a negated relation, when it is not named by any non-negated line, is a new node like any other: it cannot be a node that a different name in the same query stands for, even when their patterns overlap. To illustrate this, consider the following query. Here, the NP.* pattern is not used in a non-negated relation, and it cannot match the same node as NP-SBJ in the tree. The query looks for a main clause with a noun phrase daughter that is a subject while the same main clause does not have any other daughter that is a noun phrase. The query returns main clauses whose only NP daughter is their subject, a total of 33,792 results in IcePaHC 2024.03. This excludes clauses that have objects (direct or indirect) as well as clause-level NP adverbials.

IP-MAT idoms NP-SBJ
IP-MAT !idoms NP.* 

The above use of relation negation gives the same results as a negation section (none:) with the same line, as the query below demonstrates. A node introduced in a negation section under a name that does not appear in the main section is a new node, and it must differ from the main section’s nodes. A negation section only applies to the main section: it cannot use names that appear only in coding sections or in either/or sections (that is an error), and its new nodes may coincide with nodes those sections find. A negation section is needed when what is ruled out takes more than one line.

IP-MAT idoms NP-SBJ

none:
IP-MAT idoms NP.*

The new node of a negated relation is looked for in the whole tree, not only in the clause that A belongs to. This matters for relations that reach beyond a clause, such as precedes. The first query below finds main clauses with a finite verb that no object follows anywhere in the tree, so an object of a later clause counts too (5,582 in IcePaHC 2024.03). The second, with a none: block, finds main clauses where no object of this clause follows the verb (7,714). The second is usually what is meant: name the clause in the lines that are ruled out.

IP-MAT idoms VBPI
VBPI !precedes NP-OB1
IP-MAT idoms VBPI

none:
IP-MAT idoms NP-OB1
VBPI precedes NP-OB1
Consider also the contrast between the next two queries where the first one negates the idoms relation and the second one negates the pattern that matches the label on the node that is the daughter of the subject. The following query returns main clauses (IP-MAT) that immediately dominates a noun phrase subject (NP-SBJ) and the subject node does not have a daughter that has the PoS-tag of a pronoun, i.e., the main clause has a subject and the subject is not a pronoun, for a total of 37,759 results.
IP-MAT idoms NP-SBJ
NP-SBJ !idoms PRO.*
In contrast, the query below matches a main clause that also has a noun phrase subject, but here, the subject does have a daughter that is not a pronoun (the negation applies to the pattern that matches the PoS-tag). This yields 25,823 results.
IP-MAT idoms NP-SBJ
NP-SBJ idoms !PRO.*
The queries match the same trees in many cases, but the latter does not match empty subjects like in the following clause where conjunction reduction has applied as indicated by *con*. The empty category below the subject is a terminal, and in PaCQL, terminals are not nodes. Therefore, idoms, which relates two nodes, will not match anything with NP-SBJ idoms !PRO.* in this tree.
(IP-MAT
  (CONJ en)
  (NP-SBJ *con*)
  (BEDI var)
  (ADVP
    (ADV þó))
  (ADJP
    (ADVR betur)
    (NP
      (NS-D bæjum))
    (VAN skipað))
  (PP
    (P á)
    (NP
      (NS-D dögum)
      (NP-POS
        (NPR-G Síðu<dash/>Halls))))
  (. ,))

Applying negation to a one-node relation as opposed to not applying it splits the set matched by the one name. A query that uses idomstotal to find direct objects with one daughter each finds 23,146 results in IcePaHC 2024.03:

NP-OB1 idomstotal 1

Negating the relation yields 24,022 results:

NP-OB1 !idomstotal 1

The total number of NP-OB1 nodes in the corpus is 47,168 as confirmed by looking up all of them with exists. This adds up correctly, since 23,146 + 24,022 = 47,168.

NP-OB1 exists
In general, negation is allowed on one-node relations, except for domsstringlowest and domslemmastringlowest where negating the relation would not have a sensible meaning.

Two-node relations

Each of these relates the node of the name on the left, a, to the node of the name on the right, b. Both names introduce nodes.

idoms

A idoms B: A immediately dominates B (B is a child of A).

Definition
a ⊳ b
Notes
B is a node. To find a word under A, use idomsleaf; for an empty category, idomsempty. A word or a trace written where a label belongs (NP idoms maður, NP-SBJ idoms \*T*) is an error that says so.
Negation
A !idoms B: A has no child that matches B.
CorpusSearch
iDoms. In CorpusSearch B can also be a word.
Also written
iDominates, idominates, iDoms
This relation is used to match a node and its daughter and in the tradition of the Penn historical corpora, common use cases include relating some type of a clause, e.g., a label like IP-MAT for finite main clause or IP-SUB for finite subordinate clause, with a clause level constituent like a subject (NP-SBJ) or a direct object (NP-OB1). The query below matches trees where a finite main clause immediately dominates a subject and the same subject node immediately dominates a PoS-tag node with any label that ends with -D (here, the .* pattern is a regular expression for any character, any number of times, e.g., any string). Writing the name NP-SBJ twice in the same query means the same node in both idoms relations. In the IcePaHC corpus, words in the dative case have PoS-tags ending with -D and therefore this query returns main clauses with dative subjects.
IP-MAT idoms NP-SBJ
NP-SBJ idoms .*-D
(IP-MAT
  (CONJ og)
  (VBDI þótti)
  (NP-SBJ
    (PRO-D honum))
  (ADJP
    (ADV harla)
    (ADJ-N vænt))
  (PP
    (P um)
    (NP
      (PRO-A hana)))
  (. ;))
Similarly, to find main clauses with direct objects that are conjunctions of two or more noun phrases, the following query can be used to match a conjunction phrase CONJP that is the daughter of NP-OB1.
IP-MAT idoms NP-OB1
NP-OB1 idoms CONJP
(IP-MAT
  (CONJ og)
  (VBPI lofar)
  (NP-SBJ
    (Q-N hver)
    (N-N maður))
  (NP-OB1
    (N-A hreysti)
    (NP-POS
      (NPR-G Orms))
    (CONJP
      (CONJ og)
      (NX
        (N-A framgöngu))))
  (. .)) 
Negating the second idoms relation with !idoms finds main clauses that do have direct objects (NP-OB1), but ones that are not conjoined noun phrases, i.e., the direct object phrase does not immediately dominate a CONJP.
IP-MAT idoms NP-OB1
NP-OB1 !idoms CONJP
(IP-MAT
  (PP
    (P í)
    (NP
      (NP-POS
        (NPR-G Indriðahólssveitar))
      (N-A kirkjubók)))
  (VBDI fundu)
  (NP-SBJ
    (PRO-N þeir))
  (NP-OB1
    (N-A nafn))
  (. ,))

idomsfirst

A idomsfirst B: B is A's first child.

Definition
a ⊳ b, and b is the first element of C(a, b), where C(a, b) = children°(a) if b is not a skipped node, and children(a) if it is
Notes
Punctuation and codes in front of B do not count: in (IP-MAT (, ,) (NP-SBJ …) …) the subject is the first child. Traces are nodes like any other and do count. A skipped node named in the query (IP-MAT idomsfirst ,) is counted among all children.
Negation
A !idomsfirst B: A's first child does not match B.
CorpusSearch
iDomsFirst, with the same skipping.
Also written
iDomsFirst

idomslast

A idomslast B: B is A's last child.

Definition
a ⊳ b, and b is the last element of C(a, b) (as for idomsfirst)
Notes
A subject followed only by the final period is last.
Negation
A !idomslast B: A has no last child that matches B.
CorpusSearch
iDomsLast, with the same skipping.
Also written
iDomsLast

idomsonly

A idomsonly B: B is A's only child.

Definition
a ⊳ b, and C(a, b) has exactly one element (as for idomsfirst)
Notes
(NP (N man) (. .)): the N is the only child.
Negation
A !idomsonly B: A does not have a B as its only child.
CorpusSearch
iDomsOnly, with the same skipping.
Also written
iDomsOnly

idomsnumber

A idomsnumber n B: B is A's n-th child.

Definition
a ⊳ b, and b is element number n of C(a, b), counting from 1 (as for idomsfirst)
Notes
n is a whole number from 1 up. idomsnumber 1 is idomsfirst.
Negation
A !idomsnumber 2 B: A's second child does not match B.
CorpusSearch
iDomsNumber. Identical results on PPCME2, PPCEME and YCOE (50,750 matches), except one PPCEME tree where CorpusSearch also skips the word '.
Also written
iDomsNumber, iDomsNum, idomsnum

doms

A doms B: A dominates B, at any depth.

Definition
a ⊳⁺ b
Notes
A node does not dominate itself. Every node above B that matches A is found, up to the root; for only the lowest one, use domslowest. To keep out of subordinate clauses and the like, use domslocal.
Negation
A !doms B: there is no B anywhere inside A.
CorpusSearch
Doms (dominates).
Also written
Dominates, dominates, Doms

domslowest

A domslowest B: A dominates B, and A is the lowest node of its kind above B.

Definition
a ⊳⁺ b, and there is no node m with a ⊳⁺ m ⊳⁺ b that fits A: label(m) ∈ L(A), or, if A is introduced by an exists line, m passes its test
Notes
Only A's pattern decides what stands in the way. With NP.*|PP as A, both NPs and PPs do; nodes of other labels never do. NP.* also matches NPR. With .* as A, the relation is nearly idoms. B never stands in its own way: [1]NP.* domslowest [2]NP.* is an NP with another NP inside it and no NP between them. Each B is looked at on its own: an A that is the lowest for one B and not for another is found.
Negation
A !domslowest B: A is not the lowest A above any B (which includes an A with no B inside).
CorpusSearch
None. PaCQL's own (19 November 2026).
Also written
DomsLowest, domsLowest
Former name
domsclosest (until 23 November 2026); still works for now, with a notice

domslocal

A domslocal Z B: A dominates B, and no node in between matches Z.

Definition
a ⊳⁺ b, and there is no node m with a ⊳⁺ m ⊳⁺ b and label(m) ∈ L(Z)
Notes
For locality: doms that does not look into subordinate clauses, or whatever Z names. Z is a label pattern, as for idomsmod (which names the labels allowed in between; domslocal names those that are not). Only the nodes strictly between A and B count: A and B may themselves match Z. IP-SUB.* domslocal IP-SUB.* NEG is a negation in this subordinate clause and not in one inside it; IP-MAT domslocal IP-SUB.* IP-SUB.* finds the outermost subordinate clauses. Which labels to name is the user's choice: with IP-SUB.* a complementizer (C, under CP-THT) still belongs to the main clause, with IP-SUB.*|CP.* it does not. A pattern that matches no label keeps nothing out, and the relation is doms.
Negation
A !domslocal Z B: every B inside A is inside a node that matches Z below A (or there is no B).
CorpusSearch
None. PaCQL's own (23 November 2026). In CorpusSearch one removes the subordinate clauses in a first run and searches its output.
Also written
DomsLocal, domsLocal

IcePaHC 2024.03: 27,398 main clauses dominate an object, and 20,286 have one outside their subordinate clauses.

IP-MAT domslocal IP-SUB.* NP-OB1

Of 62,790 subordinate clauses, 6,126 dominate a NEG, but only 4,190 have one of their own; the others have it only in a clause inside them.

IP-SUB.* domslocal IP-SUB.* NEG

idomsmod

A idomsmod Z B: A dominates B, and every node in between matches Z.

Definition
a ⊳⁺ b, and every node m with a ⊳⁺ m ⊳⁺ b has label(m) ∈ L(Z)
Notes
Z is a label pattern, with | for alternatives and ! for "other than". If B is a child of A, nothing is in between and the relation holds.
Negation
A !idomsmod Z B: there is no such B.
CorpusSearch
iDomsMod. Identical results on PPCME2, PPCEME, PPCMBE2 and YCOE, apart from known YCOE annotation oddities.
Also written
iDomsMod

sprec

A sprec B: A and B are sisters, and A comes first.

Definition
mother(a) = mother(b), and a comes before b in children(mother(a))
Notes
Any number of sisters may stand between them. For B right after A, use isprec.
Negation
A !sprec B: no sister of A after it matches B.
CorpusSearch
sPrecedes.
Also written
sPrecedes, sprecedes, sPrec

isprec

A isprec B: A and B are sisters, and B begins right after A.

Definition
A sprec B and A iprecedes B both hold
Notes
The same as writing the two lines. Punctuation and codes between them are passed over, as for iprecedes. It is not "the next sister": a trace between them is a sister and a node, so it is in the way.
Negation
A !isprec B: B does not follow A in this way.
CorpusSearch
None; it combines sPrecedes and iPrecedes.
Also written
isPrecedes, isprecedes, isPrec

hassister

A hassister B: A and B are sisters, in either order.

Definition
mother(a) = mother(b) and a ≠ b
Negation
A !hassister B: no other child of A's mother matches B.
CorpusSearch
HasSister.
Also written
HasSister, hasSister

precedes

A precedes B: A ends before B begins.

Definition
last(a) < first(b)
Notes
Neither node dominates the other. All terminals are counted, so a trace node ((NP-SBJ *T*-1)) has a place in the order and can precede or follow other nodes, although it stands between no words. To leave out such nodes, add domswords> 0.
Negation
A !precedes B: nothing that matches B comes after A.
CorpusSearch
Precedes.
Also written
Precedes, Pres, pres, Prec, prec

iprecedes

A iprecedes B: B begins right after A ends.

Definition
As in CorpusSearch, by a walk through the tree:
  1. If a or b is a skipped node: first(b) = last(a) + 1.
  2. Otherwise, if b is inside a skipped node, it does not hold.
  3. Otherwise, go up from a (a itself, then its mother, and so on) to the first node x that has a later sister which is not a skipped node, and let y0 be the first such sister. Let y1 be the first element of children°(y0), y2 the first of children°(y1), and so on, as long as these are nodes. The relation holds if b is one of y0, y1, … If there is no such x, it does not hold.
Notes
So B is the next constituent after A, or a node at its left edge, at any depth. A and B need not be sisters: N iprecedes VBDI also finds a subject noun right before the verb. Punctuation and codes in between are passed over; traces are not, since they are nodes. A node inside a skipped node can be A, but not B (rare: annotation oddities only).
Negation
A !iprecedes B: what comes right after A does not match B.
CorpusSearch
iPrecedes, the same walk. Checked against CorpusSearch 2.003.04 on PPCME2: identical, apart from the index difference (NEG also matches NEG-1 in PaCQL). CorpusSearch also finds a second node inside a skipped node.
Also written
iPrecedes, iPres, ipres, iPrec, iprec

ccommands

A ccommands B: A c-commands B.

Definition
neither a ⊳⁺ b nor b ⊳⁺ a, and β(a) ⊳⁺ b, where β(a) is the lowest node above a with two or more children. Children of every kind count here: nodes, terminals, skipped nodes and traces
Notes
Sisters c-command each other and everything inside each other. A node below a non-branching mother does not c-command that mother: in (NP (N man)), N does not c-command NP. The root c-commands nothing. Patterns match labels only.
Negation
A !ccommands B: A c-commands no B.
CorpusSearch
cCommands, as its manual defines it. CorpusSearch's program also counts non-branching nodes above a node, which the definition excludes; PaCQL follows the definition.
Also written
CCommands, cCommands

sameindex

A sameindex B: A and B carry the same index.

Definition
I(a) ∩ I(b) ≠ ∅, where I(x) holds idx of x's label as written, if it has one, and idx(word(x)), if word(x) is an empty category (it begins with *) with an index
Notes
So it relates a moved phrase to the node above its trace (WNP-1 … (NP-SBJ *T*-1)), two phrases with the same index, and a clause to its gapped counterpart (IP-MAT-1 … IP-MAT=1): - and = indexes are read alike. Ordinary words do not carry an index (vii-7 is a numeral).
Negation
A !sameindex B: no B carries A's index.
CorpusSearch
sameIndex, which compares the index of the trace itself. PaCQL reads the trace's index on the node above it, since terminals are not nodes.
Also written
SameIndex, sameIndex

idomsviatrace

A idomsviatrace K B: A's trace of kind K leads to an antecedent, and B is a child of that antecedent.

Definition
word(a) is an empty category of kind K (as for idomsempty) with an index i, and the label of mother(b) has the index i
Notes
A is the node right above the trace, such as the empty CP-REL in (CP-REL *ICH*-2). The antecedent's label is not checked: in (ADVP *T*-5) with NP-5, ADVP idomsviatrace T PRO finds a PRO in the NP. To require a label, name the antecedent and use sameindex.
Negation
A !idomsviatrace K B: there is no such B.
CorpusSearch
iDomsViaTrace, as its program works. Its manual says that the antecedent must have A's label, but the program does not check that.
Also written
iDomsViaTrace

One-node relations

These test the node a of a name that another line introduces: its label, its word or lemma, its empty category, how many words or children it has, or which words it contains. In logic they are unary relations, properties of a node: A domswords> 3 is the set of nodes with more than three words. The right side is a value, a parameter that picks one property of a family (one for each number, word pattern or label pattern), not a second node, so it is not a name. On their own (no two-node relation in the section), each line finds its node anywhere in the tree; see names and results.

haslabel

A haslabel P: A's label matches the pattern P.

Definition
label(a) ∈ L(P)
Notes
A's own name is already a pattern, so the node must fit both. P can be !X. A word in quotes is an error here, since a label is meant.
Negation
A !haslabel P: label(a) ∉ L(P). The same as A haslabel !P.
CorpusSearch
hasLabel.
Also written
HasLabel, hasLabel

hasindex

A hasindex: A's label has an index. Nothing follows the relation.

Definition
label(a) as written in the corpus ends in - or = and a number: NP-SBJ-1, WNP-2, IP-MAT=4 (gapping)
Notes
Labels in PaCQL are matched without their index: CP-REL finds CP-REL and CP-REL-1 alike. hasindex tells them apart. Only the node's own label counts, not a trace under it: (NP-SBJ *T*-1) has no index of its own (for traces, see idomsempty and idomsviatrace). In IcePaHC 2024.03, 1,629 of the 13,838 CP-REL nodes have an index.
Negation
A !hasindex: A's label has no index. CP-REL !hasindex (12,209 in IcePaHC 2024.03) finds the nodes CorpusSearch's CP-REL finds.
CorpusSearch
No such function. In CorpusSearch the index is part of the label: CP-REL does not match CP-REL-1, and W*P not WNP-1. Translate such a pattern with !hasindex.
Also written
HasIndex, hasIndex

idomsleaf

A idomsleaf w: A's word matches w.

Definition
word(a) exists and the pattern w matches all of it (in single quotes, ignoring case)
Notes
The word is A's first child, so A is the node right above the word (N, VBDI), and a phrase has no word of its own. Any terminal counts, including punctuation and empty categories (NP-SBJ idomsleaf \*pro\* finds the same 1,706 subjects as NP-SBJ idomsempty *pro*, which is easier to write). w is a regular expression for the whole word: maður does not find manni. In corpora with lemmas, the lemma is not part of the word. A word split by the annotation is two terminals (mál$, $inu); the string relations match it rejoined.
Negation
A !idomsleaf w: A has no word of its own that w matches. Every phrase passes, since a phrase has no word of its own: NP-SBJ !idomsleaf hann finds all subjects. Name the node above the word instead. Compare A idomsleaf !w: A has a word, and w does not match it (PRO-N idomsleaf !hann: 39,396 pronouns other than hann in IcePaHC 2024.03; phrases never match).
CorpusSearch
None as such. CorpusSearch writes N iDoms maður, since its words are nodes; in PaCQL that is an error that points here.
Also written
iDomsLeaf

idomslemma

A idomslemma l: the lemma of A's word matches l.

Definition
lemma(a) exists and the pattern l matches all of it (in single quotes, ignoring case)
Notes
Only in corpora with lemmas; elsewhere the query is an error. A word split by the annotation has a lemma for each part (manninn, manni$ $nn: maður and hinn). taka.* also finds takast.
Negation
A !idomslemma l: A has no lemma that l matches (every phrase passes, as for !idomsleaf). Also only in corpora with lemmas. A idomslemma !l: A has a lemma other than l.
CorpusSearch
None.
Also written
iDomsLemma

idomsempty

A idomsempty K: A's child is an empty category of kind K.

Definition
word(a) ∈ E(K). K is one or more alternatives separated by |, each written as in the corpus (no regular expression). An alternative made of letters, with or without an index (T, T-3), stands for the same with stars (*T*, *T*-3). E(K) holds each alternative, and, for an alternative without an index, that alternative followed by -n or =n
Notes
*T* or T also finds *T*-3; *T*-3 finds only that one; * finds *=1. 0 and * are written as they are. An empty category that does not occur in the corpus is an error. K may be in quotes, as a word can (in single quotes, case is ignored: 'PRO' finds *pro*), and backslashes are ignored, so CorpusSearch's \*T* works.
Negation
A !idomsempty K: word(a) ∉ E(K): A's child is not an empty category of kind K (overt words and phrases pass). A idomsempty !K: A's child is an empty category of another kind (NP-SBJ idomsempty !con: 17,139 empty subjects that are not conjunction reduction).
CorpusSearch
None as such: CorpusSearch writes NP-SBJ iDoms \*T*, which in PaCQL is an error that shows how to write it.
Also written
iDomsEmpty

domswords, domswords<, domswords>

A domswords n: A contains exactly n words (also fewer than, more than).

Definition
|words(a)| = n; for domswords<, |words(a)| < n; for domswords>, |words(a)| > n
Notes
Punctuation, codes, empty categories and markup are not words, and a word split by the annotation counts once (see words(x)). domswords 0 finds empty nodes such as (NP-OB1 *T*-1); domswords> 0 keeps only nodes with words.
Negation
A !domswords n: |words(a)| ≠ n. !domswords> 3 ("not more than 3") is the same as domswords< 4.
CorpusSearch
domsWords, domsWords<, domsWords>.
Also written
DomsWords, domsWords, and the same with < and >

domswordslocal, domswordslocal<, domswordslocal>

A domswordslocal Z n: A has exactly n words outside the nodes below it that match Z (also fewer than, more than).

Definition
|words(a)| − Σ |words(m)| = n, summed over the outermost nodes m with a ⊳⁺ m and label(m) ∈ L(Z) (no node between a and m matches Z); likewise < and >
Notes
Words are counted as for domswords. For the length of a clause without its subordinate clauses: IP-MAT domswordslocal> IP-SUB.* 20. Z is a label pattern, as for domslocal; A itself may match it. A word split by the annotation whose two halves lie on two sides of such a node counts as in the node.
Negation
A !domswordslocal Z n: the count is not n.
CorpusSearch
None. PaCQL's own (23 November 2026).
Also written
DomsWordsLocal, domsWordsLocal, and the same with < and >

IcePaHC 2024.03: 7,893 main clauses have more than 20 words, but only 940 outside their subordinate clauses.

IP-MAT domswordslocal> IP-SUB.* 20

idomstotal, idomstotal<, idomstotal>

A idomstotal n: A has exactly n children (also fewer than, more than).

Definition
|children°(a)| = n, < n or > n
Notes
Punctuation and codes are not counted. Words and traces are: a node right above a word has one child, and so has (NP-OB1 *T*-1).
Negation
A !idomstotal n: |children°(a)| ≠ n; !idomstotal> n is the same as idomstotal< n+1.
CorpusSearch
iDomsTotal, with the same counting.
Also written
iDomsTotal, and the same with < and >

The string relations

The six string relations below share these definitions. The word units of a tree are its words in order, where a word split by the annotation (a part ending in $ and the next one starting with $) is one unit, written rejoined (mál$ $inu is málinu). For the lemma versions, the units are the words themselves, each with its lemma, so a split word gives two units. The right side is a list of patterns p1 … pk in quotes, separated by spaces. An occurrence is a run of k consecutive units whose words (or lemmas) the patterns match, each pattern a whole unit, ignoring case in single quotes. Units are consecutive if only punctuation, codes and empty categories stand between them.

An occurrence is inside a if all its terminals are under a. One word needs no quotes; several do. A string relation can be negated, apart from the lowest ones: A !domsstring "w" means that no occurrence is inside A. A single word in the list can be negated instead: 'í !gær' is í followed by any word but gær.

domsstring

A domsstring "w1 w2 …": A contains these words, in this order, one right after the other.

Definition
some occurrence is inside a
Notes
Every node around the words is found, up to the root: with .* as A, "þvert á móti" gives 74 nodes in IcePaHC 2024.03. For the lowest one only, use domsstringlowest; for nodes that are exactly the words, spansstring.
Negation
A !domsstring "w": A does not contain the words.
CorpusSearch
None. PaCQL's own (18 November 2026).
Also written
DomsString, domsString

spansstring

A spansstring "w1 w2 …": A's words are exactly these.

Definition
some occurrence is inside a, and its terminals include every word under a
Notes
Punctuation and empty categories under A do not matter. This shows which constituents have been made of an expression.
Negation
A !spansstring "w": A's words are not exactly these.
CorpusSearch
None.
Also written
SpansString, spansString

domslemmastring

A domslemmastring "l1 l2 …": A contains words with these lemmas, in this order.

Definition
as domsstring, with the lemma units
Notes
Only in corpora with lemmas. A split word has one lemma per part, so manninn is "maður hinn".
Negation
A !domslemmastring "l".
CorpusSearch
None.
Also written
DomsLemmaString, domsLemmaString

spanslemmastring

A spanslemmastring "l1 l2 …": A's words have exactly these lemmas.

Definition
as spansstring, with the lemma units
Notes
Only in corpora with lemmas. Every part of a split word needs its lemma: "góður maður hinn" for góði maðurinn.
Negation
A !spanslemmastring "l".
CorpusSearch
None.
Also written
SpansLemmaString, spansLemmaString

domsstringlowest

A domsstringlowest "w1 w2 …": A is the lowest node of its kind around these words.

Definition
some occurrence is inside a, and inside no node m with a ⊳⁺ m that fits A (as for domslowest)
Notes
Each occurrence is looked at on its own: if two PPs with the words are inside a larger PP, the two small ones are found and not the larger one. With .* as A, the result is the lowest node of any label: the constituent if the words are one, otherwise the node where they meet. For a single word that is the word's own node (N), so use a phrase label for single words.
Negation
Not allowed; !domsstring is meant (an error message says so). "A smaller node also has the words" is not a useful question.
CorpusSearch
None.
Also written
DomsStringLowest, domsStringLowest
Former name
domsstringclosest (until 23 November 2026); still works for now, with a notice

domslemmastringlowest

A domslemmastringlowest "l1 l2 …": the same with lemmas.

Definition
as domsstringlowest, with the lemma units
Notes
Only in corpora with lemmas.
Negation
Not allowed; !domslemmastring is meant.
CorpusSearch
None.
Also written
DomsLemmaStringLowest, domsLemmaStringLowest
Former name
domslemmastringclosest (until 23 November 2026); still works for now, with a notice

Exists lines

A line of the form X exists (or one of the versions below) introduces the name X for a node anywhere in the tree that passes the line's test. As every name, it is a node other than the nodes of all other names, and other lines can use it. Such a line can be a whole query, with one result per node found.

Negated, X !exists means that no node of the tree passes the test. A negated line introduces no name, so it cannot be the first line, and other lines cannot refer to it.

exists

X exists: a node whose label or word matches X.

Definition
a node x with label(x) ∈ L(X), or with word(x) matched by X as a whole
Notes
For a word, the node found is the one right above it. X takes no quotes here; for a word, wordexists is clearer.
Negation
X !exists: no label or word in the tree matches.
CorpusSearch
exists, which matches the whole terminal; in corpora with lemmas, that is the word and the lemma together (konungur-konungur). PaCQL matches the word.
Also written
Exists

labelexists

X labelexists: a node whose label matches X.

Definition
a node x with label(x) ∈ L(X)
Notes
As the first line it makes X the anchor: NPR.* labelexists before PP domslowest NPR.* gives one result per proper noun. @X on a name of the main section means exactly this line written first; the search reads it so.
Negation
X !labelexists: no node in the tree has such a label.
CorpusSearch
None as such (exists).
Also written
LabelExists, labelExists

wordexists

w wordexists: a node whose word matches w.

Definition
a node x such that word(x) exists and w matches all of it (in single quotes, ignoring case)
Notes
The name is the word as written, quotes included: after 'guð' wordexists, other lines write NP-SBJ idoms 'guð'. guð, "guð" and 'guð' are three different names.
Negation
w !wordexists: the word does not occur in the tree.
CorpusSearch
None as such (exists).
Also written
WordExists, wordExists

lemmaexists

l lemmaexists: a node whose word has a lemma that matches l.

Definition
a node x such that lemma(x) exists and l matches all of it (in single quotes, ignoring case)
Notes
Only in corpora with lemmas.
Negation
l !lemmaexists.
CorpusSearch
None.
Also written
LemmaExists, lemmaExists

Word lookups

A word lookup finds a node by the words of the text: stringexists a string, near two words or strings close to each other, and their lemma versions. As the first line it finds the lowest node holding the words, one result per such node. It is not a name, so other lines cannot refer to it; after the first line it only says that the tree has the words. Negated, it says that the tree does not have them.

stringexists

'w1 w2 …' stringexists: these words, anywhere in the tree.

Definition
As the first line: a node x that is not skipped, with an occurrence (see the string relations) inside x and inside no node below x that is not skipped: the lowest node holding the words, one per occurrence. The same nodes as .* domsstringlowest. After the first line: the tree has an occurrence; no node is introduced
Notes
The phrase is not a name, so other lines cannot refer to it; for a node with the words, use domsstring and the other string relations. Because the line introduces no node after the first line, it says exactly "the tree has these words", unlike wordexists.
Negation
'w' !stringexists: the tree does not have the words.
CorpusSearch
None.
Also written
StringExists, stringExists

lemmastringexists

'l1 l2 …' lemmastringexists: words with these lemmas, anywhere in the tree.

Definition
as stringexists, with the lemma units
Notes
Only in corpora with lemmas.
Negation
'l' !lemmastringexists.
CorpusSearch
None.
Also written
LemmaStringExists, lemmaStringExists

near

S near n T: two words or strings with at most n words between them, in either order.

Definition
S and T are each one word, or words in quotes, read as the right side of the string relations, so each has occurrences among the word units. Let the units be numbered 1, 2, … in the tree. Occurrences s of S and t of T are near if they share no unit and the number of units strictly between them is at most n: for s before t, first(t) − last(s) − 1 ≤ n. As the first line: a node x that is not skipped, such that for some near pair all its terminals are under x and under no node below x that is not skipped: the lowest node holding the pair, one per node. After the first line: the tree has a near pair; no node is introduced
Notes
The distance counts words as the text column does: punctuation, codes, traces and other empty categories are not counted, and a split word is one word (manninn near 0 sá; a pattern for half of it, manni, matches nothing). near 0 means next to each other. For words far apart the node found is the clause or the whole sentence. The line is not a name, so other lines cannot refer to it, and words in it are not replaced by define:.
Negation
S !near n T: the tree has no near pair.
CorpusSearch
Its neighborhood (in the manual's part on POS-tagged corpora) is similar but counts every word node that is not ignored, so traces and the halves of a split word are steps; it takes labels as well as words. In PaCQL neighborhood is an error that points here.
Also written
Near

lemmanear

S lemmanear n T: the same with lemmas.

Definition
as near, with the lemma units (each word terminal with its lemma, so a split word gives two). The distance is still counted in words: a lemma is placed on the word (word unit) it is part of, and the units between are the words strictly between the word of last(s) and the word of first(t). The pair may not share a lemma unit. Two lemmas of one split word are 0 words apart.
Notes
Only in corpora with lemmas. maður lemmanear 0 hinn finds manninn (manni$ $nn) as well as maður hinn; near 2 and lemmanear 2 measure the same distance.
Negation
S !lemmanear n T.
CorpusSearch
None.
Also written
LemmaNear, lemmaNear