Reputation: 27166
I'm sure this is a n00b question, but how do I ask for things which satisfy one predicate and not another?
Eg. in a database of people and ice-cream,
person(john).
person(jane).
person(nicholas).
likes(john,strawberry).
likes(john,mint).
likes(jane,choc-chip).
How do I ask for the people who don't like ice-cream, to get just nicholas?
Upvotes: 0
Views: 62
Reputation: 2854
This query is true if X
is a person, and there exists no _
where likes(X, _)
is true.
person(X), \+ likes(X, _).
X
will evaluate to Nicolas
.
Upvotes: 1