def p_join_block_0(p): """ join_block : LKEY union_block RKEY rest_join_block """ if (p[4] != [] and isinstance(p[4][0], Filter)): p[0] = [UnionBlock(p[2])] + p[4] elif (p[4] != []): p[0] = [UnionBlock(p[2])] + [JoinBlock(p[4])] else: p[0] = [UnionBlock(p[2])]
def p_join_block_service_0(p): """ join_block_service : LKEY bgp_service rest_join_block_service RKEY rest_join_block_service """ jb_list = [p[2]]+ p[3] if (p[5]!=[] and isinstance(p[5][0],Filter)): p[0] = [UnionBlock([JoinBlock(jb_list)])] + p[5] elif isinstance(p[2],UnionBlock): p[0] = [p[2]]+ p[3] + p[5] else: p[0] = [UnionBlock([JoinBlock(jb_list)])] + p[5]
def p_union_block_0(p): """ union_block : pjoin_block rest_union_block POINT pjoin_block """ punion = [JoinBlock(p[1])] + p[2] pjoin = [UnionBlock(punion)] + p[4] p[0] = [JoinBlock(pjoin)]
def p_bgp_01(p): """ bgp : bgp UNION bgp rest_union_block """ (jb1,filters1) = p[1] (jb3,filters3) = p[3] ggp = [JoinBlock(jb1,filters1)] + [JoinBlock(jb3,filters3)] + p[4] ggp1 = [UnionBlock(ggp)] p[0]=(ggp1,[])
def p_bgp_00(p): """ bgp : LKEY bgp UNION bgp rest_union_block RKEY """ (jb1,filters1) = p[2] (jb3,filters3) = p[4] ggp = [JoinBlock(jb1,filters1)] + [JoinBlock(jb3,filters3)] + p[5] ggp1 = [UnionBlock(ggp)] p[0]=(ggp1,[])
def p_union_block_1(p): """ union_block : pjoin_block rest_union_block pjoin_block """ punion = [JoinBlock(p[1])] + p[2] if (p[3] != []): pjoin = [UnionBlock(punion)] + p[3] p[0] = [JoinBlock(pjoin)] else: p[0] = [JoinBlock(p[1])] + p[2]
def decomposeUnionBlock(ub, l, genPred, prefixes, decomposition, c): r = [] for jb in ub.triples: pjb = decomposeJoinBlock(jb, l, genPred, prefixes, decomposition, c) if pjb: r.append(pjb) if r: return UnionBlock(r) else: return None
def getExclusiveGroups(l, tl, prefixes): (qcl0, qcl1) = assignEndpoint2(tl, l, prefixes) views0 = [] views1 = [] for cl in qcl0: l0 = qcl0[cl] serv = Service(cl, l0) views0 = views0 + [serv] for t in qcl1: eps = qcl1[t] elems = [JoinBlock([Service(ep, t)]) for ep in eps] ub = UnionBlock(elems) views1 = views1 + [ub] return (views0, views1)
def getUnitaryStars(l, tl, genPred, prefixes): (qcl0, qcl1) = assignEndpoint(tl, l, genPred, prefixes) views0 = [] views1 = [] for cl in qcl0: l0 = qcl0[cl] vs = formStars2(l0) serv = [Service(cl, view) for view in vs] views0 = views0 + serv for t in qcl1: eps = qcl1[t] elems = [JoinBlock([Service(ep, t)]) for ep in eps] ub = UnionBlock(elems) views1 = views1 + [ub] return (views0, views1)
def getStarsM(l, tl, genPred, prefixes, c): (qcl0, qcl1) = assignEndpointM(tl, l, genPred, prefixes, c) views0 = [] views1 = [] #print qcl0 #print qcl1 for cl in qcl0: l0 = qcl0[cl] vs = formStars(l0) serv = [Service(cl, view) for view in vs] views0 = views0 + serv for t in qcl1: eps = qcl1[t] elems = [JoinBlock([Service(ep, t)]) for ep in eps] ub = UnionBlock(elems) views1 = views1 + [ub] return (postp2(views0), views1)
def updateFilters(node, filters): return UnionBlock(node.triples, filters)
def p_ggp_0(p): """ group_graph_pattern : union_block """ p[0] = UnionBlock(p[1])
def makePlanUnionBlock(ub, plan): r = [] #print "makePlanUnionBlock " + " ".join(map(str,ub.triples)) for jb in ub.triples: r.append(makePlanJoinBlock(jb, plan)) return UnionBlock(r, ub.filters)
def p_bgp_0(p): """ bgp : LKEY bgp UNION bgp rest_union_block RKEY """ ggp = [JoinBlock([p[2]])] + [JoinBlock([p[4]])] + p[5] p[0] = UnionBlock(ggp)
def p_bgp_service_5(p): """ bgp_service : LKEY join_block_service rest_union_block_service RKEY """ bgp_arg = p[2] + p[3] p[0] = UnionBlock(JoinBlock(bgp_arg))
def p_bgp_service_02(p): """ bgp_service : join_block_service UNION join_block_service rest_union_block_service """ ggp = [JoinBlock(p[1])] + [JoinBlock(p[3])] + p[4] p[0] = UnionBlock(ggp)
def p_bgp_service_01(p): """ bgp_service : LKEY join_block_service UNION join_block_service rest_union_block_service RKEY """ ggp = [JoinBlock(p[2])] + [JoinBlock(p[4])] + p[5] p[0] = UnionBlock(ggp)
def p_ggp_service_0(p): """ group_graph_pattern_service : union_block_service """ p[0] = UnionBlock(p[1])
def p_bgp_01(p): """ bgp : bgp UNION bgp rest_union_block """ ggp = [JoinBlock([p[1]])] + [JoinBlock([p[3]])] + p[4] p[0] = UnionBlock(ggp)
def makePlanUnionBlock(ub, plan): r = [] for jb in ub.triples: r.append(makePlanJoinBlock(jb, plan)) return UnionBlock(r)