Combinations of tags indicate meta-characteristics of an object. Tag expressions are the mechanism through which objects with specific combinations of attributes can be identified. Specifically, tag expressions are Boolean expressions that delineate a combination of tags that an object must possess. For example, a tag expression could easily be used to determine if an object is a "first-level wizard spell". Separate tag groups could be defined that identify the "class" of the object (fighter, wizard, etc.) and the "level" of the object (1st, 2nd, etc.). An additional tag group could be defined that identifies the "type" of the object (e.g. spell, weapon, skill, etc.). A tag expression could then be written to identify all objects that possess tags for all three characteristics: the "class.wizard" tag, the "level.1" tag, and the "type.spell" tag.
Tag expressions are Boolean expressions comprised of tag terms. The tag expression evaluates each of the tag terms against a particular object to determine whether the object does or does not match the criteria. These terms are then combined using Boolean logic, where the expression specifies the relationships to use. Four Boolean operators are supported, and parentheses may be freely used to define appropriate groupings of sub-expressions. The operators supported are outlined below.
& Logical "And". Evaluates the two terms on either side and returns "true" only if both terms are "true". Example: "term1 & term2". | Logical "Or". Evaluates the two terms on either side and returns "true" if either of the terms is "true". Example: "term1 | term2". ^ Logical "Xor". Evaluates the two terms on either side and returns "true" if exactly one of the terms is "true". Example: "term1 ^ term2". ! Logical "Not". Evaluates the following term and returns "true" if that term is "false". Otherwise, it returns "false". Example: "!term1".
The following are a couple of sample expressions utilizing parenthetical sub-expressions and combinations of the above operators.
(TRUE & FALSE) ^ (TRUE & TRUE) ^ (FALSE & FALSE)
- The above example evaluates to "true". The first term evaluates to "false" and the second term evaluates to "true". The Xor of "true" and "false" (the first two terms) yields "true". The third term evaluates to "false". The Xor of "true" and "false" (the result of the first Xor and the third term) yields "true".
TRUE ^ !(FALSE | TRUE)
- The above example evaluates to "true". The sub-expression "(FALSE | TRUE)" evaluates to "true". The negation of the sub-expression yields "false". The Xor of "true" and the negated sub-expression result of "false" yields "true".