You seem to be a beginner in Prolog, you should look at
and in particular the online book Learn Prolog Now