I'm trying to create a Prolog query for a database I translated from mySql to Prolog facts.
The Prolog facts regard many tables, but the relevant ones for this query are just two:
actor(ID,firstName,lastName)
film_actor(actor_id,film_id)
film(ID, title,_,_,_,_,_,_,_)
I'm trying to create a query that states the following:
List the title of the films that have exactly 5 actors.
So far I managed to create this query that lists me all the films and the ID of each actor in that film:
all((T,AID),(film(FID,C,T,_,_,_,_,_,_),film_actor(AID,FID)),RS).
What I need is to count this AID and state that is must be equal to 5 occurrences for each film_id But I do not know how to do that from the yap documentation I read so far.
Any tips?
Thanks in advance