// ex3.trp - Example 3
//
// A TRIPLE example with parameterized models
//
@world1 {
tom [plays -> tennis].
bob [plays -> baseball].
}
@world2 {
fred [watches -> football].
hank [plays -> hockey].
}
FORALL Mdl @sports(Mdl) {
FORALL O,P,V O[P->V] <- O[P->V]@Mdl.
//Everything true in @Mdl is true here, too
FORALL O,V O[watches->V] <- O[plays->V].
//Assume that everyone who plays a sport also watches it
}
//A Query (show all facts in model sports(world1) then model sports(world2))
FORALL X,Y,Z <- X[Y->Z]@sports(world1).
FORALL X,Y,Z <- X[Y->Z]@sports(world2).
/* OUTPUT
***
X = tom, Y = watches, Z = tennis
X = tom, Y = plays, Z = tennis
X = bob, Y = watches, Z = baseball
X = bob, Y = plays, Z = baseball
***
X = fred, Y = watches, Z = football
X = hank, Y = watches, Z = hockey
X = hank, Y = plays, Z = hockey
*/