# Generated from UnifiedIRParser.g4 by ANTLR 4.9.2
# encoding: utf-8
from antlr4 import *
from io import StringIO
import sys
if sys.version_info[1] > 5:
	from typing import TextIO
else:
	from typing.io import TextIO


def serializedATN():
    with StringIO() as buf:
        buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3<")
        buf.write("\u0156\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7")
        buf.write("\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r\4\16")
        buf.write("\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22\4\23\t\23")
        buf.write("\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31")
        buf.write("\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36")
        buf.write("\4\37\t\37\4 \t \4!\t!\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2")
        buf.write("\5\2K\n\2\3\2\3\2\3\3\3\3\3\3\3\4\3\4\3\4\3\4\3\4\3\5")
        buf.write("\3\5\3\5\3\5\3\5\3\5\3\6\3\6\3\6\3\6\3\6\3\7\3\7\3\7\3")
        buf.write("\b\3\b\3\b\3\t\3\t\3\t\3\t\3\t\3\n\3\n\3\n\3\13\3\13\3")
        buf.write("\13\5\13s\n\13\3\13\3\13\3\13\3\13\5\13y\n\13\5\13{\n")
        buf.write("\13\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3")
        buf.write("\f\3\f\3\f\3\f\3\f\3\f\3\f\5\f\u0090\n\f\3\r\3\r\5\r\u0094")
        buf.write("\n\r\3\r\5\r\u0097\n\r\3\r\5\r\u009a\n\r\3\r\3\r\5\r\u009e")
        buf.write("\n\r\3\r\3\r\5\r\u00a2\n\r\3\r\5\r\u00a5\n\r\3\r\5\r\u00a8")
        buf.write("\n\r\3\r\3\r\3\r\5\r\u00ad\n\r\3\r\3\r\5\r\u00b1\n\r\3")
        buf.write("\r\3\r\3\r\5\r\u00b6\n\r\3\16\3\16\5\16\u00ba\n\16\3\16")
        buf.write("\3\16\5\16\u00be\n\16\3\16\3\16\3\16\3\17\5\17\u00c4\n")
        buf.write("\17\3\17\3\17\3\17\3\17\3\20\5\20\u00cb\n\20\3\20\5\20")
        buf.write("\u00ce\n\20\3\20\3\20\5\20\u00d2\n\20\3\20\3\20\3\20\5")
        buf.write("\20\u00d7\n\20\3\20\5\20\u00da\n\20\3\20\3\20\5\20\u00de")
        buf.write("\n\20\3\20\3\20\5\20\u00e2\n\20\3\20\3\20\3\20\5\20\u00e7")
        buf.write("\n\20\3\20\5\20\u00ea\n\20\3\20\3\20\5\20\u00ee\n\20\3")
        buf.write("\20\3\20\3\20\5\20\u00f3\n\20\3\21\3\21\3\21\3\21\3\21")
        buf.write("\3\21\3\22\3\22\5\22\u00fd\n\22\3\23\3\23\5\23\u0101\n")
        buf.write("\23\3\24\3\24\3\25\3\25\3\25\3\25\3\25\3\25\3\25\5\25")
        buf.write("\u010c\n\25\3\26\3\26\5\26\u0110\n\26\3\27\3\27\5\27\u0114")
        buf.write("\n\27\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30")
        buf.write("\3\30\3\30\3\30\3\30\5\30\u0124\n\30\3\30\5\30\u0127\n")
        buf.write("\30\3\31\3\31\3\31\3\31\3\31\3\31\5\31\u012f\n\31\3\32")
        buf.write("\3\32\3\32\3\32\3\33\3\33\3\33\3\33\3\34\3\34\3\34\3\34")
        buf.write("\3\35\3\35\3\35\3\35\3\36\3\36\3\36\3\36\3\37\3\37\3\37")
        buf.write("\3\37\3 \3 \3!\3!\3!\3!\3!\3!\3!\6!\u0152\n!\r!\16!\u0153")
        buf.write("\3!\2\2\"\2\4\6\b\n\f\16\20\22\24\26\30\32\34\36 \"$&")
        buf.write("(*,.\60\62\64\668:<>@\2\2\2\u0175\2J\3\2\2\2\4N\3\2\2")
        buf.write("\2\6Q\3\2\2\2\bV\3\2\2\2\n\\\3\2\2\2\fa\3\2\2\2\16d\3")
        buf.write("\2\2\2\20g\3\2\2\2\22l\3\2\2\2\24z\3\2\2\2\26\u008f\3")
        buf.write("\2\2\2\30\u00b5\3\2\2\2\32\u00b9\3\2\2\2\34\u00c3\3\2")
        buf.write("\2\2\36\u00f2\3\2\2\2 \u00f4\3\2\2\2\"\u00fc\3\2\2\2$")
        buf.write("\u0100\3\2\2\2&\u0102\3\2\2\2(\u010b\3\2\2\2*\u010f\3")
        buf.write("\2\2\2,\u0113\3\2\2\2.\u0126\3\2\2\2\60\u012e\3\2\2\2")
        buf.write("\62\u0130\3\2\2\2\64\u0134\3\2\2\2\66\u0138\3\2\2\28\u013c")
        buf.write("\3\2\2\2:\u0140\3\2\2\2<\u0144\3\2\2\2>\u0148\3\2\2\2")
        buf.write("@\u0151\3\2\2\2BK\5\4\3\2CK\5\6\4\2DK\5\b\5\2EK\5\n\6")
        buf.write("\2FK\5\f\7\2GK\5\16\b\2HK\5\20\t\2IK\5\22\n\2JB\3\2\2")
        buf.write("\2JC\3\2\2\2JD\3\2\2\2JE\3\2\2\2JF\3\2\2\2JG\3\2\2\2J")
        buf.write("H\3\2\2\2JI\3\2\2\2KL\3\2\2\2LM\7\2\2\3M\3\3\2\2\2NO\7")
        buf.write("\4\2\2OP\5\26\f\2P\5\3\2\2\2QR\7\4\2\2RS\5\64\33\2ST\7")
        buf.write("\b\2\2TU\5\26\f\2U\7\3\2\2\2VW\7\4\2\2WX\7\t\2\2XY\5\26")
        buf.write("\f\2YZ\7\n\2\2Z[\5\26\f\2[\t\3\2\2\2\\]\7\4\2\2]^\5:\36")
        buf.write("\2^_\7\b\2\2_`\5\24\13\2`\13\3\2\2\2ab\7\6\2\2bc\5\26")
        buf.write("\f\2c\r\3\2\2\2de\7\7\2\2ef\5\24\13\2f\17\3\2\2\2gh\7")
        buf.write("\5\2\2hi\5\32\16\2ij\7\13\2\2jk\5\26\f\2k\21\3\2\2\2l")
        buf.write("m\7\4\2\2mn\5.\30\2n\23\3\2\2\2op\5\26\f\2pr\5\34\17\2")
        buf.write("qs\5 \21\2rq\3\2\2\2rs\3\2\2\2s{\3\2\2\2tu\5\26\f\2uv")
        buf.write("\5\36\20\2vx\5\26\f\2wy\5 \21\2xw\3\2\2\2xy\3\2\2\2y{")
        buf.write("\3\2\2\2zo\3\2\2\2zt\3\2\2\2{\25\3\2\2\2|}\7*\2\2}~\5")
        buf.write("\26\f\2~\177\5$\23\2\177\u0080\5\26\f\2\u0080\u0081\7")
        buf.write("+\2\2\u0081\u0090\3\2\2\2\u0082\u0083\7*\2\2\u0083\u0084")
        buf.write("\5\26\f\2\u0084\u0085\7\23\2\2\u0085\u0086\5\26\f\2\u0086")
        buf.write("\u0087\7\24\2\2\u0087\u0088\7+\2\2\u0088\u0090\3\2\2\2")
        buf.write("\u0089\u008a\7*\2\2\u008a\u008b\5\30\r\2\u008b\u008c\7")
        buf.write("+\2\2\u008c\u0090\3\2\2\2\u008d\u0090\5\62\32\2\u008e")
        buf.write("\u0090\7\r\2\2\u008f|\3\2\2\2\u008f\u0082\3\2\2\2\u008f")
        buf.write("\u0089\3\2\2\2\u008f\u008d\3\2\2\2\u008f\u008e\3\2\2\2")
        buf.write("\u0090\27\3\2\2\2\u0091\u0093\5\66\34\2\u0092\u0094\5")
        buf.write("\26\f\2\u0093\u0092\3\2\2\2\u0093\u0094\3\2\2\2\u0094")
        buf.write("\u009a\3\2\2\2\u0095\u0097\5\66\34\2\u0096\u0095\3\2\2")
        buf.write("\2\u0096\u0097\3\2\2\2\u0097\u0098\3\2\2\2\u0098\u009a")
        buf.write("\5\26\f\2\u0099\u0091\3\2\2\2\u0099\u0096\3\2\2\2\u009a")
        buf.write("\u009b\3\2\2\2\u009b\u009d\5\34\17\2\u009c\u009e\5 \21")
        buf.write("\2\u009d\u009c\3\2\2\2\u009d\u009e\3\2\2\2\u009e\u00b6")
        buf.write("\3\2\2\2\u009f\u00a1\5\66\34\2\u00a0\u00a2\5\26\f\2\u00a1")
        buf.write("\u00a0\3\2\2\2\u00a1\u00a2\3\2\2\2\u00a2\u00a8\3\2\2\2")
        buf.write("\u00a3\u00a5\5\66\34\2\u00a4\u00a3\3\2\2\2\u00a4\u00a5")
        buf.write("\3\2\2\2\u00a5\u00a6\3\2\2\2\u00a6\u00a8\5\26\f\2\u00a7")
        buf.write("\u009f\3\2\2\2\u00a7\u00a4\3\2\2\2\u00a8\u00a9\3\2\2\2")
        buf.write("\u00a9\u00aa\5\36\20\2\u00aa\u00ac\5\26\f\2\u00ab\u00ad")
        buf.write("\5 \21\2\u00ac\u00ab\3\2\2\2\u00ac\u00ad\3\2\2\2\u00ad")
        buf.write("\u00b6\3\2\2\2\u00ae\u00b0\5\66\34\2\u00af\u00b1\5\26")
        buf.write("\f\2\u00b0\u00af\3\2\2\2\u00b0\u00b1\3\2\2\2\u00b1\u00b6")
        buf.write("\3\2\2\2\u00b2\u00b3\5\26\f\2\u00b3\u00b4\5\32\16\2\u00b4")
        buf.write("\u00b6\3\2\2\2\u00b5\u0099\3\2\2\2\u00b5\u00a7\3\2\2\2")
        buf.write("\u00b5\u00ae\3\2\2\2\u00b5\u00b2\3\2\2\2\u00b6\31\3\2")
        buf.write("\2\2\u00b7\u00b8\7\20\2\2\u00b8\u00ba\7\21\2\2\u00b9\u00b7")
        buf.write("\3\2\2\2\u00b9\u00ba\3\2\2\2\u00ba\u00bd\3\2\2\2\u00bb")
        buf.write("\u00bc\7\f\2\2\u00bc\u00be\5> \2\u00bd\u00bb\3\2\2\2\u00bd")
        buf.write("\u00be\3\2\2\2\u00be\u00bf\3\2\2\2\u00bf\u00c0\5*\26\2")
        buf.write("\u00c0\u00c1\5\64\33\2\u00c1\33\3\2\2\2\u00c2\u00c4\7")
        buf.write("\17\2\2\u00c3\u00c2\3\2\2\2\u00c3\u00c4\3\2\2\2\u00c4")
        buf.write("\u00c5\3\2\2\2\u00c5\u00c6\5\64\33\2\u00c6\u00c7\5(\25")
        buf.write("\2\u00c7\u00c8\5.\30\2\u00c8\35\3\2\2\2\u00c9\u00cb\7")
        buf.write("\20\2\2\u00ca\u00c9\3\2\2\2\u00ca\u00cb\3\2\2\2\u00cb")
        buf.write("\u00cd\3\2\2\2\u00cc\u00ce\5&\24\2\u00cd\u00cc\3\2\2\2")
        buf.write("\u00cd\u00ce\3\2\2\2\u00ce\u00cf\3\2\2\2\u00cf\u00d1\5")
        buf.write("8\35\2\u00d0\u00d2\5\"\22\2\u00d1\u00d0\3\2\2\2\u00d1")
        buf.write("\u00d2\3\2\2\2\u00d2\u00d3\3\2\2\2\u00d3\u00d4\7\n\2\2")
        buf.write("\u00d4\u00f3\3\2\2\2\u00d5\u00d7\7\20\2\2\u00d6\u00d5")
        buf.write("\3\2\2\2\u00d6\u00d7\3\2\2\2\u00d7\u00d9\3\2\2\2\u00d8")
        buf.write("\u00da\5&\24\2\u00d9\u00d8\3\2\2\2\u00d9\u00da\3\2\2\2")
        buf.write("\u00da\u00db\3\2\2\2\u00db\u00dd\58\35\2\u00dc\u00de\5")
        buf.write("\"\22\2\u00dd\u00dc\3\2\2\2\u00dd\u00de\3\2\2\2\u00de")
        buf.write("\u00df\3\2\2\2\u00df\u00e1\7\n\2\2\u00e0\u00e2\5(\25\2")
        buf.write("\u00e1\u00e0\3\2\2\2\u00e1\u00e2\3\2\2\2\u00e2\u00e3\3")
        buf.write("\2\2\2\u00e3\u00e4\5.\30\2\u00e4\u00f3\3\2\2\2\u00e5\u00e7")
        buf.write("\7\20\2\2\u00e6\u00e5\3\2\2\2\u00e6\u00e7\3\2\2\2\u00e7")
        buf.write("\u00e9\3\2\2\2\u00e8\u00ea\5&\24\2\u00e9\u00e8\3\2\2\2")
        buf.write("\u00e9\u00ea\3\2\2\2\u00ea\u00eb\3\2\2\2\u00eb\u00ed\5")
        buf.write("8\35\2\u00ec\u00ee\5\"\22\2\u00ed\u00ec\3\2\2\2\u00ed")
        buf.write("\u00ee\3\2\2\2\u00ee\u00ef\3\2\2\2\u00ef\u00f0\7\n\2\2")
        buf.write("\u00f0\u00f1\5*\26\2\u00f1\u00f3\3\2\2\2\u00f2\u00ca\3")
        buf.write("\2\2\2\u00f2\u00d6\3\2\2\2\u00f2\u00e6\3\2\2\2\u00f3\37")
        buf.write("\3\2\2\2\u00f4\u00f5\7\23\2\2\u00f5\u00f6\5:\36\2\u00f6")
        buf.write("\u00f7\5(\25\2\u00f7\u00f8\5.\30\2\u00f8\u00f9\7\24\2")
        buf.write("\2\u00f9!\3\2\2\2\u00fa\u00fd\7\25\2\2\u00fb\u00fd\7\26")
        buf.write("\2\2\u00fc\u00fa\3\2\2\2\u00fc\u00fb\3\2\2\2\u00fd#\3")
        buf.write("\2\2\2\u00fe\u0101\7\27\2\2\u00ff\u0101\7\30\2\2\u0100")
        buf.write("\u00fe\3\2\2\2\u0100\u00ff\3\2\2\2\u0101%\3\2\2\2\u0102")
        buf.write("\u0103\7\22\2\2\u0103\'\3\2\2\2\u0104\u010c\7\34\2\2\u0105")
        buf.write("\u010c\7\22\2\2\u0106\u010c\7\33\2\2\u0107\u010c\7\35")
        buf.write("\2\2\u0108\u010c\7\36\2\2\u0109\u010c\7\37\2\2\u010a\u010c")
        buf.write("\7 \2\2\u010b\u0104\3\2\2\2\u010b\u0105\3\2\2\2\u010b")
        buf.write("\u0106\3\2\2\2\u010b\u0107\3\2\2\2\u010b\u0108\3\2\2\2")
        buf.write("\u010b\u0109\3\2\2\2\u010b\u010a\3\2\2\2\u010c)\3\2\2")
        buf.write("\2\u010d\u0110\7!\2\2\u010e\u0110\7\"\2\2\u010f\u010d")
        buf.write("\3\2\2\2\u010f\u010e\3\2\2\2\u0110+\3\2\2\2\u0111\u0114")
        buf.write("\7\31\2\2\u0112\u0114\7\32\2\2\u0113\u0111\3\2\2\2\u0113")
        buf.write("\u0112\3\2\2\2\u0114-\3\2\2\2\u0115\u0116\5\60\31\2\u0116")
        buf.write("\u0117\5.\30\2\u0117\u0118\7\30\2\2\u0118\u0119\5.\30")
        buf.write("\2\u0119\u0127\3\2\2\2\u011a\u011b\5,\27\2\u011b\u011c")
        buf.write("\7\b\2\2\u011c\u011d\5.\30\2\u011d\u0127\3\2\2\2\u011e")
        buf.write("\u011f\5\64\33\2\u011f\u0120\7\b\2\2\u0120\u0121\5\26")
        buf.write("\f\2\u0121\u0127\3\2\2\2\u0122\u0124\5\60\31\2\u0123\u0122")
        buf.write("\3\2\2\2\u0123\u0124\3\2\2\2\u0124\u0125\3\2\2\2\u0125")
        buf.write("\u0127\5<\37\2\u0126\u0115\3\2\2\2\u0126\u011a\3\2\2\2")
        buf.write("\u0126\u011e\3\2\2\2\u0126\u0123\3\2\2\2\u0127/\3\2\2")
        buf.write("\2\u0128\u012f\7#\2\2\u0129\u012f\7$\2\2\u012a\u012f\7")
        buf.write("%\2\2\u012b\u012f\7&\2\2\u012c\u012f\7\'\2\2\u012d\u012f")
        buf.write("\7(\2\2\u012e\u0128\3\2\2\2\u012e\u0129\3\2\2\2\u012e")
        buf.write("\u012a\3\2\2\2\u012e\u012b\3\2\2\2\u012e\u012c\3\2\2\2")
        buf.write("\u012e\u012d\3\2\2\2\u012f\61\3\2\2\2\u0130\u0131\7,\2")
        buf.write("\2\u0131\u0132\5@!\2\u0132\u0133\7\66\2\2\u0133\63\3\2")
        buf.write("\2\2\u0134\u0135\7-\2\2\u0135\u0136\5@!\2\u0136\u0137")
        buf.write("\7\67\2\2\u0137\65\3\2\2\2\u0138\u0139\7/\2\2\u0139\u013a")
        buf.write("\5@!\2\u013a\u013b\79\2\2\u013b\67\3\2\2\2\u013c\u013d")
        buf.write("\7.\2\2\u013d\u013e\5@!\2\u013e\u013f\78\2\2\u013f9\3")
        buf.write("\2\2\2\u0140\u0141\7\60\2\2\u0141\u0142\5@!\2\u0142\u0143")
        buf.write("\7:\2\2\u0143;\3\2\2\2\u0144\u0145\7\61\2\2\u0145\u0146")
        buf.write("\5@!\2\u0146\u0147\7;\2\2\u0147=\3\2\2\2\u0148\u0149\7")
        buf.write("\62\2\2\u0149?\3\2\2\2\u014a\u0152\7)\2\2\u014b\u0152")
        buf.write("\7\65\2\2\u014c\u014d\7\23\2\2\u014d\u014e\5@!\2\u014e")
        buf.write("\u014f\7\24\2\2\u014f\u0152\3\2\2\2\u0150\u0152\7<\2\2")
        buf.write("\u0151\u014a\3\2\2\2\u0151\u014b\3\2\2\2\u0151\u014c\3")
        buf.write("\2\2\2\u0151\u0150\3\2\2\2\u0152\u0153\3\2\2\2\u0153\u0151")
        buf.write("\3\2\2\2\u0153\u0154\3\2\2\2\u0154A\3\2\2\2)Jrxz\u008f")
        buf.write("\u0093\u0096\u0099\u009d\u00a1\u00a4\u00a7\u00ac\u00b0")
        buf.write("\u00b5\u00b9\u00bd\u00c3\u00ca\u00cd\u00d1\u00d6\u00d9")
        buf.write("\u00dd\u00e1\u00e6\u00e9\u00ed\u00f2\u00fc\u0100\u010b")
        buf.write("\u010f\u0113\u0123\u0126\u012e\u0151\u0153")
        return buf.getvalue()


