Question: use SWI-Prolog to do the problem, show the program screenshots Problem 3: Simple inheritance network % Implement isa and aka predicates in Prolog. % isa(Name,

use SWI-Prolog to do the problem, show the program screenshots

Problem 3: Simple inheritance network % Implement isa and aka predicates in Prolog. % isa(Name, Class): returns true if entity Name is a member of Class. % aka(SubC, Class): returns true if SubC is a Subclass of Class. % Given two types of facts: % prop(Name, type, Class): Name isa member of Class without using % inheritance. % prop(SubC, subclass, Class): Subc is a subclass of Class without % using inheritance % Test data: prop(tweety, type, canary). prop(snoopy, type, beagle). prop(canary, subclass, bird). prop(beagle, subclass, dog). prop(bird, subclass, animal). prop(dog, subclass, animal).

% Implement isa and aka using recursion. DO NOT use assert! % You can implement this problem in 4 rules! % Hints: implement aka using aka and prop, % implement isa using prop and aka.

% test cases: % ?- isa(tweety, canary). (Note: No inheritance used) % true. % ?- isa(tweety, bird). (Note: Inheritance used) % true. % ?- isa(tweety, animal). % true. % ?- isa(tweety, dog). % false. % ?- aka(canary, bird). (Note: no inheritance used) % true. % ?- aka(canary, animal). (Note: inheritance used) % true. % ?- aka(snoopy, animal). % false. (Because snoopy is a member of animal, not a subclass!)

% Type your solution here:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!