1 / 10

Correção dos exercícios de engenharia do conhecimento em FLORID

Correção dos exercícios de engenharia do conhecimento em FLORID. Jacques Robin, DI-UFPE www.di.ufpe.br/~jr. 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

maddox
Download Presentation

Correção dos exercícios de engenharia do conhecimento em FLORID

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Correção dos exercícios de engenharia do conhecimento em FLORID 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?

  3. Estudo de caso: a terrível novelaRequisitos em Inglês 1. A soap opera is a TV show whose characters include a husband, a wife and a mailman such that: 2. the wife and the mailman blackmail each other 3. everybody is either alcoholic, drug addict or gay 4. Dick is gay, Jane is alcoholic and Harry is a drug addict 5. the wife is always an alcoholic and the long-lost sister of her husband 6. the husband is always called Dick and the lover of the mailman 7. the long-lost sister of any gay is called either Jane or Cleopatra 8. Harry is the lover of every gay 9. Jane blackmails every drug addicted lover of Dick 10. soap operas are invariably terrible! 0.Who are the characters of a terrible TV show?

  4. situation::entity. event::situation. action::event. happening::event. relation::situation. object::entity. physObj::object. artefact::physObj. liveBeing::physObj. org::object. quality::entity. quantity::entity. place::entity. time::entity. Parte comum as 2 BDDs: ontologia geral

  5. % Instancias (BD extensional): m1:missile. usa:nation. criminal:ethical_level. nono:nation[enemies ->> usa]. west:person [nationalities ->> usa; acts ->> transact[seller -> west; buyer -> nono; bought ->> m1]]. % Deduction rules (BD intencional): transact[seller => S; buyer => B] :- S:person, B:person. transact[seller => S; buyer => B] :- S:person, B:nation. transact[seller => S; buyer => B] :- S:nation, B:person. transact[seller => S; buyer => B] :- S:nation, B:nation. N:nation[hostile -> yes] :- N[enemies ->> usa]. P:person[ethics -> criminal] :- P[nationalities ->> usa; acts ->> transact[seller -> P; buyer -> N:nation[hostile -> yes]; bought ->> W:weapon]]. West é criminoso? em FLORIDInstâncias e Regras

  6. % Class hierarchy % A/ General ontology ?- sys.consult@("glonto.flp")[]. % B/ Domain-specific ontology transact::action[bought =>> artefact]. person::liveBeing[nationalities =>> nation; acts =>> action; ethics => ethical_level]. weapon::artefact. missile::weapon. ethical_level::quality. nation::place[enemies =>> nation]. % Debug set-up ?- sys.theEval.debugOn@("insert", "trigger", "dump")[]. ?- sys.theOM.eqTraceOn[]. % Queries ?- sys.eval[]. ?- west[ethics -> criminal]. true. ?- west[ethics -> C]. C/criminal. true ?- west[A -> V]. West é criminoso? em FLORIDHierarquia de classes e Consultas

  7. % Class hierarchy % A/ General ontology ?- sys.consult@("glonto.flp")[]. % B/ Domain-specific ontology person::liveBeing [name => string; sex => sex; addictions =>> addictiveSub; lover =>> person; blackmails => person; sexOrient =>> sexOrient; longLostSister => person[sex => female]]. addictiveSub::artefact. org::object. tvShow::org[rating => rating]. sex::quality. sexOrient::quality. rating::quality. % Instances: male:sex. female:sex. gay:sexOrient. straight:sexOrient. terrible:rating. alcohol:addictiveSub. drugs:addictiveSub. % 4. Dick is gay, Jane is alcoholic and % Harry is a drug addict dick:person[name -> "dick"; sex -> male; sexOrient ->> gay]. jane:person[name -> "jane"; sex -> female; addictions ->> alcohol]. harry:person[name -> "harry"; sex -> male; addictions ->> drugs]. soap1:tvShow[husband -> dick; wife -> jane; mailman -> harry]. “A terrível novela” em FLORID:hierarquia de classes e instâncias

  8. ?- sys.strat.doIt[]. ?- P:person[name -> N; sex -> S; sexOrient ->> O; addictions ->> A]. ?- P:person[name -> N; sex -> S; addictions ->> A]. ?- P:person[name -> N; sex -> S; sexOrient ->> A]. % Rules: % 3. everybody is either alcoholic, drug addict or gay P:soapChar :- P:person[addictions ->> drugs]. P:soapChar :- P:person[addictions ->> alcohol]. P:soapChar :- P:person[sexOrient ->> gay]. ?- sys.strat.doIt[]. ?- P:soapChar[name -> N]. % 7. the long-lost sister of any gay is called either Jane or Cleopatra G[longLostSister -> S] :- G:person[sexOrient ->> gay], S:person[name -> "jane"]. G[longLostSister -> S] :- G:person[sexOrient ->> gay], S:person[name -> "cleopatra"]. % 8. Harry is the lover of every gay harry[lover ->> G] :- G:person[sexOrient ->> gay]. ?- sys.strat.doIt[]. ?- P[name -> N; longLostSister -> Q[name -> S]]. ?- harry[lover ->> G[name -> N]]. “A terrível novela” em FLORID:regras, estratificações e consultas 1

  9. % Common sense: lover relation is symmetric P:person[lover ->> Q] :- Q:person[lover ->> P]. ?- sys.strat.doIt[]. ?- dick[lover ->> G[name -> N]]. % 9. Jane blackmails every drug addicted lover of Dick jane[blackmails -> P] :- P:person[addictions ->> drugs], dick[lover ->> P]. ?- sys.strat.doIt[]. ?- jane[blackmails -> P[name -> N]]. ?- sys.strat.doIt[]. ?- S:tvShow[]. % 1. A soap opera is a TV show whose characters include % a husband, a wife and a mailman: S:soapOpera :- S:tvShow [mailman -> M:soapChar[sex -> male]; wife -> W:soapChar[sex -> female; % 2. the wife blackmails the mailman blackmails -> M; % 5a. the wife is always an alcoholic... addictions ->> alcohol]; % 5b. long-lost sister of her husband husband -> H:soapChar[longLostSister -> W; sex -> male; % 6a. the husband is always called Dick ... name -> "dick"; % 6b. and the lover of the mailman lover ->> M]]. “A terrível novela” em FLORID:regras, estratificações e consultas 2

  10. sys.strat.doIt[]. ?- S:tvShow[mailman -> M; wife -> W; husband -> H]. ?- S:soapOpera. S[cast ->> M] :- S:soapOpera[mailman -> M]. S[cast ->> W] :- S:soapOpera[wife -> W]. S[cast ->> H] :- S:soapOpera[husband -> H]. ?- sys.strat.doIt[]. ?- S:soapOpera[cast ->> C]. % 10. soap operas are invariably terrible S[rating -> terrible] :- S:soapOpera. ?- sys.prn.style@("instance"). ?- sys.prn.mode@("best"). ?- sys.strat.doIt[]. ?- S:tvShow[rating -> terrible]. % Final queries % 0. Who are the characters of a terrible TV show? ?- S:tvShow[rating -> terrible; cast ->> C]. ?- S:tvShow[rating -> terrible; cast ->> C; husband -> H; wife -> W; mailman -> N]. A terrível novela” em FLORID:regras, estratificações e consultas 3

More Related