Currently Being Moderated
Hi RP
ForScope is to "look at" a single instance in a to-one relationship.
So if the person-->the house is a one-to-one relationship ("the person's house"), and you wanted to go from the person to the house, you would write:
the person lives in a nice house if
...ForScope(the person's house)
.....the house is big and
.....the house is expensive
In reality, a person may have many houses (lucky them!). So the relationship will probably be a one-to-many relationship ("the person's houses").
Now we would need to use ForAllScope()... this runs the rule for ALL of the instances of "the house" in the relationship "the person's houses". If all of them are big and expensive, then this returns TRUE. If 3 of them are big and expensive, but one of them isn't, then this returns false. Instance 1 is true AND instance 2 is true AND instance 3 is true... etc. Note that the conclusion has been re-worded to make more sense:
all of the person's houses are nice houses if
...ForAllScope(the person's houses)
.....the house is big and
.....the house is expensive
ExistsScope() could be used to check that at least one of the person's houses is nice, and would probably be more appropriate to model the meaning of the original rule:
the person lives in a nice house if
...ExistsScope(the person's houses)
.....the house is big and
.....the house is expensive
But if person-->house was a one-to-one relationship, you have to use ForScope, since it doesn't make sense to say ForAll when there can only ever be one of them.
Hope this helps.
Ben