A apresentação está carregando. Por favor, espere

A apresentação está carregando. Por favor, espere

Correção dos exercícios de engenharia do conhecimento em LIFE Jacques Robin, DI-UFPE www.di.ufpe.br/~jr.

Apresentações semelhantes


Apresentação em tema: "Correção dos exercícios de engenharia do conhecimento em LIFE Jacques Robin, DI-UFPE www.di.ufpe.br/~jr."— Transcrição da apresentação:

1 Correção dos exercícios de engenharia do conhecimento em LIFE Jacques Robin, DI-UFPE www.di.ufpe.br/~jr

2 Estudo de caso: West é criminoso? Requisitos em Inglês 1. Para um americano, é criminoso vender armas a uma nação hostil aos EUA 2. Nono tem pelo menos um míssil 3. Nono comprou todos seus mísseis de West 4. Um míssil é um tipo de arma 5. Toda as nações inimigas dos EUA são consideradas hostis 6. West é americano 7. Nono é os EUA são nações 8. Nono é um inimigo dos EUA 0. Será que West é criminoso? criminal(P) :- american(P), weapon(W), nation(N), hostile(N), sells(P,N,W). owns(nono,m1). missile(m1). sells(west,nono,W) :- owns(nono,W), missile(W). weapon(W) :- missile(W). hostile(N) :- enemy(N,america). american(west). nation(nono). enemy(nono,america). nation(america).

3 Correção do exercício 5: West é criminoso? em LIFE entities := {situation; object; quality; quantity; place; time}. situation := {event; relation}. event := {action; happening}. relation := {own; enemy}. object := {physObj; org}. physObj := {liveBeing; artefact}. nation := place(enemy => nation ). nation := {nono ; america}. weapon <| artefact. missile <| weapon. m1 <| missile. delay_check(person)? delay_check(nation)? person := liveBeing(nation => nation, acts => A) | checkList(A,action). checkList([ ], Sort) -> true. checkList([Sort|Tail],Sort) -> checkList(Tail,Sort). transact := action(seller => {person; nation}, buyer => {person; nation}, object => artefact). :: nono (enemy => america). criminal(P:person(nation => america)) :- member(transact(seller => P, buyer => N:nation, object => weapon), P.acts), hostile(N). hostile(N:nation(enemy => america)). W:west := person(nation => america, acts => [transact(seller => W, buyer => nono, object => m1)]). > criminal(west)? <-- *yes*

4 Estudo de caso: o BD acadêmico Requisitos em Inglês 1. Bob is 40 and the manager of the CS department. 2. His assistants are John and Sally. 3. Marys highest degree is an MS and she works at the CS department. 4. She co-authored with her boss and her friends, John and Sally, a paper published in the Journal of the ACM. 5. Phil is a faculty, who published a paper on F- Logic at a Conference of the ACM, jointly with Mary and Bob. 6. Every faculty is a midaged person who writes article, makes in the average $50,000 a year and owns a degree of some kind, typically a PhD. 7. One is considered midage if one is between 30 and 50 years old. 8. A facultys boss is both a faculty and a manager. 9. Friends and children of a person are also persons. 10. Every department has a manager who is an employee and assistants who are both employees and students 11. A boss is an employee who is the manager of another employee of the same department. 12. A joint work is a paper that is written by two faculties 13. There are three types of papers: technical reports, journal papers and conference papers 0a: Who are the midaged employees of the CS department and who are their boss? 0b: Who published jointly with Mary in the Journal of the ACM? 0c: Where did Mary published joint work with Phil?

5 Correção do exercício 6: O banco de dados acadêmico em LIFE 1/ Hierarquia de tipos entities := {situation; object; quality; quantity; place; time}. situation := {event; relation}. event := {action; happening}. action := {writing}. object := {physObj; org}. physObj := {liveBeing; artefact}. liveBeing := {person}. person := {adult; child}. delay_check(person)? adult := {empl; student}. empl := {faculty; manager; john; sally}. delay_check(empl)? faculty := {bob; mary; phil}. delay_check(faculty)? manager := {bob}. student := {john; sally}. artefact := {document}. document := {article}. article := {journalArt;confArt}. journalArt := {jacm}. jacm := {jacm1}. confArt := {cacm }. cacm := {cacm1}. org := {dept}. dept := {cs}. quality := {rank}. rank := {degree}. degree := {bs; ms; phd}.

6 Correção do exercício 6: O banco de dados acadêmico em LIFE 3/ Herança de atributos :: person(friends => F, children => C) | checkList(F,person), checkList(C,child). :: empl(affil => D:dept, boss => B:empl) | D.mngr = B. :: faculty(boss => F:faculty & manager, age => A:int, hideg => H:degree, papers => P, avgSalary => 50000) | midaged(A), faculty_hideg(H), checkList(P,article). :: document(title => X, authors => As) | checkList(As,person). :: dept(assists => A, mngr => empl ) | checkList(A,student), checkList(A,empl). :: bob(age => 40, affil => cs). :: mary(hideg => ms, friends => [bob, sally], affil => cs). :: sally(age => 40, affil => cs). :: phil(affil => cs). :: john(affil => cs). :: jacm1(authors => [phil, mary, bob], title=>florid). :: cacm1(authors => [john, sally, mary, bob], title=>flogic). :: cs(mngr => bob, assists => [john,sally]).

7 Correção do exercício 6: O banco de dados acadêmico em LIFE 3/ Funções e Predicados Funções: checkList([],Sort) -> true. checkList([Sort|Tail],Sort) -> checkList(Tail). midaged(Age:int) -> Age >= 30, Age =< 50. Predicados: * declarações: faculty_hideg(phd) :- !. faculty_hideg(ms) :- !. faculty_hideg(bs). obj({bob; sally; mary; phil; john; jacm1; cacm1}). * consultas: obj(B:empl(affil => cs, age => A, boss =>B)), midaged(A)? obj(C:cacm(title => T, authors => A)), member(mary,A)? obj(J:jacm(title => T, authors => A)), member(mary,A), member(phil,A)?


Carregar ppt "Correção dos exercícios de engenharia do conhecimento em LIFE Jacques Robin, DI-UFPE www.di.ufpe.br/~jr."

Apresentações semelhantes


Anúncios Google