def matchesTripleExprLabel(cntxt: Context, T: RDFGraph, expr: ShExJ.tripleExprLabel, c: DebugContext) -> bool: if c.debug: print(f" {expr}") te = cntxt.tripleExprFor(expr) if te: return matchesCardinality(cntxt, T, te) cntxt.fail_reason = f"{expr}: Labeled triple expression not found" return False
def matchesTripleExprRef(cntxt: Context, T: RDFGraph, expr: ShExJ.tripleExprLabel, _: DebugContext) -> bool: """ expr is an tripleExprRef and satisfies(value, tripleExprWithId(tripleExprRef), G, m). The tripleExprWithId function is defined in Triple Expression Reference Requirement below. """ expr = cntxt.tripleExprFor(expr) if expr is None: cntxt.fail_reason = "{expr}: Reference not found" return False return all(matchesTripleConstraint(cntxt, t, expr) for t in T)