Prosp er: A F ramew o rk fo r Extending Prolog Appl i a ti on s with a W eb Interfa e Leven te Hun y a d i Buda p e st Universi t y of T e hnology and E onomi s Depa rtment of Automati on and Applied Info rmati s Internationa l Conferen e on Log i Programming P o rto, Septemb er 12 , 20 0 7 Leven t e Huny adi Prosp e r : Exten d in g Prolog Appli at io n s with a W eb Interfa e � 1 / 14
Goal s Goal s Prol og: a general-pu rp o se p rogrammi ng languag e Cha ra teri s t i s Motivati n g example but di� ult y w.r.t. user intera ti on T emplate te hnol o g y Problem : no general metho d of w eb ontent generation - Appl i a t i o n lo g i - T emplates with su� ient abstra ti on - Extensi b i l i t y Summa ry ■ ■ Leven t e Huny adi Prosp e r : Exten d in g Prolog Appli at io n s with a W eb Interfa e � 2 / 14
Goal s Goal s Prol og Cha ra teri s t i s Motivati n g example easy w eb integrati on T emplate te hnol o g y - Appl i a t i o n lo g i - T emplates mo re intel l i gent w eb app li ati ons - Extensi b i l i t y Summa ry W e need : de�n ition of user interf a e in a natural w a y p ossibl y with a graphi al edito r + p ossibi l i t y of reusing Prol og o de with li t t l e o r no mo di� ation = integrati on with existi ng system s ■ Leven t e Huny adi Prosp e r : Exten d in g Prolog Appli at io n s with a W eb Interfa e � 3 / 14 ■ ■
Cha ra teristi s of the p rop osed framew o rk Goal s sho rt deve lopment ti m e : hides the omplexit y of w eb Cha ra teri s t i s Motivati n g p roto ols example T emplate ease of use : do es not require o de to b e writt en in an te hnol o g y - Appl i a t i o n lo g i im p erati ve language - T emplates - Extensi b i l i t y maintai nabil i t y : sepa rates p resentation and app li ati on Summa ry logi GUI edito r supp o rt : des rib es p resentation ■ de la ratively in XML �les op en a r hite ture : is extensible in almos t all asp e ts ■ integrati on : �exible, o op e rates with w eb servers ■ ■ Leven t e Huny adi Prosp e r : Exten d in g Prolog Appli at io n s with a W eb Interfa e � 4 / 14 ■ ■
Motivating exampl e Goal s -que e n s p roblem: ho w to pla e N quee n s on an N × N Cha ra teri s t i s Motivati n g b oa rd so that they do not threaten one another example T emplate te hnol o g y Prol og im pl em entati on onsist s of 8 p redi ates - Appl i a t i o n lo g i - T emplates task: reate a w eb interf a e that p resents the soluti ons - Extensi b i l i t y Summa ry with Prosp er this an b e a omplis hed with a server page of 21 li nes (using a b oa rd dra wing extension) N ■ ■ ⇒ Leven t e Huny adi Prosp e r : Exten d in g Prolog Appli at io n s with a W eb Interfa e � 5 / 14
Output fo r motivating exampl e Goal s Cha ra teri s t i s Motivati n g example T emplate te hnol o g y - Appl i a t i o n lo g i - T emplates - Extensi b i l i t y Summa ry Leven t e Huny adi Prosp e r : Exten d in g Prolog Appli at io n s with a W eb Interfa e � 6 / 14
T emp l a te fo r motivating exampl e Goal s <psp:assign var="N" Cha ra teri s t i s Motivati n g expr="{atom_number(http_get(n))}"> example <psp:for-ea h-else> T emplate te hnol o g y <psp:for-ea h fun tion="queens(N)" - Appl i a t i o n lo g i - T emplates iterator="L"> - Extensi b i l i t y <board: hessboard size="{N}" figures="L" /> Summa ry </psp:for-ea h> <psp:else> <p>Sorry but there are no solutions.</p> </psp:else> </psp:for-ea h-else> </psp:assign> Leven t e Huny adi Prosp e r : Exten d in g Prolog Appli at io n s with a W eb Interfa e � 7 / 14
T emp l a te te hnol ogy Goal s de la rative and �ts the Prol og language Cha ra teri s t i s Motivati n g example all o ws deve loping omplex w eb app li ati ons T emplate te hnol o g y extensible - Appl i a t i o n lo g i - T emplates easy to lea rn, resembl es other server-si de te hnologies - Extensi b i l i t y Summa ry ■ ■ ■ ■ Leven t e Huny adi Prosp e r : Exten d in g Prolog Appli at io n s with a W eb Interfa e � 8 / 14
T emp l a te te hnol ogy Goal s T w o majo r onstit uents: Cha ra teri s t i s Motivati n g example app li ati on logi T emplate te hnol o g y p resentation la y er - Appl i a t i o n lo g i - T emplates - Extensi b i l i t y Summa ry ■ ■ Leven t e Huny adi Prosp e r : Exten d in g Prolog Appli at io n s with a W eb Interfa e � 9 / 14
Appl i a ti on logi Goal s Implem ented in regula r Prol og mo dules, no mo di� ation Cha ra teri s t i s Motivati n g need e d . example T emplate te hnol o g y -que e n s: queens.pl mo dule onstit utes the app li ati on - Appl i a t i o n lo g i - T emplates logi . - Extensi b i l i t y Summa ry N Leven t e Huny adi Prosp e r : Exten d in g Prolog Appli at io n s with a W eb Interfa e � 10 / 14
T emp l a tes (server pages) Goal s de�n e p resentation in XML fo rm at : Cha ra teri s t i s Motivati n g sp e ial XML elements with semanti s de�n e d as example T emplate Prol og transfo rm at i on rules te hnol o g y - Appl i a t i o n lo g i - T emplates hav e a standa rd set of elements si m i l a r to other - Extensi b i l i t y Summa ry te hnologies: ond itionals ( psp:if , psp:if-else ) b ran h ing ( psp: hoose ) ■ it er at i on ( psp:for-ea h ) ◆ mo re soluti ons ( psp:for-all ) va riables ( psp:assign , psp:insert ) ■ ◆ ◆ Leven t e Huny adi Prosp e r : Exten d in g Prolog Appli at io n s with a W eb Interfa e � 11 / 14 ◆ ◆ ◆
T emp l a tes (server pages) Goal s hav e si ngl e-ass i gned va riables to sto re interm edi at e Cha ra teri s t i s Motivati n g values example T emplate feature a t yp ed exp ression language (an extension to te hnol o g y - Appl i a t i o n lo g i is /2) with sp e ial fun tions to a ess HTTP ontext - T emplates - Extensi b i l i t y a ess app li ati on logi p redi ates dire tl y Summa ry ■ ■ ■ Leven t e Huny adi Prosp e r : Exten d in g Prolog Appli at io n s with a W eb Interfa e � 12 / 14
Extensibi l i t y Goal s Prosp er = Prol og Server P ages Extensible Ar hite t ure Cha ra teri s t i s Motivati n g example Standa rd set of elements is extensible with user-de�n e d T emplate te hnol o g y elements : - Appl i a t i o n lo g i - T emplates - Extensi b i l i t y elements referen ed in XML in the fo rm Summa ry < namespa e > : < n a me > namespa es b oun d to Prol og element im pl em ento r mo dule in on�g u ration �le semanti s : <name> (V a riableT yp es, A ttr i butes, Content, T erms ) ho ok p redi ate fo r synta ti validati on ■ <name> (. . . , V a riables , T erms , Elem ents ) ho ok p redi ate fo r evaluation and ontent generation ■ Leven t e Huny adi Prosp e r : Exten d in g Prolog Appli at io n s with a W eb Interfa e � 13 / 14 ■ ◆ ◆
Summa ry Goal s Prosp er is a framew o rk that Cha ra teri s t i s Motivati n g example fa il i t at es deve loping w eb app li ati ons in Prol og T emplate te hnol o g y re-using existi ng Prol og o de - Appl i a t i o n lo g i - T emplates sepa rates app li ati on logi and p resentation - Extensi b i l i t y Summa ry is e� ient and �exible has an op en a r hite ture is easy to lea rn ■ Referen e im pl em entati on: http://p rosp ea r.sour efo rge.n e t/ ■ ■ ■ Leven t e Huny adi Prosp e r : Exten d in g Prolog Appli at io n s with a W eb Interfa e � 14 / 14 ■
Recommend
More recommend