Taking union of two rule clauses

You can also write it as two clauses (there’s an implicit “or” between clauses):

checkWR(ObjectType, ObjectId, Relation, UserObjectType, UserObjectId) :-
  tuple(ObjectType, ObjectId, Relation, UserObjectType, UserObjectId).
checkWR(ObjectType, ObjectId, Relation, UserObjectType, UserObjectId) :-
  tuple(ObjectType, ObjectId, Relation,
        userset(UsersetObjectType,UsersetObjectId,UsersetRelation)),
  check(UsersetObjectType, UsersetObjectId, UsersetRelation, UserObjectType, UserObjectId).
3 Likes