Structure

Structures are other useful tools for storing information. They are similar to record in table in databases.
For example people with their favorite tv station name.
ft(person(james,abc)).
ft(person(hillary,cnn)).
ft(person(johnson,fox)).
ft(person(rice,fox)).
The following queries can be asked
2 ?- ft(person(X,Y)).

X = james
Y = abc ;

X = hillary
Y = cnn ;

X = johnson
Y = fox ;

X = rice
Y = fox ;

No
Example of other queries include
3 ?- ft(person(james,X)).

X = abc

Yes
and
4 ?- ft(person(X,fox)).

X = johnson ;

X = rice ;

No
5 ?-
Exercises
  1. Build a database of name and research area and try few queries