class UnifiedIRParser ( Parser ):

    grammarFileName = "UnifiedIRParser.g4"

    atn = ATNDeserializer().deserialize(serializedATN())

    decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "'which one has the'", 
                     "'how many'", "'whether'", "'of'", "'from'", "'to'", 
                     "'among'", "'top'", "<INVALID>", "'the'", "'whose'", 
                     "'that'", "'has'", "'not'", "'('", "')'", "'forward'", 
                     "'backward'", "'and'", "'or'", "'sum'", "'average'", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "'at least'", "'at most'", "<INVALID>", "<INVALID>", 
                     "'text'", "'number'", "'date'", "'month'", "'year'", 
                     "'time'", "' '", "'<ES>'", "'</ES>'", "'<E>'", "'<A>'", 
                     "'<R>'", "'<C>'", "'<Q>'", "'<V>'", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "'</E>'", "'</A>'", "'</R>'", 
                     "'</C>'", "'</Q>'", "'</V>'" ]

    symbolicNames = [ "<INVALID>", "WS", "What", "Select", "Count", "Verify", 
                      "Of", "From", "To", "Among", "Top", "Ones", "The", 
                      "Whose", "That", "Has", "Not", "LB", "RB", "Forward", 
                      "Backward", "And", "Or", "Sum", "Average", "Is", "IsNot", 
                      "LargerThan", "SmallerThan", "AtLeast", "AtMost", 
                      "Largest", "Smallest", "Text", "Quantity", "Date", 
                      "Month", "Year", "Time", "SPACE", "ES_START", "ES_END", 
                      "ENTI_START", "ATTR_START", "PRED_START", "CONC_START", 
                      "QUAL_START", "VALU_START", "INTEGER", "DECIMAL", 
                      "DIGIT", "STRING_LITERAL", "ENTI_END", "ATTR_END", 
                      "PRED_END", "CONC_END", "QUAL_END", "VALU_END", "LITERAL" ]

    RULE_root = 0
    RULE_entityQuery = 1
    RULE_attributeQuery = 2
    RULE_predicateQuery = 3
    RULE_qualifierQuery = 4
    RULE_countQuery = 5
    RULE_verifyQuery = 6
    RULE_selectQuery = 7
    RULE_valueQuery = 8
    RULE_verify = 9
    RULE_entitySet = 10
    RULE_filterFromEntitySet = 11
    RULE_filterByRank = 12
    RULE_filterByAttribute = 13
    RULE_filterByPredicate = 14
    RULE_filterByQualifier = 15
    RULE_direction = 16
    RULE_setOP = 17
    RULE_logicGate = 18
    RULE_symbolOP = 19
    RULE_stringOP = 20
    RULE_aggregateOP = 21
    RULE_valueSet = 22
    RULE_valueType = 23
    RULE_entity = 24
    RULE_attribute = 25
    RULE_concept = 26
    RULE_predicate = 27
    RULE_qualifier = 28
    RULE_value = 29
    RULE_number = 30
    RULE_string = 31

    ruleNames =  [ "root", "entityQuery", "attributeQuery", "predicateQuery", 
                   "qualifierQuery", "countQuery", "verifyQuery", "selectQuery", 
                   "valueQuery", "verify", "entitySet", "filterFromEntitySet", 
                   "filterByRank", "filterByAttribute", "filterByPredicate", 
                   "filterByQualifier", "direction", "setOP", "logicGate", 
                   "symbolOP", "stringOP", "aggregateOP", "valueSet", "valueType", 
                   "entity", "attribute", "concept", "predicate", "qualifier", 
                   "value", "number", "string" ]

    EOF = Token.EOF
    WS=1
    What=2
    Select=3
    Count=4
    Verify=5
    Of=6
    From=7
    To=8
    Among=9
    Top=10
    Ones=11
    The=12
    Whose=13
    That=14
    Has=15
    Not=16
    LB=17
    RB=18
    Forward=19
    Backward=20
    And=21
    Or=22
    Sum=23
    Average=24
    Is=25
    IsNot=26
    LargerThan=27
    SmallerThan=28
    AtLeast=29
    AtMost=30
    Largest=31
    Smallest=32
    Text=33
    Quantity=34
    Date=35
    Month=36
    Year=37
    Time=38
    SPACE=39
    ES_START=40
    ES_END=41
    ENTI_START=42
    ATTR_START=43
    PRED_START=44
    CONC_START=45
    QUAL_START=46
    VALU_START=47
    INTEGER=48
    DECIMAL=49
    DIGIT=50
    STRING_LITERAL=51
    ENTI_END=52
    ATTR_END=53
    PRED_END=54
    CONC_END=55
    QUAL_END=56
    VALU_END=57
    LITERAL=58

    def __init__(self, input:TokenStream, output:TextIO = sys.stdout):
        super().__init__(input, output)
        self.checkVersion("4.9.2")
        self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache)
        self._predicates = None




    class RootContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def EOF(self):
            return self.getToken(UnifiedIRParser.EOF, 0)

        def entityQuery(self):
            return self.getTypedRuleContext(UnifiedIRParser.EntityQueryContext,0)


        def attributeQuery(self):
            return self.getTypedRuleContext(UnifiedIRParser.AttributeQueryContext,0)


        def predicateQuery(self):
            return self.getTypedRuleContext(UnifiedIRParser.PredicateQueryContext,0)


        def qualifierQuery(self):
            return self.getTypedRuleContext(UnifiedIRParser.QualifierQueryContext,0)


        def countQuery(self):
            return self.getTypedRuleContext(UnifiedIRParser.CountQueryContext,0)


        def verifyQuery(self):
            return self.getTypedRuleContext(UnifiedIRParser.VerifyQueryContext,0)


        def selectQuery(self):
            return self.getTypedRuleContext(UnifiedIRParser.SelectQueryContext,0)


        def valueQuery(self):
            return self.getTypedRuleContext(UnifiedIRParser.ValueQueryContext,0)


        def getRuleIndex(self):
            return UnifiedIRParser.RULE_root

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterRoot" ):
                listener.enterRoot(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitRoot" ):
                listener.exitRoot(self)




    def root(self):

        localctx = UnifiedIRParser.RootContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_root)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 72
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,0,self._ctx)
            if la_ == 1:
                self.state = 64
                self.entityQuery()
                pass

            elif la_ == 2:
                self.state = 65
                self.attributeQuery()
                pass

            elif la_ == 3:
                self.state = 66
                self.predicateQuery()
                pass

            elif la_ == 4:
                self.state = 67
                self.qualifierQuery()
                pass

            elif la_ == 5:
                self.state = 68
                self.countQuery()
                pass

            elif la_ == 6:
                self.state = 69
                self.verifyQuery()
                pass

            elif la_ == 7:
                self.state = 70
                self.selectQuery()
                pass

            elif la_ == 8:
                self.state = 71
                self.valueQuery()
                pass


            self.state = 74
            self.match(UnifiedIRParser.EOF)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class EntityQueryContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def What(self):
            return self.getToken(UnifiedIRParser.What, 0)

        def entitySet(self):
            return self.getTypedRuleContext(UnifiedIRParser.EntitySetContext,0)


        def getRuleIndex(self):
            return UnifiedIRParser.RULE_entityQuery

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEntityQuery" ):
                listener.enterEntityQuery(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEntityQuery" ):
                listener.exitEntityQuery(self)




    def entityQuery(self):

        localctx = UnifiedIRParser.EntityQueryContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_entityQuery)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 76
            self.match(UnifiedIRParser.What)
            self.state = 77
            self.entitySet()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class AttributeQueryContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def What(self):
            return self.getToken(UnifiedIRParser.What, 0)

        def attribute(self):
            return self.getTypedRuleContext(UnifiedIRParser.AttributeContext,0)


        def Of(self):
            return self.getToken(UnifiedIRParser.Of, 0)

        def entitySet(self):
            return self.getTypedRuleContext(UnifiedIRParser.EntitySetContext,0)


        def getRuleIndex(self):
            return UnifiedIRParser.RULE_attributeQuery

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterAttributeQuery" ):
                listener.enterAttributeQuery(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitAttributeQuery" ):
                listener.exitAttributeQuery(self)




    def attributeQuery(self):

        localctx = UnifiedIRParser.AttributeQueryContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_attributeQuery)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 79
            self.match(UnifiedIRParser.What)
            self.state = 80
            self.attribute()
            self.state = 81
            self.match(UnifiedIRParser.Of)
            self.state = 82
            self.entitySet()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class PredicateQueryContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def What(self):
            return self.getToken(UnifiedIRParser.What, 0)

        def From(self):
            return self.getToken(UnifiedIRParser.From, 0)

        def entitySet(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(UnifiedIRParser.EntitySetContext)
            else:
                return self.getTypedRuleContext(UnifiedIRParser.EntitySetContext,i)


        def To(self):
            return self.getToken(UnifiedIRParser.To, 0)

        def getRuleIndex(self):
            return UnifiedIRParser.RULE_predicateQuery

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterPredicateQuery" ):
                listener.enterPredicateQuery(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitPredicateQuery" ):
                listener.exitPredicateQuery(self)




    def predicateQuery(self):

        localctx = UnifiedIRParser.PredicateQueryContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_predicateQuery)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 84
            self.match(UnifiedIRParser.What)
            self.state = 85
            self.match(UnifiedIRParser.From)
            self.state = 86
            self.entitySet()
            self.state = 87
            self.match(UnifiedIRParser.To)
            self.state = 88
            self.entitySet()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class QualifierQueryContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def What(self):
            return self.getToken(UnifiedIRParser.What, 0)

        def qualifier(self):
            return self.getTypedRuleContext(UnifiedIRParser.QualifierContext,0)


        def Of(self):
            return self.getToken(UnifiedIRParser.Of, 0)

        def verify(self):
            return self.getTypedRuleContext(UnifiedIRParser.VerifyContext,0)


        def getRuleIndex(self):
            return UnifiedIRParser.RULE_qualifierQuery

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterQualifierQuery" ):
                listener.enterQualifierQuery(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitQualifierQuery" ):
                listener.exitQualifierQuery(self)




    def qualifierQuery(self):

        localctx = UnifiedIRParser.QualifierQueryContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_qualifierQuery)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 90
            self.match(UnifiedIRParser.What)
            self.state = 91
            self.qualifier()
            self.state = 92
            self.match(UnifiedIRParser.Of)
            self.state = 93
            self.verify()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class CountQueryContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def Count(self):
            return self.getToken(UnifiedIRParser.Count, 0)

        def entitySet(self):
            return self.getTypedRuleContext(UnifiedIRParser.EntitySetContext,0)


        def getRuleIndex(self):
            return UnifiedIRParser.RULE_countQuery

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterCountQuery" ):
                listener.enterCountQuery(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitCountQuery" ):
                listener.exitCountQuery(self)




    def countQuery(self):

        localctx = UnifiedIRParser.CountQueryContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_countQuery)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 95
            self.match(UnifiedIRParser.Count)
            self.state = 96
            self.entitySet()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class VerifyQueryContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def Verify(self):
            return self.getToken(UnifiedIRParser.Verify, 0)

        def verify(self):
            return self.getTypedRuleContext(UnifiedIRParser.VerifyContext,0)


        def getRuleIndex(self):
            return UnifiedIRParser.RULE_verifyQuery

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterVerifyQuery" ):
                listener.enterVerifyQuery(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitVerifyQuery" ):
                listener.exitVerifyQuery(self)




    def verifyQuery(self):

        localctx = UnifiedIRParser.VerifyQueryContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_verifyQuery)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 98
            self.match(UnifiedIRParser.Verify)
            self.state = 99
            self.verify()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class SelectQueryContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def Select(self):
            return self.getToken(UnifiedIRParser.Select, 0)

        def filterByRank(self):
            return self.getTypedRuleContext(UnifiedIRParser.FilterByRankContext,0)


        def Among(self):
            return self.getToken(UnifiedIRParser.Among, 0)

        def entitySet(self):
            return self.getTypedRuleContext(UnifiedIRParser.EntitySetContext,0)


        def getRuleIndex(self):
            return UnifiedIRParser.RULE_selectQuery

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterSelectQuery" ):
                listener.enterSelectQuery(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitSelectQuery" ):
                listener.exitSelectQuery(self)




    def selectQuery(self):

        localctx = UnifiedIRParser.SelectQueryContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_selectQuery)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 101
            self.match(UnifiedIRParser.Select)
            self.state = 102
            self.filterByRank()
            self.state = 103
            self.match(UnifiedIRParser.Among)
            self.state = 104
            self.entitySet()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ValueQueryContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def What(self):
            return self.getToken(UnifiedIRParser.What, 0)

        def valueSet(self):
            return self.getTypedRuleContext(UnifiedIRParser.ValueSetContext,0)


        def getRuleIndex(self):
            return UnifiedIRParser.RULE_valueQuery

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterValueQuery" ):
                listener.enterValueQuery(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitValueQuery" ):
                listener.exitValueQuery(self)




    def valueQuery(self):

        localctx = UnifiedIRParser.ValueQueryContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_valueQuery)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 106
            self.match(UnifiedIRParser.What)
            self.state = 107
            self.valueSet()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class VerifyContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return UnifiedIRParser.RULE_verify

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class VerifyByPredicateContext(VerifyContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.VerifyContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def entitySet(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(UnifiedIRParser.EntitySetContext)
            else:
                return self.getTypedRuleContext(UnifiedIRParser.EntitySetContext,i)

        def filterByPredicate(self):
            return self.getTypedRuleContext(UnifiedIRParser.FilterByPredicateContext,0)

        def filterByQualifier(self):
            return self.getTypedRuleContext(UnifiedIRParser.FilterByQualifierContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterVerifyByPredicate" ):
                listener.enterVerifyByPredicate(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitVerifyByPredicate" ):
                listener.exitVerifyByPredicate(self)


    class VerifyByAttributeContext(VerifyContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.VerifyContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def entitySet(self):
            return self.getTypedRuleContext(UnifiedIRParser.EntitySetContext,0)

        def filterByAttribute(self):
            return self.getTypedRuleContext(UnifiedIRParser.FilterByAttributeContext,0)

        def filterByQualifier(self):
            return self.getTypedRuleContext(UnifiedIRParser.FilterByQualifierContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterVerifyByAttribute" ):
                listener.enterVerifyByAttribute(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitVerifyByAttribute" ):
                listener.exitVerifyByAttribute(self)



    def verify(self):

        localctx = UnifiedIRParser.VerifyContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_verify)
        self._la = 0 # Token type
        try:
            self.state = 120
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,3,self._ctx)
            if la_ == 1:
                localctx = UnifiedIRParser.VerifyByAttributeContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 109
                self.entitySet()
                self.state = 110
                self.filterByAttribute()
                self.state = 112
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==UnifiedIRParser.LB:
                    self.state = 111
                    self.filterByQualifier()


                pass

            elif la_ == 2:
                localctx = UnifiedIRParser.VerifyByPredicateContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 114
                self.entitySet()
                self.state = 115
                self.filterByPredicate()
                self.state = 116
                self.entitySet()
                self.state = 118
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==UnifiedIRParser.LB:
                    self.state = 117
                    self.filterByQualifier()


                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class EntitySetContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return UnifiedIRParser.RULE_entitySet

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class EntitySetGroupContext(EntitySetContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.EntitySetContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def ES_START(self):
            return self.getToken(UnifiedIRParser.ES_START, 0)
        def entitySet(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(UnifiedIRParser.EntitySetContext)
            else:
                return self.getTypedRuleContext(UnifiedIRParser.EntitySetContext,i)

        def setOP(self):
            return self.getTypedRuleContext(UnifiedIRParser.SetOPContext,0)

        def ES_END(self):
            return self.getToken(UnifiedIRParser.ES_END, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEntitySetGroup" ):
                listener.enterEntitySetGroup(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEntitySetGroup" ):
                listener.exitEntitySetGroup(self)


    class EntitySetIntersectContext(EntitySetContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.EntitySetContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def ES_START(self):
            return self.getToken(UnifiedIRParser.ES_START, 0)
        def entitySet(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(UnifiedIRParser.EntitySetContext)
            else:
                return self.getTypedRuleContext(UnifiedIRParser.EntitySetContext,i)

        def LB(self):
            return self.getToken(UnifiedIRParser.LB, 0)
        def RB(self):
            return self.getToken(UnifiedIRParser.RB, 0)
        def ES_END(self):
            return self.getToken(UnifiedIRParser.ES_END, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEntitySetIntersect" ):
                listener.enterEntitySetIntersect(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEntitySetIntersect" ):
                listener.exitEntitySetIntersect(self)


    class EntitySetAtomContext(EntitySetContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.EntitySetContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def entity(self):
            return self.getTypedRuleContext(UnifiedIRParser.EntityContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEntitySetAtom" ):
                listener.enterEntitySetAtom(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEntitySetAtom" ):
                listener.exitEntitySetAtom(self)


    class EntitySetPlaceholderContext(EntitySetContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.EntitySetContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def Ones(self):
            return self.getToken(UnifiedIRParser.Ones, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEntitySetPlaceholder" ):
                listener.enterEntitySetPlaceholder(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEntitySetPlaceholder" ):
                listener.exitEntitySetPlaceholder(self)


    class EntitySetFilterContext(EntitySetContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.EntitySetContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def ES_START(self):
            return self.getToken(UnifiedIRParser.ES_START, 0)
        def filterFromEntitySet(self):
            return self.getTypedRuleContext(UnifiedIRParser.FilterFromEntitySetContext,0)

        def ES_END(self):
            return self.getToken(UnifiedIRParser.ES_END, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEntitySetFilter" ):
                listener.enterEntitySetFilter(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEntitySetFilter" ):
                listener.exitEntitySetFilter(self)



    def entitySet(self):

        localctx = UnifiedIRParser.EntitySetContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_entitySet)
        try:
            self.state = 141
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,4,self._ctx)
            if la_ == 1:
                localctx = UnifiedIRParser.EntitySetGroupContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 122
                self.match(UnifiedIRParser.ES_START)
                self.state = 123
                self.entitySet()
                self.state = 124
                self.setOP()
                self.state = 125
                self.entitySet()
                self.state = 126
                self.match(UnifiedIRParser.ES_END)
                pass

            elif la_ == 2:
                localctx = UnifiedIRParser.EntitySetIntersectContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 128
                self.match(UnifiedIRParser.ES_START)
                self.state = 129
                self.entitySet()
                self.state = 130
                self.match(UnifiedIRParser.LB)
                self.state = 131
                self.entitySet()
                self.state = 132
                self.match(UnifiedIRParser.RB)
                self.state = 133
                self.match(UnifiedIRParser.ES_END)
                pass

            elif la_ == 3:
                localctx = UnifiedIRParser.EntitySetFilterContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 135
                self.match(UnifiedIRParser.ES_START)
                self.state = 136
                self.filterFromEntitySet()
                self.state = 137
                self.match(UnifiedIRParser.ES_END)
                pass

            elif la_ == 4:
                localctx = UnifiedIRParser.EntitySetAtomContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 139
                self.entity()
                pass

            elif la_ == 5:
                localctx = UnifiedIRParser.EntitySetPlaceholderContext(self, localctx)
                self.enterOuterAlt(localctx, 5)
                self.state = 140
                self.match(UnifiedIRParser.Ones)
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class FilterFromEntitySetContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return UnifiedIRParser.RULE_filterFromEntitySet

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class EntitySetByPredicateContext(FilterFromEntitySetContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.FilterFromEntitySetContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def filterByPredicate(self):
            return self.getTypedRuleContext(UnifiedIRParser.FilterByPredicateContext,0)

        def entitySet(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(UnifiedIRParser.EntitySetContext)
            else:
                return self.getTypedRuleContext(UnifiedIRParser.EntitySetContext,i)

        def concept(self):
            return self.getTypedRuleContext(UnifiedIRParser.ConceptContext,0)

        def filterByQualifier(self):
            return self.getTypedRuleContext(UnifiedIRParser.FilterByQualifierContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEntitySetByPredicate" ):
                listener.enterEntitySetByPredicate(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEntitySetByPredicate" ):
                listener.exitEntitySetByPredicate(self)


    class EntitySetByAttributeContext(FilterFromEntitySetContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.FilterFromEntitySetContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def filterByAttribute(self):
            return self.getTypedRuleContext(UnifiedIRParser.FilterByAttributeContext,0)

        def concept(self):
            return self.getTypedRuleContext(UnifiedIRParser.ConceptContext,0)

        def entitySet(self):
            return self.getTypedRuleContext(UnifiedIRParser.EntitySetContext,0)

        def filterByQualifier(self):
            return self.getTypedRuleContext(UnifiedIRParser.FilterByQualifierContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEntitySetByAttribute" ):
                listener.enterEntitySetByAttribute(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEntitySetByAttribute" ):
                listener.exitEntitySetByAttribute(self)


    class EntitySetByConceptContext(FilterFromEntitySetContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.FilterFromEntitySetContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def concept(self):
            return self.getTypedRuleContext(UnifiedIRParser.ConceptContext,0)

        def entitySet(self):
            return self.getTypedRuleContext(UnifiedIRParser.EntitySetContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEntitySetByConcept" ):
                listener.enterEntitySetByConcept(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEntitySetByConcept" ):
                listener.exitEntitySetByConcept(self)


    class EntitySetByRankContext(FilterFromEntitySetContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.FilterFromEntitySetContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def entitySet(self):
            return self.getTypedRuleContext(UnifiedIRParser.EntitySetContext,0)

        def filterByRank(self):
            return self.getTypedRuleContext(UnifiedIRParser.FilterByRankContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEntitySetByRank" ):
                listener.enterEntitySetByRank(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEntitySetByRank" ):
                listener.exitEntitySetByRank(self)



    def filterFromEntitySet(self):

        localctx = UnifiedIRParser.FilterFromEntitySetContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_filterFromEntitySet)
        self._la = 0 # Token type
        try:
            self.state = 179
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,14,self._ctx)
            if la_ == 1:
                localctx = UnifiedIRParser.EntitySetByAttributeContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 151
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,7,self._ctx)
                if la_ == 1:
                    self.state = 143
                    self.concept()
                    self.state = 145
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << UnifiedIRParser.Ones) | (1 << UnifiedIRParser.ES_START) | (1 << UnifiedIRParser.ENTI_START))) != 0):
                        self.state = 144
                        self.entitySet()


                    pass

                elif la_ == 2:
                    self.state = 148
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==UnifiedIRParser.CONC_START:
                        self.state = 147
                        self.concept()


                    self.state = 150
                    self.entitySet()
                    pass


                self.state = 153
                self.filterByAttribute()
                self.state = 155
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==UnifiedIRParser.LB:
                    self.state = 154
                    self.filterByQualifier()


                pass

            elif la_ == 2:
                localctx = UnifiedIRParser.EntitySetByPredicateContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 165
                self._errHandler.sync(self)
                la_ = self._interp.adaptivePredict(self._input,11,self._ctx)
                if la_ == 1:
                    self.state = 157
                    self.concept()
                    self.state = 159
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << UnifiedIRParser.Ones) | (1 << UnifiedIRParser.ES_START) | (1 << UnifiedIRParser.ENTI_START))) != 0):
                        self.state = 158
                        self.entitySet()


                    pass

                elif la_ == 2:
                    self.state = 162
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==UnifiedIRParser.CONC_START:
                        self.state = 161
                        self.concept()


                    self.state = 164
                    self.entitySet()
                    pass


                self.state = 167
                self.filterByPredicate()
                self.state = 168
                self.entitySet()
                self.state = 170
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==UnifiedIRParser.LB:
                    self.state = 169
                    self.filterByQualifier()


                pass

            elif la_ == 3:
                localctx = UnifiedIRParser.EntitySetByConceptContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 172
                self.concept()
                self.state = 174
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << UnifiedIRParser.Ones) | (1 << UnifiedIRParser.ES_START) | (1 << UnifiedIRParser.ENTI_START))) != 0):
                    self.state = 173
                    self.entitySet()


                pass

            elif la_ == 4:
                localctx = UnifiedIRParser.EntitySetByRankContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 176
                self.entitySet()
                self.state = 177
                self.filterByRank()
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class FilterByRankContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def stringOP(self):
            return self.getTypedRuleContext(UnifiedIRParser.StringOPContext,0)


        def attribute(self):
            return self.getTypedRuleContext(UnifiedIRParser.AttributeContext,0)


        def That(self):
            return self.getToken(UnifiedIRParser.That, 0)

        def Has(self):
            return self.getToken(UnifiedIRParser.Has, 0)

        def Top(self):
            return self.getToken(UnifiedIRParser.Top, 0)

        def number(self):
            return self.getTypedRuleContext(UnifiedIRParser.NumberContext,0)


        def getRuleIndex(self):
            return UnifiedIRParser.RULE_filterByRank

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterFilterByRank" ):
                listener.enterFilterByRank(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitFilterByRank" ):
                listener.exitFilterByRank(self)




    def filterByRank(self):

        localctx = UnifiedIRParser.FilterByRankContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_filterByRank)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 183
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==UnifiedIRParser.That:
                self.state = 181
                self.match(UnifiedIRParser.That)
                self.state = 182
                self.match(UnifiedIRParser.Has)


            self.state = 187
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==UnifiedIRParser.Top:
                self.state = 185
                self.match(UnifiedIRParser.Top)
                self.state = 186
                self.number()


            self.state = 189
            self.stringOP()
            self.state = 190
            self.attribute()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class FilterByAttributeContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def attribute(self):
            return self.getTypedRuleContext(UnifiedIRParser.AttributeContext,0)


        def symbolOP(self):
            return self.getTypedRuleContext(UnifiedIRParser.SymbolOPContext,0)


        def valueSet(self):
            return self.getTypedRuleContext(UnifiedIRParser.ValueSetContext,0)


        def Whose(self):
            return self.getToken(UnifiedIRParser.Whose, 0)

        def getRuleIndex(self):
            return UnifiedIRParser.RULE_filterByAttribute

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterFilterByAttribute" ):
                listener.enterFilterByAttribute(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitFilterByAttribute" ):
                listener.exitFilterByAttribute(self)




    def filterByAttribute(self):

        localctx = UnifiedIRParser.FilterByAttributeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_filterByAttribute)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 193
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==UnifiedIRParser.Whose:
                self.state = 192
                self.match(UnifiedIRParser.Whose)


            self.state = 195
            self.attribute()
            self.state = 196
            self.symbolOP()
            self.state = 197
            self.valueSet()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class FilterByPredicateContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def predicate(self):
            return self.getTypedRuleContext(UnifiedIRParser.PredicateContext,0)


        def To(self):
            return self.getToken(UnifiedIRParser.To, 0)

        def That(self):
            return self.getToken(UnifiedIRParser.That, 0)

        def logicGate(self):
            return self.getTypedRuleContext(UnifiedIRParser.LogicGateContext,0)


        def direction(self):
            return self.getTypedRuleContext(UnifiedIRParser.DirectionContext,0)


        def valueSet(self):
            return self.getTypedRuleContext(UnifiedIRParser.ValueSetContext,0)


        def symbolOP(self):
            return self.getTypedRuleContext(UnifiedIRParser.SymbolOPContext,0)


        def stringOP(self):
            return self.getTypedRuleContext(UnifiedIRParser.StringOPContext,0)


        def getRuleIndex(self):
            return UnifiedIRParser.RULE_filterByPredicate

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterFilterByPredicate" ):
                listener.enterFilterByPredicate(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitFilterByPredicate" ):
                listener.exitFilterByPredicate(self)




    def filterByPredicate(self):

        localctx = UnifiedIRParser.FilterByPredicateContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_filterByPredicate)
        self._la = 0 # Token type
        try:
            self.state = 240
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,28,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 200
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==UnifiedIRParser.That:
                    self.state = 199
                    self.match(UnifiedIRParser.That)


                self.state = 203
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==UnifiedIRParser.Not:
                    self.state = 202
                    self.logicGate()


                self.state = 205
                self.predicate()
                self.state = 207
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==UnifiedIRParser.Forward or _la==UnifiedIRParser.Backward:
                    self.state = 206
                    self.direction()


                self.state = 209
                self.match(UnifiedIRParser.To)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 212
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==UnifiedIRParser.That:
                    self.state = 211
                    self.match(UnifiedIRParser.That)


                self.state = 215
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==UnifiedIRParser.Not:
                    self.state = 214
                    self.logicGate()


                self.state = 217
                self.predicate()
                self.state = 219
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==UnifiedIRParser.Forward or _la==UnifiedIRParser.Backward:
                    self.state = 218
                    self.direction()


                self.state = 221
                self.match(UnifiedIRParser.To)
                self.state = 223
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << UnifiedIRParser.Not) | (1 << UnifiedIRParser.Is) | (1 << UnifiedIRParser.IsNot) | (1 << UnifiedIRParser.LargerThan) | (1 << UnifiedIRParser.SmallerThan) | (1 << UnifiedIRParser.AtLeast) | (1 << UnifiedIRParser.AtMost))) != 0):
                    self.state = 222
                    self.symbolOP()


                self.state = 225
                self.valueSet()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 228
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==UnifiedIRParser.That:
                    self.state = 227
                    self.match(UnifiedIRParser.That)


                self.state = 231
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==UnifiedIRParser.Not:
                    self.state = 230
                    self.logicGate()


                self.state = 233
                self.predicate()
                self.state = 235
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==UnifiedIRParser.Forward or _la==UnifiedIRParser.Backward:
                    self.state = 234
                    self.direction()


                self.state = 237
                self.match(UnifiedIRParser.To)
                self.state = 238
                self.stringOP()
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class FilterByQualifierContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def LB(self):
            return self.getToken(UnifiedIRParser.LB, 0)

        def qualifier(self):
            return self.getTypedRuleContext(UnifiedIRParser.QualifierContext,0)


        def symbolOP(self):
            return self.getTypedRuleContext(UnifiedIRParser.SymbolOPContext,0)


        def valueSet(self):
            return self.getTypedRuleContext(UnifiedIRParser.ValueSetContext,0)


        def RB(self):
            return self.getToken(UnifiedIRParser.RB, 0)

        def getRuleIndex(self):
            return UnifiedIRParser.RULE_filterByQualifier

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterFilterByQualifier" ):
                listener.enterFilterByQualifier(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitFilterByQualifier" ):
                listener.exitFilterByQualifier(self)




    def filterByQualifier(self):

        localctx = UnifiedIRParser.FilterByQualifierContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_filterByQualifier)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 242
            self.match(UnifiedIRParser.LB)
            self.state = 243
            self.qualifier()
            self.state = 244
            self.symbolOP()
            self.state = 245
            self.valueSet()
            self.state = 246
            self.match(UnifiedIRParser.RB)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DirectionContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return UnifiedIRParser.RULE_direction

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class ForwardContext(DirectionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.DirectionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def Forward(self):
            return self.getToken(UnifiedIRParser.Forward, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterForward" ):
                listener.enterForward(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitForward" ):
                listener.exitForward(self)


    class BackwardContext(DirectionContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.DirectionContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def Backward(self):
            return self.getToken(UnifiedIRParser.Backward, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterBackward" ):
                listener.enterBackward(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitBackward" ):
                listener.exitBackward(self)



    def direction(self):

        localctx = UnifiedIRParser.DirectionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_direction)
        try:
            self.state = 250
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [UnifiedIRParser.Forward]:
                localctx = UnifiedIRParser.ForwardContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 248
                self.match(UnifiedIRParser.Forward)
                pass
            elif token in [UnifiedIRParser.Backward]:
                localctx = UnifiedIRParser.BackwardContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 249
                self.match(UnifiedIRParser.Backward)
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class SetOPContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return UnifiedIRParser.RULE_setOP

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class OrContext(SetOPContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.SetOPContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def Or(self):
            return self.getToken(UnifiedIRParser.Or, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterOr" ):
                listener.enterOr(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitOr" ):
                listener.exitOr(self)


    class AndContext(SetOPContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.SetOPContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def And(self):
            return self.getToken(UnifiedIRParser.And, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterAnd" ):
                listener.enterAnd(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitAnd" ):
                listener.exitAnd(self)



    def setOP(self):

        localctx = UnifiedIRParser.SetOPContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_setOP)
        try:
            self.state = 254
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [UnifiedIRParser.And]:
                localctx = UnifiedIRParser.AndContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 252
                self.match(UnifiedIRParser.And)
                pass
            elif token in [UnifiedIRParser.Or]:
                localctx = UnifiedIRParser.OrContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 253
                self.match(UnifiedIRParser.Or)
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LogicGateContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return UnifiedIRParser.RULE_logicGate

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class NotContext(LogicGateContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.LogicGateContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def Not(self):
            return self.getToken(UnifiedIRParser.Not, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterNot" ):
                listener.enterNot(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitNot" ):
                listener.exitNot(self)



    def logicGate(self):

        localctx = UnifiedIRParser.LogicGateContext(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_logicGate)
        try:
            localctx = UnifiedIRParser.NotContext(self, localctx)
            self.enterOuterAlt(localctx, 1)
            self.state = 256
            self.match(UnifiedIRParser.Not)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class SymbolOPContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return UnifiedIRParser.RULE_symbolOP

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class EqualContext(SymbolOPContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.SymbolOPContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def Is(self):
            return self.getToken(UnifiedIRParser.Is, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEqual" ):
                listener.enterEqual(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEqual" ):
                listener.exitEqual(self)


    class LargerContext(SymbolOPContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.SymbolOPContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def LargerThan(self):
            return self.getToken(UnifiedIRParser.LargerThan, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterLarger" ):
                listener.enterLarger(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitLarger" ):
                listener.exitLarger(self)


    class SmallerContext(SymbolOPContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.SymbolOPContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def SmallerThan(self):
            return self.getToken(UnifiedIRParser.SmallerThan, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterSmaller" ):
                listener.enterSmaller(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitSmaller" ):
                listener.exitSmaller(self)


    class NotEqualContext(SymbolOPContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.SymbolOPContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def IsNot(self):
            return self.getToken(UnifiedIRParser.IsNot, 0)
        def Not(self):
            return self.getToken(UnifiedIRParser.Not, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterNotEqual" ):
                listener.enterNotEqual(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitNotEqual" ):
                listener.exitNotEqual(self)


    class LargerEqualContext(SymbolOPContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.SymbolOPContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def AtLeast(self):
            return self.getToken(UnifiedIRParser.AtLeast, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterLargerEqual" ):
                listener.enterLargerEqual(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitLargerEqual" ):
                listener.exitLargerEqual(self)


    class SmallerEqualContext(SymbolOPContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.SymbolOPContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def AtMost(self):
            return self.getToken(UnifiedIRParser.AtMost, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterSmallerEqual" ):
                listener.enterSmallerEqual(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitSmallerEqual" ):
                listener.exitSmallerEqual(self)



    def symbolOP(self):

        localctx = UnifiedIRParser.SymbolOPContext(self, self._ctx, self.state)
        self.enterRule(localctx, 38, self.RULE_symbolOP)
        try:
            self.state = 265
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [UnifiedIRParser.IsNot]:
                localctx = UnifiedIRParser.NotEqualContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 258
                self.match(UnifiedIRParser.IsNot)
                pass
            elif token in [UnifiedIRParser.Not]:
                localctx = UnifiedIRParser.NotEqualContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 259
                self.match(UnifiedIRParser.Not)
                pass
            elif token in [UnifiedIRParser.Is]:
                localctx = UnifiedIRParser.EqualContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 260
                self.match(UnifiedIRParser.Is)
                pass
            elif token in [UnifiedIRParser.LargerThan]:
                localctx = UnifiedIRParser.LargerContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 261
                self.match(UnifiedIRParser.LargerThan)
                pass
            elif token in [UnifiedIRParser.SmallerThan]:
                localctx = UnifiedIRParser.SmallerContext(self, localctx)
                self.enterOuterAlt(localctx, 5)
                self.state = 262
                self.match(UnifiedIRParser.SmallerThan)
                pass
            elif token in [UnifiedIRParser.AtLeast]:
                localctx = UnifiedIRParser.LargerEqualContext(self, localctx)
                self.enterOuterAlt(localctx, 6)
                self.state = 263
                self.match(UnifiedIRParser.AtLeast)
                pass
            elif token in [UnifiedIRParser.AtMost]:
                localctx = UnifiedIRParser.SmallerEqualContext(self, localctx)
                self.enterOuterAlt(localctx, 7)
                self.state = 264
                self.match(UnifiedIRParser.AtMost)
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class StringOPContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return UnifiedIRParser.RULE_stringOP

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class LargestContext(StringOPContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.StringOPContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def Largest(self):
            return self.getToken(UnifiedIRParser.Largest, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterLargest" ):
                listener.enterLargest(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitLargest" ):
                listener.exitLargest(self)


    class SmallestContext(StringOPContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.StringOPContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def Smallest(self):
            return self.getToken(UnifiedIRParser.Smallest, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterSmallest" ):
                listener.enterSmallest(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitSmallest" ):
                listener.exitSmallest(self)



    def stringOP(self):

        localctx = UnifiedIRParser.StringOPContext(self, self._ctx, self.state)
        self.enterRule(localctx, 40, self.RULE_stringOP)
        try:
            self.state = 269
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [UnifiedIRParser.Largest]:
                localctx = UnifiedIRParser.LargestContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 267
                self.match(UnifiedIRParser.Largest)
                pass
            elif token in [UnifiedIRParser.Smallest]:
                localctx = UnifiedIRParser.SmallestContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 268
                self.match(UnifiedIRParser.Smallest)
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class AggregateOPContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return UnifiedIRParser.RULE_aggregateOP

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class AverageContext(AggregateOPContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.AggregateOPContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def Average(self):
            return self.getToken(UnifiedIRParser.Average, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterAverage" ):
                listener.enterAverage(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitAverage" ):
                listener.exitAverage(self)


    class SumContext(AggregateOPContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.AggregateOPContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def Sum(self):
            return self.getToken(UnifiedIRParser.Sum, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterSum" ):
                listener.enterSum(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitSum" ):
                listener.exitSum(self)



    def aggregateOP(self):

        localctx = UnifiedIRParser.AggregateOPContext(self, self._ctx, self.state)
        self.enterRule(localctx, 42, self.RULE_aggregateOP)
        try:
            self.state = 273
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [UnifiedIRParser.Sum]:
                localctx = UnifiedIRParser.SumContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 271
                self.match(UnifiedIRParser.Sum)
                pass
            elif token in [UnifiedIRParser.Average]:
                localctx = UnifiedIRParser.AverageContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 272
                self.match(UnifiedIRParser.Average)
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ValueSetContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return UnifiedIRParser.RULE_valueSet

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class ValueAtomContext(ValueSetContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.ValueSetContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def value(self):
            return self.getTypedRuleContext(UnifiedIRParser.ValueContext,0)

        def valueType(self):
            return self.getTypedRuleContext(UnifiedIRParser.ValueTypeContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterValueAtom" ):
                listener.enterValueAtom(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitValueAtom" ):
                listener.exitValueAtom(self)


    class ValueByAttributeContext(ValueSetContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.ValueSetContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def attribute(self):
            return self.getTypedRuleContext(UnifiedIRParser.AttributeContext,0)

        def Of(self):
            return self.getToken(UnifiedIRParser.Of, 0)
        def entitySet(self):
            return self.getTypedRuleContext(UnifiedIRParser.EntitySetContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterValueByAttribute" ):
                listener.enterValueByAttribute(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitValueByAttribute" ):
                listener.exitValueByAttribute(self)


    class ValueByUnionContext(ValueSetContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.ValueSetContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def valueType(self):
            return self.getTypedRuleContext(UnifiedIRParser.ValueTypeContext,0)

        def valueSet(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(UnifiedIRParser.ValueSetContext)
            else:
                return self.getTypedRuleContext(UnifiedIRParser.ValueSetContext,i)

        def Or(self):
            return self.getToken(UnifiedIRParser.Or, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterValueByUnion" ):
                listener.enterValueByUnion(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitValueByUnion" ):
                listener.exitValueByUnion(self)


    class ValueByAggregateContext(ValueSetContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.ValueSetContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def aggregateOP(self):
            return self.getTypedRuleContext(UnifiedIRParser.AggregateOPContext,0)

        def Of(self):
            return self.getToken(UnifiedIRParser.Of, 0)
        def valueSet(self):
            return self.getTypedRuleContext(UnifiedIRParser.ValueSetContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterValueByAggregate" ):
                listener.enterValueByAggregate(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitValueByAggregate" ):
                listener.exitValueByAggregate(self)



    def valueSet(self):

        localctx = UnifiedIRParser.ValueSetContext(self, self._ctx, self.state)
        self.enterRule(localctx, 44, self.RULE_valueSet)
        self._la = 0 # Token type
        try:
            self.state = 292
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,35,self._ctx)
            if la_ == 1:
                localctx = UnifiedIRParser.ValueByUnionContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 275
                self.valueType()
                self.state = 276
                self.valueSet()
                self.state = 277
                self.match(UnifiedIRParser.Or)
                self.state = 278
                self.valueSet()
                pass

            elif la_ == 2:
                localctx = UnifiedIRParser.ValueByAggregateContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 280
                self.aggregateOP()
                self.state = 281
                self.match(UnifiedIRParser.Of)
                self.state = 282
                self.valueSet()
                pass

            elif la_ == 3:
                localctx = UnifiedIRParser.ValueByAttributeContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 284
                self.attribute()
                self.state = 285
                self.match(UnifiedIRParser.Of)
                self.state = 286
                self.entitySet()
                pass

            elif la_ == 4:
                localctx = UnifiedIRParser.ValueAtomContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 289
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << UnifiedIRParser.Text) | (1 << UnifiedIRParser.Quantity) | (1 << UnifiedIRParser.Date) | (1 << UnifiedIRParser.Month) | (1 << UnifiedIRParser.Year) | (1 << UnifiedIRParser.Time))) != 0):
                    self.state = 288
                    self.valueType()


                self.state = 291
                self.value()
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ValueTypeContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return UnifiedIRParser.RULE_valueType

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class DateContext(ValueTypeContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.ValueTypeContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def Date(self):
            return self.getToken(UnifiedIRParser.Date, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterDate" ):
                listener.enterDate(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitDate" ):
                listener.exitDate(self)


    class MonthContext(ValueTypeContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.ValueTypeContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def Month(self):
            return self.getToken(UnifiedIRParser.Month, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterMonth" ):
                listener.enterMonth(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitMonth" ):
                listener.exitMonth(self)


    class QuantityContext(ValueTypeContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.ValueTypeContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def Quantity(self):
            return self.getToken(UnifiedIRParser.Quantity, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterQuantity" ):
                listener.enterQuantity(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitQuantity" ):
                listener.exitQuantity(self)


    class YearContext(ValueTypeContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.ValueTypeContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def Year(self):
            return self.getToken(UnifiedIRParser.Year, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterYear" ):
                listener.enterYear(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitYear" ):
                listener.exitYear(self)


    class TextContext(ValueTypeContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.ValueTypeContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def Text(self):
            return self.getToken(UnifiedIRParser.Text, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterText" ):
                listener.enterText(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitText" ):
                listener.exitText(self)


    class TimeContext(ValueTypeContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a UnifiedIRParser.ValueTypeContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def Time(self):
            return self.getToken(UnifiedIRParser.Time, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterTime" ):
                listener.enterTime(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitTime" ):
                listener.exitTime(self)



    def valueType(self):

        localctx = UnifiedIRParser.ValueTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 46, self.RULE_valueType)
        try:
            self.state = 300
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [UnifiedIRParser.Text]:
                localctx = UnifiedIRParser.TextContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 294
                self.match(UnifiedIRParser.Text)
                pass
            elif token in [UnifiedIRParser.Quantity]:
                localctx = UnifiedIRParser.QuantityContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 295
                self.match(UnifiedIRParser.Quantity)
                pass
            elif token in [UnifiedIRParser.Date]:
                localctx = UnifiedIRParser.DateContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 296
                self.match(UnifiedIRParser.Date)
                pass
            elif token in [UnifiedIRParser.Month]:
                localctx = UnifiedIRParser.MonthContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 297
                self.match(UnifiedIRParser.Month)
                pass
            elif token in [UnifiedIRParser.Year]:
                localctx = UnifiedIRParser.YearContext(self, localctx)
                self.enterOuterAlt(localctx, 5)
                self.state = 298
                self.match(UnifiedIRParser.Year)
                pass
            elif token in [UnifiedIRParser.Time]:
                localctx = UnifiedIRParser.TimeContext(self, localctx)
                self.enterOuterAlt(localctx, 6)
                self.state = 299
                self.match(UnifiedIRParser.Time)
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class EntityContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def ENTI_START(self):
            return self.getToken(UnifiedIRParser.ENTI_START, 0)

        def string(self):
            return self.getTypedRuleContext(UnifiedIRParser.StringContext,0)


        def ENTI_END(self):
            return self.getToken(Parser.ENTI_END, 0)

        def getRuleIndex(self):
            return UnifiedIRParser.RULE_entity

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEntity" ):
                listener.enterEntity(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEntity" ):
                listener.exitEntity(self)




    def entity(self):

        localctx = UnifiedIRParser.EntityContext(self, self._ctx, self.state)
        self.enterRule(localctx, 48, self.RULE_entity)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 302
            self.match(UnifiedIRParser.ENTI_START)
            self.state = 303
            self.string()
            self.state = 304
            self.match(UnifiedIRParser.ENTI_END)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class AttributeContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def ATTR_START(self):
            return self.getToken(UnifiedIRParser.ATTR_START, 0)

        def string(self):
            return self.getTypedRuleContext(UnifiedIRParser.StringContext,0)


        def ATTR_END(self):
            return self.getToken(UnifiedIRParser.ATTR_END, 0)

        def getRuleIndex(self):
            return UnifiedIRParser.RULE_attribute

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterAttribute" ):
                listener.enterAttribute(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitAttribute" ):
                listener.exitAttribute(self)




    def attribute(self):

        localctx = UnifiedIRParser.AttributeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 50, self.RULE_attribute)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 306
            self.match(UnifiedIRParser.ATTR_START)
            self.state = 307
            self.string()
            self.state = 308
            self.match(UnifiedIRParser.ATTR_END)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ConceptContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def CONC_START(self):
            return self.getToken(UnifiedIRParser.CONC_START, 0)

        def string(self):
            return self.getTypedRuleContext(UnifiedIRParser.StringContext,0)


        def CONC_END(self):
            return self.getToken(UnifiedIRParser.CONC_END, 0)

        def getRuleIndex(self):
            return UnifiedIRParser.RULE_concept

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterConcept" ):
                listener.enterConcept(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitConcept" ):
                listener.exitConcept(self)




    def concept(self):

        localctx = UnifiedIRParser.ConceptContext(self, self._ctx, self.state)
        self.enterRule(localctx, 52, self.RULE_concept)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 310
            self.match(UnifiedIRParser.CONC_START)
            self.state = 311
            self.string()
            self.state = 312
            self.match(UnifiedIRParser.CONC_END)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class PredicateContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def PRED_START(self):
            return self.getToken(UnifiedIRParser.PRED_START, 0)

        def string(self):
            return self.getTypedRuleContext(UnifiedIRParser.StringContext,0)


        def PRED_END(self):
            return self.getToken(UnifiedIRParser.PRED_END, 0)

        def getRuleIndex(self):
            return UnifiedIRParser.RULE_predicate

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterPredicate" ):
                listener.enterPredicate(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitPredicate" ):
                listener.exitPredicate(self)




    def predicate(self):

        localctx = UnifiedIRParser.PredicateContext(self, self._ctx, self.state)
        self.enterRule(localctx, 54, self.RULE_predicate)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 314
            self.match(UnifiedIRParser.PRED_START)
            self.state = 315
            self.string()
            self.state = 316
            self.match(UnifiedIRParser.PRED_END)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class QualifierContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def QUAL_START(self):
            return self.getToken(UnifiedIRParser.QUAL_START, 0)

        def string(self):
            return self.getTypedRuleContext(UnifiedIRParser.StringContext,0)


        def QUAL_END(self):
            return self.getToken(UnifiedIRParser.QUAL_END, 0)

        def getRuleIndex(self):
            return UnifiedIRParser.RULE_qualifier

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterQualifier" ):
                listener.enterQualifier(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitQualifier" ):
                listener.exitQualifier(self)




    def qualifier(self):

        localctx = UnifiedIRParser.QualifierContext(self, self._ctx, self.state)
        self.enterRule(localctx, 56, self.RULE_qualifier)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 318
            self.match(UnifiedIRParser.QUAL_START)
            self.state = 319
            self.string()
            self.state = 320
            self.match(UnifiedIRParser.QUAL_END)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ValueContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def VALU_START(self):
            return self.getToken(UnifiedIRParser.VALU_START, 0)

        def string(self):
            return self.getTypedRuleContext(UnifiedIRParser.StringContext,0)


        def VALU_END(self):
            return self.getToken(UnifiedIRParser.VALU_END, 0)

        def getRuleIndex(self):
            return UnifiedIRParser.RULE_value

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterValue" ):
                listener.enterValue(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitValue" ):
                listener.exitValue(self)




    def value(self):

        localctx = UnifiedIRParser.ValueContext(self, self._ctx, self.state)
        self.enterRule(localctx, 58, self.RULE_value)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 322
            self.match(UnifiedIRParser.VALU_START)
            self.state = 323
            self.string()
            self.state = 324
            self.match(UnifiedIRParser.VALU_END)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class NumberContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def INTEGER(self):
            return self.getToken(UnifiedIRParser.INTEGER, 0)

        def getRuleIndex(self):
            return UnifiedIRParser.RULE_number

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterNumber" ):
                listener.enterNumber(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitNumber" ):
                listener.exitNumber(self)




    def number(self):

        localctx = UnifiedIRParser.NumberContext(self, self._ctx, self.state)
        self.enterRule(localctx, 60, self.RULE_number)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 326
            self.match(UnifiedIRParser.INTEGER)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class StringContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def SPACE(self, i:int=None):
            if i is None:
                return self.getTokens(UnifiedIRParser.SPACE)
            else:
                return self.getToken(UnifiedIRParser.SPACE, i)

        def STRING_LITERAL(self, i:int=None):
            if i is None:
                return self.getTokens(UnifiedIRParser.STRING_LITERAL)
            else:
                return self.getToken(UnifiedIRParser.STRING_LITERAL, i)

        def LB(self, i:int=None):
            if i is None:
                return self.getTokens(UnifiedIRParser.LB)
            else:
                return self.getToken(UnifiedIRParser.LB, i)

        def string(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(UnifiedIRParser.StringContext)
            else:
                return self.getTypedRuleContext(UnifiedIRParser.StringContext,i)


        def RB(self, i:int=None):
            if i is None:
                return self.getTokens(UnifiedIRParser.RB)
            else:
                return self.getToken(UnifiedIRParser.RB, i)

        def LITERAL(self, i:int=None):
            if i is None:
                return self.getTokens(UnifiedIRParser.LITERAL)
            else:
                return self.getToken(UnifiedIRParser.LITERAL, i)

        def getRuleIndex(self):
            return UnifiedIRParser.RULE_string

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterString" ):
                listener.enterString(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitString" ):
                listener.exitString(self)




    def string(self):

        localctx = UnifiedIRParser.StringContext(self, self._ctx, self.state)
        self.enterRule(localctx, 62, self.RULE_string)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 335 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 335
                self._errHandler.sync(self)
                token = self._input.LA(1)
                if token in [UnifiedIRParser.SPACE]:
                    self.state = 328
                    self.match(UnifiedIRParser.SPACE)
                    pass
                elif token in [UnifiedIRParser.STRING_LITERAL]:
                    self.state = 329
                    self.match(UnifiedIRParser.STRING_LITERAL)
                    pass
                elif token in [UnifiedIRParser.LB]:
                    self.state = 330
                    self.match(UnifiedIRParser.LB)
                    self.state = 331
                    self.string()
                    self.state = 332
                    self.match(UnifiedIRParser.RB)
                    pass
                elif token in [UnifiedIRParser.LITERAL]:
                    self.state = 334
                    self.match(UnifiedIRParser.LITERAL)
                    pass
                else:
                    raise NoViableAltException(self)

                self.state = 337 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << UnifiedIRParser.LB) | (1 << UnifiedIRParser.SPACE) | (1 << UnifiedIRParser.STRING_LITERAL) | (1 << UnifiedIRParser.LITERAL))) != 0)):
                    break

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx





