((META (EMPTY-STRING title "Formal syntax of query expressions") (WORD role "manual") (TAG-SET tags ("#manual" "#reference" "#search" "#zettelstore")) (WORD syntax "zmk") (ZID-SET back ("00001007700000")) (ZID-SET backward ("00001007700000")) (NUMBER box-number "1") (STRING copyright "(c) 2020-present by Detlef Stern ") (TIMESTAMP created "20220810144539") (WORD lang "en") (EMPTY-STRING license "EUPL-1.2-or-later") (TIMESTAMP modified "20240219155949") (TIMESTAMP published "20240219155949") (WORD visibility "public")) (BLOCK (VERBATIM-CODE () "QueryExpression := ZettelList? QueryDirective* SearchExpression ActionExpression?\nZettelList := (ZID (SPACE+ ZID)*).\nZID := '0'+ ('1' .. '9'') DIGIT*\n | ('1' .. '9') DIGIT*.\nQueryDirective := ContextDirective\n | IdentDirective\n | ItemsDirective\n | UnlinkedDirective.\nContextDirective := \"CONTEXT\" (SPACE+ ContextDetail)*.\nContextDetail := \"FULL\"\n | \"BACKWARD\"\n | \"FORWARD\"\n | \"COST\" SPACE+ PosInt\n | \"MAX\" SPACE+ PosInt.\nIdentDirective := IDENT.\nItemsDirective := ITEMS.\nUnlinkedDirective := UNLINKED (SPACE+ PHRASE SPACE+ Word)*.\nSearchExpression := SearchTerm (SPACE+ SearchTerm)*.\nSearchTerm := SearchOperator? SearchValue\n | SearchKey SearchOperator SearchValue?\n | SearchKey ExistOperator\n | \"OR\"\n | \"RANDOM\"\n | \"PICK\" SPACE+ PosInt\n | \"ORDER\" SPACE+ (\"REVERSE\" SPACE+)? SearchKey\n | \"OFFSET\" SPACE+ PosInt\n | \"LIMIT\" SPACE+ PosInt.\nSearchValue := Word.\nSearchKey := MetadataKey.\nSearchOperator := '!'\n | ('!')? ('~' | ':' | '[' | '}').\nExistOperator := '?'\n | '!' '?'.\nPosInt := '0'\n | ('1' .. '9') DIGIT*.\nActionExpression := '|' (Word (SPACE+ Word)*)?\nAction := Word\n | 'ATOM'\n | 'KEYS'\n | 'N' NO-SPACE*\n | 'MAX' PosInt\n | 'MIN' PosInt\n | 'REDIRECT'\n | 'REINDEX'\n | 'RSS'\n | 'TITLE' (SPACE Word)* .\nWord := NO-SPACE NO-SPACE*")))