12. Appendix: Query Language Quick Reference

Reserved symbols

All the operators and built-in types which are listed below are reserved symbols. In particular, this means that the use of the following characters

 ! " # $ & ( ) * + , - . / : ; = > ? @ | { }

in edge labels, strings, constants, predicate or type names may cause problems. In these cases, a preceding operator \ will help. Example:

[word = "\,"]

Built-in types

The sample queries for the built-in types are meant to illustrate the context where a built-in type may occur. However, these queries are not really meaningful, since they are too general.

Symbol Meaning Sample query
Constant constants [word = Constant]
String strings [word = String]
UserDefConstant user defined constants [pos=UserDefConstant]
FREC feature records [FREC]
NT feature records for nonterminals [NT]
T feature records for terminals [T]

Constants

" constant mark [word = "Geld"]

Regular expressions for constants

/ regular expression mark [word = /Geld/]
. unspecified character [word = /sag./]
* unrestricted repetition [lemma = /spiel.*/]
+ repetition with minimum 1 [word = /.+[0-9A-Z]+.*/]
? optionality [word = /(Leben)s?/]
[ ] character set [word = /.+[0-9A-Z]+.*/]
^ negated character sets [word = /[^0-9A-Z].*/]
( ) grouping [word = /([lmnp][aeiou])+/]
| disjunction [word = /[dD](as|er)/]
\ escape for reserved characters [word = /.*\-.*/]

Feature-value pairs

= feature-value pair [pos = "NN"]
!= negated feature-value pair [pos != "NN"]

Graph predicates

root() root of a graph root(#n)
arity( , )
arity( , , )
arity of a node arity(#n,2)
arity(#n,2,4)
tokenarity( , )
tokenarity( , , )
number of dominated leaves tokenarity(#n,5)
tokenarity(#n,5,8)
continuous( ) continuous leaves continuous(#n)
discontinuous( ) discontinuous leaves discontinuous(#n)

Dominance relation

>L labelled direct dominance [cat="NP"] >NK [cat="NP"]
[cat="NP"] >OA\-MOD [cat="NP"]
> direct dominance [cat="NP"] > [pos="NE"]
>* dominance [cat="NP"] >* [pos="NE"]
>$ dominance, distance n [cat="NP"] >2 [pos="NE"]
>m,n dominance, distance m..n [cat="NP"] >2,3 [pos="NE"]
>@l left corner [cat="NP"] >@l [word="die"]
>@r right corner [cat="NP"] >@r [word="Jahr"]
$ siblings [word="die"] $ [cat="NP"]
$.* siblings with precedence [word="etwas"] $.* [cat="NP"]
!>L neg. labelled direct dominance [cat="NP"] !>GR [cat="NP"]
!> neg. direct dominance [cat="NP"] !> [pos="NE"]
!>* neg. dominance [cat="NP"] !>* [pos="NE"]
!>n neg. dominance, distance n [cat="NP"] !>2 [pos="NE"]
!>m,n neg. dominance, distance m..n [cat="NP"] !>2,3 [pos="NE"]
!>@l neg. left corner [cat="NP"] !>@l [word="etwas"]
!>@r neg. right corner [cat="NP"] !>@r [word="etwas"]
!$ neg. siblings [word="etwas"] !$ [cat="NP"]
>~L labelled secondary edge [cat="VP"] >~HD [cat="NP"]
>~ secondary edge [cat="VP"] >~ [cat="NP"]
!>~L neg. labelled secondary edge [cat="VP"] !>~HD [cat="NP"]
!>~ neg. secondary edge [cat="VP"] !>~ [cat="NP"]

Precedence relation

. direct precedence [word="die"] . [pos=noun]
.* precedence [word="die"] .* [pos="NN"]
.n precedence, distance n [word="die"] .2 [pos="NN"]
.m,n precedence, distance m..n [word="die"] .2,4 [pos="NN"]
!. neg. direct precedence [word="etwas"] !. [pos="NN"]
!.* neg. precedence [word="etwas"] !.* [pos="NN"]
!.n neg. precedence, distance n [word="etwas"] !.2 [pos="NN"]
!.m,n neg. precedence, distance m..n [word="etwas"] !.2,4 [pos="NN"]

Variables

[f=#v] variable for a feature value [pos=#x:("NN"|"NE")] . [pos=#x]
[#x] variable for a feature description [#x:(pos="APPR")] .* [#x]
#n variable for a node identifier #n:[cat="NP"] & #n > [pos="ADJA"]) & #n > [pos="NN"]

Boolean expressions

( ) bracketing [pos=(!("NN" | "ART"))]
! negation (feature values) [pos=(!"NN")]
negation (feature constraints) [!(pos="NN")]
& conjunction (feature values) [pos=(!"NN" & !"NE")]
conjunction (feature constraints) [pos="NE" & word="Bonn"]
conjunction (graph descriptions) #n1>#n2 & #n3.#n2
| disjunction (feature values) [pos=("NN" | "NE")]
disjunction (feature constraints) [pos="NE" | word="es"]
disjunction (graph descriptions) #n1>#n2 | #n1>#n3

Please note: Negation (!) must not have scope over variables.

Please note: A Boolean expression for a feature value must always be put into parentheses (e.g. pos=("NN"|"NE")).

Comments

// line comment [pos="NE"].[pos="NE"] // 2-word proper nouns