Formal Query Syntax

The following is a summary of the allowed syntax for query expressions.

query ::= predicates
predicates ::= predicate |
    "not" predicate |
    predicate "intersection" predicates |
    "not" predicate "intersection" predicates |
    predicate "union" predicates |
    "not" predicate "union" predicates |
    predicates sort
predicate ::= "[" attribute_comparision "]"
sort ::= "sort" identifier | "sort" identifier "asc" | "sort" identifier "desc"
attribute_comparision ::= identifier comp_op constant |
    identifier comp_op constant "and" attribute_comparision |
    identifier comp_op constant "or" attribute_comparision |
identifier ::= quoted (single quotes) UTF-8 string (any quotes within the string have to be properly escaped)
constant ::= quoted (single quotes) UTF-8 string (any quotes within the string have to be properly escaped)
comp_op ::= "starts-with" |
        "does-not-start-with" |
        "=" |
        "<" |
        ">" |
        "<=" |
        ">=" |
        "!="