What you've given is a Prolog query that should be entered in the Prolog command prompt. It looks like you've put it into a Prolog source file, which isn't going to work. Prolog source files can only contain facts and rules.
A fact might look like this:
foo(bar).
A rule might look like this:
foo(X) :- baz(X).
The snippet you gave doesn't match either of these. In a Prolog source file, you can only string multiple conjunctions or disjunctions together in the body of a rule (ie the part to the right of the :-
symbol).
You might want to read up on how to write prolog predicates.