def p_object_constant(p): """ object : CONSTANT """ c = p[1].strip() p[0] = Argument(p[1], True) if xsd in p[1]: p[0] = Argument(c[:c.find("^")], True, datatype=c[c.rfind("^") + 1:]) if "@" in p[1]: p[0] = Argument(c[:c.find("^")], True, datatype="<" + xsd + "string>", lang=c[c.rfind("@") + 1:])
def p_express_arg_2(p): """ express_arg : CONSTANT """ c = p[1].strip() p[0] = Argument(p[1], True) if xsd in p[1]: p[0] = Argument(c[:c.find("^")], True, datatype=c[c.rfind("^") + 1:]) if "@" in p[1]: p[0] = Argument(c[:c.find("^")], True, datatype="<" + xsd + "string>", lang=c[c.rfind("@") + 1:])
def p_predicate_rdftype(p): """ predicate : ID """ if p[1] == 'a': value = '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>' p[0] = Argument(value, True) else: print('raising') p_error(p[1]) raise SyntaxError
def p_predicate_var(p): """ predicate : VARIABLE """ p[0] = Argument(p[1], False)
def p_predicate_uri(p): """ predicate : uri """ p[0] = Argument(p[1], True)
def p_single_var_list(p): """ var_list : VARIABLE """ p[0] = [Argument(p[1], False)]
def p_var_list(p): """ var_list : var_list VARIABLE """ p[0] = p[1] + [Argument(p[2], False)]
def p_express_arg_4(p): """ express_arg : REGEX LPAR express_arg COMA pattern_arg regex_flag """ p[0] = Expression("REGEX", p[3], Argument(p[5], False, p[6]))
def p_desc_var_0(p): """ desc_var : DESC LPAR VARIABLE RPAR """ p[0] = Argument(p[3], False, True)
def p_express_arg_3(p): """ express_arg : NUMBER """ p[0] = Argument(p[1], True)
def p_express_arg_1(p): """ express_arg : VARIABLE """ p[0] = Argument(p[1], False)
def p_express_arg_0(p): """ express_arg : uri """ p[0] = Argument(p[1], True)
def p_desc_var_2(p): """ desc_var : ASC LPAR VARIABLE RPAR """ p[0] = Argument(p[3], False, False)
def p_desc_var_1(p): """ desc_var : VARIABLE """ p[0] = Argument(p[1], False, False)
def p_subject_variable(p): """ subject : VARIABLE """ p[0] = Argument(p[1], False)
def p_object_uri(p): """ object : uri """ p[0] = Argument(p[1], True)
def p_express_arg_03(p): """ express_arg : NUMBER POINT NUMBER """ decimalNumber = str(p[1]) + p[2] + str(p[3]) p[0] = Argument(decimalNumber, True)