Presentation is loading. Please wait.

Presentation is loading. Please wait.

predicates nondeterm isa(symbol,symbol) nondeterm hasprop(symbol,symbol,symbol). nondeterm hasproperty(symbol,symbol,symbol). clauses isa(canary,bird).

Similar presentations


Presentation on theme: "predicates nondeterm isa(symbol,symbol) nondeterm hasprop(symbol,symbol,symbol). nondeterm hasproperty(symbol,symbol,symbol). clauses isa(canary,bird)."— Presentation transcript:

1

2 predicates nondeterm isa(symbol,symbol) nondeterm hasprop(symbol,symbol,symbol). nondeterm hasproperty(symbol,symbol,symbol). clauses isa(canary,bird). isa(robin,bird). isa(ostrich,bird). isa(bird,animal). isa(opus,penguin). isa(penguin,bird). isa(fish,animal). isa(tweety,canary). hasprop(tweety,color,white). hasprop(robin,color,red). hasprop(canary,color,yellow). hasprop(penguin,color,brown). hasprop(bird,travel,fly). hasprop(fish,travel,swim). hasprop(ostrich,travel,walk). hasprop(penguin,travel,walk). hasprop(robin,sound,sing). hasprop(canary,sound,sing). hasprop(bird,cover,feather). hasprop(animal,cover,skin). hasproperty(Obj,Pr,Val):-hasprop(Obj,Pr,Val). hasproperty(Obj,Pr,Val):- isa(Obj,Parent),hasproperty(Parent,Pr,Val). goal hasproperty(Obj,Pr,fly). Implementing inference using inheretance

3 Name:bird Isa: animal Prop:flies,feather Default: Name:animal Isa: animate Prop:eats,skin Default: Name:canary Isa: bird Prop: color(yellow),sound(sing) Default:size(small) Name:tweety Isa: canary Prop: color(yellow),sound(sing) Default:color(white) Frames from a knowledge base of birds

4 domains obj=symbol prop=travel(symbol);color(symbol);call(symbol);size(symbol);cover(symbol);actio n(symbol) listp=prop* name=name(obj) isa=isa(obj) predicates nondeterm frame(name,isa,listp,listp) nondeterm get(prop,obj) nondeterm member(prop,listp) nondeterm memberf(prop,listp) nondeterm uget(obj,listp) nondeterm equal(prop,prop) print(listp) clauses frame(name(bird),isa(animal),[travel(flies),cover(feathers)],[]). frame(name(penguin),isa(bird),[color(brown)],[travel(walks)]). frame(name(canary),isa(bird),[color(yellow),call(sing)],[size(small)]). frame(name(tweety),isa(canary),[],[color(white)]). equal(travel(_),travel(_)). equal(color(_),color(_)). equal(call(_),call(_)). equal(size(_),size(_)). equal(cover(_),cover(_)). equal(action(_),action(_)).

5 memberf(P,[H|_]):-equal(P,H). memberf(Pro,[_|T]):-memberf(Pro,T). member(P,[H|_]):-P=H. member(Pro,[_|T]):-member(Pro,T). get(Pro,Obj):-frame(name(Obj),_,LP,_),member(Pro,LP). get(Pro,Obj):-frame(name(Obj),_,_,LD),member(Pro,LD). get(Pro,Obj):-frame(name(Obj),isa(Parent),_,_),get(Pro,Parent). uget(Obj,L):-get(H,Obj),NOT(memberf(H,L)),uget(Obj,[H|L]). uget(Obj,L):-write(Obj),write(":"),print(L). print([]). print([H|T]):-write(H),print(T). goal uget(tweety,[]). tweety:cover("feathers")travel("flies")size("small")call("sing")color("white")yes


Download ppt "predicates nondeterm isa(symbol,symbol) nondeterm hasprop(symbol,symbol,symbol). nondeterm hasproperty(symbol,symbol,symbol). clauses isa(canary,bird)."

Similar presentations


Ads by Google