Write a list of facts that are points on a graph (ex: point(1,3).)
• Sample fact: point(1,3).
• Add at least 6 more.
Write a rule that determines whether a line going through 2 points is horizontal. A Horizontal line requires that the Y value be the same. The X value must be different.
• The planned query is horizontal (X1,Y1,X2,Y2).
• This means that horizontal(4 variables ) needs to be the head (left part) of a rule, and the body (right side of the rule) needs to include rules about point( ? , ?).
• The head is followed by :- and then the facts that must be true.
Write another rule that determines whether a line going through 2 points is vertical.
Run a query to see all the points in your knowledgebase that start with X=1.
• Example: To find all the loves which had love object = Amy, you ran the query loves(X,Amy).
Run a query to test two points in your knowledgebase:
Comments
Leave a comment