def i_constraintOperator(ss: Substrate, oco: Optional(constraintOperator), input_: Sctids_or_Error) -> Sctids_or_Error:
    if input_.inran('error') or oco.is_empty:
        return input_
    input_ = input_.ok
    # TODO: Because we aren't doing equivalence, we can be sure (?) that the targets are always a singleton
    if oco.head == descendantOrSelfOf:
        rval = input_ | descendants_of(input_)
        # return Sctids_or_Error(ok=Set.SetInstance.bigcup(Set(sctId), [ss.descendants(id_) for id_ in
        #                                                               result_sctids(input_)]).union(result_sctids(input_)))
    elif oco.head == descendantOf:
        rval = descendants_of(input_)
        # return Sctids_or_Error(ok=Set.SetInstance.bigcup(Set(sctId), ss.descendants(result_sctids(input_))))
    elif oco.head == ancestorOrSelfOf:
        rval = input_ | ancestors_of(input_)
        # return Sctids_or_Error(ok=Set.SetInstance.bigcup(Set(sctId), [ss.ancestors(id_) for id_ in
        #                                                               result_sctids(input_)]).union(result_sctids(input_)))
    else:
        rval = ancestors_of(input_)
        # return Sctids_or_Error(ok=Set.SetInstance.bigcup(Set(sctId), [ss.ancestors(id_) for id_ in result_sctids(input_)]))
    return Sctids_or_Error(ok=rval)
Пример #2
0
def minus(x: Sctids_or_Error, y: Sctids_or_Error) -> Sctids_or_Error:
    if x.inran("error") or y.inran("error"):
        return first_error(Seq(Sctids_or_Error)(x, y))
    return Sctids_or_Error(ok=x.ok.minis(y.ok))
Пример #3
0
def intersect(x: Sctids_or_Error, y: Sctids_or_Error) -> Sctids_or_Error:
    if x.inran("error") or y.inran("error"):
        return first_error(Seq(Sctids_or_Error)(x, y))
    return Sctids_or_Error(ok=x.ok.intersect(y.ok))
Пример #4
0
def result_sctids(r: Sctids_or_Error) -> Seq(sctId):
    if r.inran("error"):
        return Seq(sctId)()
    else:
        return r.ok
Пример #5
0
def gminus(x: Sctids_or_Error, y: Sctids_or_Error) -> Sctids_or_Error:
    if x.inran("gerror") or y.inran("gerror"):
        return gfirst_error(Seq(sctIdGroups_or_Error)(x, y))
    return sctIdGroups_or_Error(group_value=x.group_value.intersect(y.group_value))