Cogui Tutorial Exercises - Rules
2 pages
English

Cogui Tutorial Exercises - Rules

-

Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres
2 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

Cogui Tutorial : Rules  The vocabulary can be seen as a lightweight ontology. More expressivity is obtained by adding rules of form "if hypothesis then conclusion". Rules can be used to enrich facts. The mechanism that processes rules in this way is called forward‐chaining.    1. Open the file family‐before‐rule‐tutorial.cogxml. Look at the rules in the set Rules / family‐relationships.  These rules represent the following knowledge about the family domain: • R1 and R2: parentOf and childOf are inverse relations • R3: ancestorOf is transitive • R4: siblingOf is symmetrical • R5: definition of motherOf (with one direction being already encoded in the vocabulary) • R6 et R7: definition of siblingOf • R8: definition of brotherOf (with one direction being already encoded in the vocabulary) 2. Exercise:  Add the uncleOf relation in the relation hierarchy with the appropriate signature. Then add two new rules that define uncleOf as follows: "x is an uncle of y if and only if there is z such that x is the brother of z and z is one of the parents of y" Hints: • Each rule corresponds to one direction of the "if and only if" statement, similarly to what we have done for the siblingOf relation. • Draw one rule, and then copy/paste it to draw the second rule.  3. Open the forward chaining assistant (by the menu Reasoning ...

Informations

Publié par
Nombre de lectures 26
Langue English

Extrait

Cogui Tutorial :Rules
Thevocabularycanbeseenasalightweightontology.Moreexpressivityisobtainedbyaddingrulesofform"ifhypothesisthenconclusion".Rulescanbeusedtoenrichfacts.Themechanismthatprocessesrulesinthiswayiscalledforwardchaining.1. Openthefilefamilybeforeruletutorial.cogxml.LookattherulesinthesetRules/familyrelationships.Theserulesrepresentthefollowingknowledgeaboutthefamilydomain:R1andR2:parentOfandchildOfareinverserelationsR3:ancestorOfistransitiveR4:siblingOfissymmetricalR5:definitionofmotherOf(withonedirectionbeingalreadyencodedinthevocabulary)R6etR7:definitionofsiblingOfR8:definitionofbrotherOf(withonedirectionbeingalreadyencodedinthevocabulary)2. Exercise:AddtheuncleOfrelationintherelationhierarchywiththeappropriatesignature.ThenaddtwonewrulesthatdefineuncleOfasfollows:"xisanuncleofyifandonlyifthereiszsuchthatxisthebrotherofzandzisoneoftheparentsofy"Hints:Eachrulecorrespondstoonedirectionofthe"ifandonlyif"statement,similarlytowhatwehavedoneforthesiblingOfrelation.Drawonerule,andthencopy/pasteittodrawthesecondrule.3.Opentheforwardchainingassistant(bythemenuReasoning/Applyrules)anduseittocomputetheancestorOfrelationbetweentheindividualsofthegenealogicalgraphencodedinthefactgenealogyfact.Runtheassistantstepbysteptoseeeachruleapplication.Storethefactobtainedaftersaturationandnameitancestorsfact.Details:SelectthefactgenealogyfactandthesingleruleR3.Clickonthenextbutton:theinitialfactisdrawn.
ICCS2010www.lirmm.fr/graphik
Applytherulestepbystep(withthegreentrianglebutton):theimageoftherulehypothesisinthefactiscoloredingrayandthemodifiedpartofthegraphiscoloredinpink.Moreprecisely,thepinkpartshowsthenewnodesaswellasalreadyexistingnodesaffectedbytheruleapplication,i.e.nodeswhoselabelorneighbourhoodhaschanged.RememberthatCoguiforwardchainingoperatesinabreadthfirstmanner:ateachlevel,itcollectsallpossibleruleapplicationsonthecurrentfact,thenperformthembeforelookingfornewruleapplications.Foreachruleapplication,theassistantindicatesthenameoftheruleappliedandthecurrentforwardchaininglevel.Inthisexample,forwardchainingstopsatlevel2.NotethatCoguidoesnotperformredundantruleapplications:aruleapplicationisnotperformediftheaddedinformationisalreadypresent(assuchorinaspecializedform).Forinstance,therelationancestorOfisnotaddedwhenparentOfisalreadypresent,becauseparentOfancestorOf.Whennonewruleapplicationcanbefound,forwardchainingstops.Youcanalsocomputethesaturatedfactdirectlywiththe"saturategraph"button.Totestit,clickthebackbuttontocomebacktofactandrulesselection,thenclicknextandrunthesaturationprocess.Tostorethesaturatedfact,clickonthe"storeresultinggraph"button:intheResultswindow,alinebeginningwith"modifiedgraph"appears.Draganddropthislineintothefactset.Renamethegraph(rightclickonitsname)withthenameancestorsfact.Arrangethesaturatedfacttomakeitasreadableaspossible.4.QueryancestorsfactwiththequeriesQancestorOfF("findallxsuchthatxisancestorofF")andQancestors("findallxandysuchthatxisancestorofy")5.Exercise:(1)SaturatethegenealogicalgraphgenealogyfactwithallrulesinthesetRules/familyrelationships(stepbystepordirectly)andstoreitwiththenamealldeducedfact.Toarrangethisfact,trytheautomaticarrangement.(2)QuerythisgraphwithaqueryaskingforallnephewsofB(thatisallpersonswhoseBisanuncle).Remark:evenifCoguidoesnotperformredundantruleapplications,alldeducedfactisredundant(youcancheckitwiththe"analyzefacts"assistant).Understandwhy.
6.Whenrulesproducenewunknownindividuals,forwardchainingmaynotstop.Itwasnotthecasewithpreviousrules,evenifsomeofthemintroducenewunknownindividuals(e.g.R7).TheruleRp(statingthat"everyonehasamother")yieldsanexample.RunitonthefactAfact(withasingleconceptnodeA).
Note:whenyouusethe"saturategraph"functionality,youareabletostopitwheneveryouwant.Youcanevenstorethecurrentlycomputedfact.However,becareful:thisgraphcanbeverylarge!
  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents