Travel

A general-purpose logic-based visualization framework

Description
ABSTRACT This paper describes a general-purpose visualization framework for producing images through reasoning processes. The approach is signi cantly di erent from the usual imperative one: indeed, the visualizer retrieves visual information from a
Categories
Published
of 8
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
Share
Transcript
  AGENERAL-PURPOSELOGIC-BASED VISUALIZATIONFRAMEWORK  CamilDemetrescu  y  1  IreneFinocchi  z y  ComputerandSystemsScienceDepartment UniversityofRome\LaSapienza" ViaSalaria113,00198Rome,Italy demetres@dis.uniroma1.it  z  DepartmentofComputingScience UniversityofRome\LaSapienza" ViaSalaria113,00198Rome,Italy nocchi@dsi.uniroma1.it  ABSTRACT  Thispaperdescribesageneral-purposevisualizationframeworkforproducingimagesthrough reasoningprocesses.Theapproachissignicantlydierentfromtheusualimperativeone:indeed, thevisualizerretrievesvisualinformationfromaknowledgebasethatmaydependonanexternal sourceofdata.Thisknowledgebaseiswrittenbytheuserinalogic-basedlanguageandcontains declarationsaboutvisualobjects,theirinterrelationsandtheirgeometricandretinalfeatures. Dierentalgorithmsforqueryingtheknowledgebasearepresented,discussingboththeirtemporal complexityandtheirrobustness.  Keywords:  visualization,logiclanguages.  1INTRODUCTION  Theactionofavisualizerconsistsofbuildingavi- sualrepresentationofsomekindofinformation, usuallybycreatingbitmappedimages.Inthis paperwefocusourattentiononthewayavisu- alizerreceivesvisualinformation,ratherthanon thetechniquesitusesforrenderinganimage. Wepresentanintelligentlogic-basedvisualiza- tionframeworkthatappearstobewellsuitable forsoftwareanddatavisualizationpurposesand forhigh-levelvisualdebuggingofprograms(see Price94a]andCresc97a]). Thegreatexpressivityandexibilityoflogiclan- guagesinspecifyingpropertiesandrelationships betweenobjectsmakethemveryattractivefor ouraims.Ontheotherhand,implementinga  1  AuthorsupportedinpartbyEUESPRITLongTerm ResearchProjectALCOM-ITundercontractno.20244.  logic-basedframeworkrequiresaquitecomplex softwaretechnologythatinsomecasesmayaf- fectvisualization'sperformances. Thepaperisorganizedasfollows.Afterdescrib- ingtheframework(section2),wediscusstheap- plicationoflogiclanguagesforrepresentingvi- sualinformation(section3);thenwepresentba- sicinformationretrievaltechniquesusedbythe visualizer(section4)andnallyweintroducea restrictedgraphicalvocabularyandweshowtwo visualizationexamples(section5).  2THEFRAMEWORK  Avisualizerisusuallythoughtasaserverof graphicalfacilitiesthatacceptscommandsfrom adrivingclientprocessandproducesimageson itsbehalfasshowninFig.1.   Fragment of a possible conversation session:Visualizer: Inference engine:Visualizer: Inference engine:Visualizer: Inference engine:Visualizer: Inference engine:Visualizer: Inference engine:Visualizer: Inference engine:Visualizer: Inference engine:... Which windows must be onto the screen ?Just window W.Which points must be in window W ?None.Which circles must be in window W ?None.Which lines must be in window W ?Line L1 from (10,10) to (50,50) andline L2 from (10,50) to (50,10).What's the color of line L1 ?Blue.What's the color of line L2 ?I don't know.(Then I will use my default color Grey.)Is line L1 in front of line L2 ?No. Knowledge base: There is a window WThere is a line L1There is a line L2Line L1 is contained in window WLine L2 is contained in window WCoordinates of line L1 are (10,10)-(50,50)Coordinates of line L2 are (10,50)-(50,10)All lines standing behind any object are BlueLine L2 is over line L1 L1L2 Figure3:Exampleofaninformalconversationsession  Client of graphic facilitiesServer of graphic facilitiesImageinfo ProcessMemoryVisualizer drawingcalls Figure1:Proceduralvisualizationframework  InferenceengineVisualizer queriesanswers Knowledgebase Visualization requestServer of informationClient of informationImage Figure2:Knowledge-basedvisualization framework Intheframeworkwearegoingtopresent(seeFig. 2)theimagegenerationprocessfollowsadierent approach:thevisualizeristheclientofaninfer- enceenginethatactsasaserverofinformation retrievedfromaknowledgebase.Thisinforma- tionretrievaliscarriedoutthroughatightcon- versationbetweenthevisualizerandtheinference engine:therstoneissuesasequenceofqueries aboutwhattovisualizeandthesecondanswers afterconsultingtheknowledgebase. Thedialoguegoesonaccordingtoaprecisecom- municationscheme,thatwewillrefertoasthe  queryprotocol  ,describingvisualizer'squestions andtheirorder.InFig.3aknowledgebase, apossibleinformalconversationsessionandthe nalimageproducedbythevisualizerareshown. Notetheknowledgebasedoesnotnecessarlypro- videacompletedescriptionofallfeaturesofthe visualworld:inourexample,thecolorofthe frontmostobjectisleftundened.Itisuptothe visualizertoprovidedefaultvaluesforallmissing piecesofinformationbeforegeneratingthenal image. Itisworthobservingthattheimagebuildingis triggeredbyavisualizationrequestcomingfrom anexternalagentthatisresponsibleofmantain- ingthenalimageconsistentwithitsspecica- tioniftheknowledgebaseisevolvingoverthe time.Althoughthisrequirementisnotstrictly necessary,anautomaticupdateofimagesallows apowerfulvisualfeedbackofknowledgebase's temporalevolution. Fromuser'sperspective,somevisualizationcode mustbewritteninboththeknowledge-basedand proceduralframeworks,butintherstonethe programconsistsofasequenceofdrawinginstruc- tions,whileintheseconditisarepositoryofin- formationexpressedinadeclarativeformabout visualobjects,relationsamongthemandtheir attributes. Uptothispoint,avisualizationrequestleadsto thegenerationofasingleimagewhosedescription iscompletelyspeciedbytheknowledgebase. Hence,producingdierentimagesrequireswrit- ingdierentknowledgebases. However,thismodelisnotenoughpowerfulin mostrealsituationswheretheuserisinterested invisualizinginformationstoredinacomputer memory.Apossiblesolutiontothisproblemis toparametrizetheknowledgebasewithrespect toanexternalsourceofinformationsuchasa leoramainmemorysegment.Forthesakeof concreteness,inthefollowingweassumethatthe knowledgebasecandependonactualvaluescon-   External source of information ProcessMemory Parametrization InferenceengineVisualizer queriesServer of informationClient of informationImageanswers Parametrizedknowledgebase Visualization request Figure4:Parametrizedknowledge-based framework tainedinthememoryimageofanunderlyingpro- cess.Thismeansthatchangingevenoneofits locationsmayleadtheinferenceenginetopro- ducedierentanswerstothesamequeriesofthe visualizerallowingittogeneratedierentimages. Fig.4isarenementofFig.2accordingtothis conceptofparametrization.  3KNOWLEDGEREPRESENTATION USINGPREDICATES  Therststepforrepresentingknowledgeconsists ofchoosingasuitableencodinglanguage.One oftheearliersolutionstothisprobleminthe 1970swastowritesentencesaboutobjectsand theirpropertiesthroughpredicatesoftherst- orderlogic,butvariouscriticismsagainstthisap- proachhaveledtothedevelopmentofothermod- els,suchasframesystemsandsemanticnets(see Ginsb92a]fordetails). However,thelogicapproachseemstobeespe- ciallysuitableforourpurposes,strictlyrelatedto thevisualization,sincethedescriptionofgraphi- calobjectsandtheirpropertiescanbenaturally formulatedasaxiomsandinferencerules,lead- ingtoapowerfulandexpressiveframeworkfor describingvisualworlds. Forexample,theknowledgebaseshowninFig.3 maybeeasilyencodedassentencesoftherst- orderlogicasfollows:  window  (  W  )  line  (  L  1)  line  (  L  2)  inwindow  (  L  1  ;W  )  inwindow  (  L  2  ;W  )  linecoordinates  (  L  1  ;  10  ;  10  ;  50  ;  50)  linecoordinates  (  L  2  ;  10  ;  50  ;  50  ;  10)  infrontof  (  L  2  ;L  1)  8  x  8  yline  (  y  )  ^  infrontof  (  x;y  )  !  color  (  y;BLUE  )  Allsentencesinthepreviousknowledgebaseare axiomsbutthelastone,thatisaruleasserting eachline  y  behindagenericobject  x  isblue.Note variables(  x  and  y  )arelowercaseidentierswhile constants(10,50,  W  ,  L  1,  L  2,and  BLUE  )are uppercasealphanumericstrings.  3.1Standardpredicates  Inthelogicapproach,asinglequeryofthevisual- izerconsistsofagoaltheoremthattheinference enginetriestoprovestartingfromthesentences inaknowledgebaseprovidedbytheuserasa specicationofthevisualization. Forexample,ifisaHornbase,theinfer- enceenginemayusearesolutionalgorithm(see Lloyd87a])tocheckoutifagivengoalpredicate (e.g.  line  (  x  ))isentailedby.Inthiscasethe unicationprocessmaybearvariableassignments thatvalidatethepredicatewithrespecttothe givenaxiomaticsystem. Therefore,theinformationthevisualizerreceives isboththetruthvalueofthegoalpredicate(e.g.  true  ifthereisatleastalineinthevisualworld,   false  otherwise)andpossiblyalistofbindsbe- tweenvariablesandvaluesobtainedbyliterals unication(e.g.  which  arethelines). Indeed,ifisthebasegivenabovewiththelast rulerewrittenastheHornclause  color  (  y;BLUE  )  _:  line  (  y  )  _:  infrontof  (  x;y  )  theconversationsessionofFig.3maybedriven bythesequenceofqueriesshowninFig.5. Table'struthvaluesandbindinglistshavebeen computedthroughtheresolutionalgorithmfor eachqueryofthevisualizer. Noteforsomegoalstheinferenceprocedureisrun untilallbindinglistsvalidatingthemhavebeen found,sinceweareofteninterestednotonlyin provingatheorem,butalsoingettingvalues.For thisreason,thequery  line  (  l  )?hastwoanswers,  l  =  L  1and  l  =  L  2,thismeaningthatthereare actuallytwolinesinthevisualworld.Thanksto thisfeature,thevisualizercaneasilygetsetsof objectstobuildupcompleximages. Aswehavepointedoutinsection2,visualizer's queriesfollowaprecisecommunicationprotocol builtinthevisualizationsystem.Accordingto it,goalpredicatesaskedbythevisualizerhave apredenedsignature(nameandlistofargu- ments)thattheusermustagreewithinwriting theknowledgebase. Fromnowonwewillrefertopredicatesmatching   QueryTruthvalueReturnedvalues  window  (  w  )?  truew  =  W false  -  line  (  l  )?  truel  =  L  1  truel  =  L  2  false  -  inwindow  (  L  1  ;W  )?  true  -  inwindow  (  L  2  ;W  )?  true  -  linecoordinates  (  L  1  ;x  1  ;y  1  ;x  2  ;y  2  )?  truex  1  =10  ;y  1  =10  ;x  2  =50  ;y  2  =50  linecoordinates  (  L  2  ;x  1  ;y  1  ;x  2  ;y  2  )?  truex  1  =10  ;y  1  =50  ;x  2  =50  ;y  2  =10  infrontof  (  L  1  ;L  2)?  false  -  color  (  L  1  ;c  )?  truec  =  BLUE color  (  L  2  ;c  )?  false  -  Figure5:QueriesofthevisualizertoaHorndatabaseprocessedthroughtheresolutionalgorithm againstvisualizer'sgoalsas  standardpredicates  . Basically,theybelongtotwomaincategories:    thoseconcerningtheexistenceofvisualob-  jects,called  constructors  ;    thoserelatedtopropertiesofvisualobjects (retinalandgeometricfeaturesandinterre- lations),called  descriptors  . Inourpreviousexample,  window  ,  line  ,  point  , and  circle  areconstructors,while  inwindow  ,  linecoordinates  ,  infrontof  and  color  aredescrip- tors.  3.2Expressingpredicatesin  Alpha  Inthissectionweinformallyintroduce  Alpha  ,a logic-basedprogramminglanguagethatwillserve asabasisforournextexamples. An  Alpha  programisasetofdenitionsof booleanfunctionsthatwewillrefertoas  pred- icates  .Eachonehasasignature(  head  ),dening itsnameanditsformalparameters,andoneor more  bodies  ,specifyinghowitsresultsmustbe computed. Argumentsmaybeeither\byname"(ifprexed bythekeyword  Out  )or\byvalue"andhavein- tegertype. Multiplebodiesforthesamepredicatemaybe introducedeitherthroughthekeyword  Moreover  orbyrepeatingitshead.Eachbodyconsistsofa (possiblyempty)sequenceof  Assign  ,  If  and  For  statementswhoseexecutioniscarriedonaccord- ingtothefollowingcomputationrules:    the  Assign  statementputsvaluesinto parametersand/orlocalvariables(e.g.  AssignX=10  )andletsthecomputation proceedtothenextstatement;    the  For  statementinvokesapredicate,al- lowingittoputvaluesintopassedvariables (e.g.  ForN:myPred(N)  ).Ifthecalled predicatereturns  true  ,thenthecomputa- tionproceedstothenextstatement,else backtrackstotheprevious  For  statement;    the  If  statementchecksforacondition(e.g.  IfX+Y<=Z/2  ).Ifthisoneholdsthenthe computationproceedstothenextstate- ment,elsebacktracksasabove;    ifthereisnonextstatementtoproceedon, thepredicatereturns  true  ;    ifthereisnoprevious  For  statementto backtrackon,anotherbodyofthepredi- cate,ifany,iscomputed.Otherwisethe predicatereturns   false  . Inotherwords,thepredicatecomputationre- turns  true  whenandonlywhenthelaststate- mentofabodyhasbeensuccessfullycompleted. Asubsequentcalltothepredicatefromanexter- nalcallerwillthenproceedfromthatpointon, exploringnewcomputationpossibilities,ifany.It isworthnoticingthatpredicatesareabletore- turndierentvaluesondierentcallsthanksto thepresenceofmorebodiesandtothebacktrack- ingmechanism. InFig.6asimpleexampleoftwo  Alpha  predi- cates,  Enum  and  OddEnum  ,isgiven.Therstone hasthreebodiesandisabletoenumeratevalues 1,2,and3onsubsequentcalls.Thesecondone invokes  Enum  andltersitsresultthroughan  If  statementinordertoproduceonlyoddvalues. Threesuccessivecallsto  OddEnum  aretracedin thesamegure.   OddEnumEnum Third call: For N:Enum(N)If N%2==1   Assign N=1   Assign N=2   Assign N=3 falsefalse    E  x   t  e  r  n  a   l  c  a   l   l  e  r OddEnumEnum Second call: For N:Enum(N)If N%2==1   Assign N=1Assign N=2Assign N=3 truetruetrue    E  x   t  e  r  n  a   l  c  a   l   l  e  r N=3 OddEnumEnum First call: For N:Enum(N)If N%2==1Assign N=1Assign N=2Assign N=3 truetrue    E  x   t  e  r  n  a   l  c  a   l   l  e  r N=1 Definition of  Enum and Oddenum : Enum(Out N)Assign N=1 MoreoverAssign N=2 MoreoverAssign N=3;OddEnum(Out N)For N:Enum(N)If N%2==1; Figure6:Denitionof  OddEnum  and  Enum  andcomputationof  OddEnum  Forsimplicity,fromnowonwewillusetheshort- cuts\  myPred(1)...;  "insteadof\  myPred(N) IfN==1...;  "and\  myPred(Out1)...;  "in- steadof\  myPred(OutN)...AssignN=1;  ". Moreover,wewillprex  Alpha  constantiden- tierswiththesymbol`'. Inthecontextofourknowledge-basedframe- work,aqueryofthevisualizerconsistsnowofan  Alpha  standardpredicatecomputationrequest. Theinferenceengineevaluatesthegoalpredicate accordingtothecomputationrulesgivenabove (thatareaproceduralinterpretationoftheun- derlyingtheoremprovingprocess)andtheresults -truthvalueandpossiblygeneratedvalues-are returnedtothevisualizer.  3.3Parametrizing  Alpha  predicates  Alpha  isexpresslydesignedforsupportingthe parametrizationwithrespecttovariablesofan underlyingprogram.Inparticular,weassumeto dealwithCprogramsthatll-intheirownvari- ableswithinformationtobevisualized. Theparametrizationisrealizedbyallowingrst an  Alpha  programtobeembeddedintoaC sourcecode,andthen  Alpha  statementstosyn- tacticallyrefertoitsvariables,accordingtotheir scopingrules.Agoodchoiceformaking  Alpha  predicatessemantically\invisible"totheunder- lyingprogramistoembedthemasspecialcom- mentsdelimitedby  /**  and  **/  separators. Thefollowingsimpleexampleshowshowthe backgroundcolorofawindowmaydependon thesignofanunderlyingCvariable,provided that  Window  and  WindowColor  are  Alpha  stan- dardpredicates:  inti=0; /** Window(OutW); WindowColor(W,OutC) AssignC=(i  >  0)?BLUE:RED; **/  Window(OutW)  declaresawindowwhosela- belis  W  ,while  WindowColor(W,OutC)  declares itscolor.Noteaftereachassignmenttothe variable  i  madebytheprocess,thevisualizer shouldasktheinferenceenginetore-evaluatethe  WindowColor  standardpredicate,allowingwin- dow'sbackgroundtoberedaslongas  i  <  =0and switchingitscolortoblueassoonas  i  becomes  >  0.  4QUERYPROTOCOLS  Queryprotocolsarethebackboneoftheknowl- edgeretrievalprocess.Theyspecify:(a)theal- gorithmfollowedbythevisualizerforevaluating standardpredicates(the  queryalgorithm  );(b)the signatureofstandardpredicates;(c)themeaning oftheirparameters. Oneofthemainfeaturesofourlogic-basedframe- workisthetotalfreedomindesigningquerypro- tocols.Itisnotsurprisingthatthevisualizercan receivethesameinformationinmanydierent ways.Indeed,supportingvarioustypesofbuilt- inquerystrategiesmayturnouttobeextremely expressive. Inthefollowingwepresentfourdierentbasic queryprotocolsthatmaybecombinedtogether inordertodesignmorecomplexones.Inpar- ticular,wefocusourattentioninusing  Alpha  predicatestoproducegenericsetsofvalues,that 
Search
Tags
Related Search
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks