Presentation is loading. Please wait.

Presentation is loading. Please wait.

XJ: an introduction Miguel Calejo Declarativa. 2 XJ (XSB+Java) history XSB Inc. uses Prolog with large DBs for.

Similar presentations


Presentation on theme: "XJ: an introduction Miguel Calejo Declarativa. 2 XJ (XSB+Java) history XSB Inc. uses Prolog with large DBs for."— Presentation transcript:

1 XJ: an introduction Miguel Calejo Declarativa

2 2 XJ (XSB+Java) history XSB Inc. uses Prolog with large DBs for high-end data consolidation&cleaning, knowledge extraction, etc., to support e-Procurement and other processes From 1999 to 2002 Declarativa developed XJ, an InterProlog-based infrastructure for Java GUIs wrapping Prolog applications –XJ 1.0 ( ) –XJ 2.0 ( ): more pragmatic, easier to customize –Additional components (2003-today) by XSB, Inc. –March 2006: open source release Most desktop tools referred in have a XJ GUI

3 3 XJ - declarative GUI construction Why the need for XJ? –LOTS of different Prolog data to display and edit! –Heterogeneous, “kind of” relational but non normalized Vision –GUI “deduced” from logic program + annotations, complemented with specific Java classes –Automatically supports data updating & visualization, operation invocation, error handling, undo –Ride on Swing (JFC) and InterProlog Application development with XJ –Prolog program is developed, ignoring GUI issues –GUI Term declarations added –Additional Java classes may be added for specifics

4 4 XJ rationale Generic principles –Prolog term structure conditions GUI structure and layout –Prolog atomic data typically maps into simple GUI elements such as a Swing JTextField –A Prolog free variable is assumed to be an empty or “null” value –Sets of Prolog tuples may be displayed as more complex GUI elements, such as a Swing JTable or JTree Specifics –Each term node can have a property list –The (InterProlog) TermModel class represents terms; its (XJ) subclass GUITerm represents annotated terms

5 5 XJ example: term annotations alloy_shape( 'STEEL'( alloy('852') ), 'MOLD CASTING’ ). labels(alloy_shape/2,'Alloy shape'('Alloy','Shape')). guiTerm(alloy_shape(_M,_S), gt(_,[],[gt(_,[operation(XXX,sisa('OBJECT',XXX),'Show in Ontology'), biGuiLink(X1,sub(X1,_),isa(X1,'METAL')) ], [gt(alloy,[constant], [gt(_,[atomUPPER,minSize=3,maxSize=10,typicalSize=8,name='Name'],[]) ]) ]), gt(_,[atomUPPER,typicalSize=15, biGuiLink(X2,sub(X2,_),isa(X2,'CASTING'))],[]) ])).

6 6 XJ 1.0 example: derived GUI editList(alloy_shape(_,_)). Double-click Inplace editing w/ basic type checking For term For list Navigation to other windows

7 7 XJ another example editList(spec_attr(S,_,_), (name(S,Chars),append("AMS 40",_,Chars)), _).

8 8 XJ2.0: pushing the Swing envelope... Data can be (lazily) fetched from Prolog as needed

9 9...in Prolog style (sort of) guiTermSet(conceptTree/6,null,'Under a class',Context, gt( 'XJ$LAZY', [ caption='Concept hierarchy', operation(terms(_GUIref,SelectedList),writeln(newSelection-SelectedList),selectionChanged), root, lazytree( [ gt(_,[typename=complexid,typicalSize=1,class='com.xsb.xj.ValueRow',tip='M if multiple parents',readonly, root,operation(term(R,P),writeln(R+P),menu('one test'))],[ gt(_,[borderless,class='com.xsb.xj.XJLabel',color=blue,atom,tip='Concept',operation(term(R,P),writeln(R+P),menu('another'))],[]), % concept names assumed atomic gt(_,[invisible,borderless,opaque,tip='Complex Concept ID'],_), gt(_,[integer,tip='Dummy percentage',class='com.xsb.xj.XJSlider'],[]), gt(_,[caption='check here',class='com.xsb.xj.XJCheckBox',myGUI(Checker),operation(term(R,P),writeln(checked- R+P),gui(Checker))],[]), gt(':- )',[nonpersistent,class='com.xsb.xj.XJButton',color=magenta,icon='http://www.declarativa.com/logo/minilogo.gif'],[]) ]), gt(_,[typename=simpleid,root,typicalSize=1,tip='M if multiple parents',readonly,class='com.xsb.xj.ValueRow'],[ gt(_,[atom,class='com.xsb.xj.XJLabel',color=red,tip='Concept'],[]), gt(_,[integer,typicalSize=5,tip='Simple Concept ID'],[]), gt(_,[integer,tip='Dummy percentage',class='com.xsb.xj.XJSlider',myGUI(Slider), operation(term(R,P),writeln(R+P),gui(Slider))],[]), gt(_,[caption='check here',class='com.xsb.xj.XJCheckBox'],[]) ]) ] ) ], lazy(scGconceptTree(_,_,Context),nGconceptTree(_,_,_,Context),Context) ) ).

10 10 XJ concepts GUITerm class, GT terms –Property lists –Building Java visual hierarchies –Containers Your own components: XJComponent About lists and trees Operations and functions

11 11 An XJ example Showing and editing data about one tuple Showing and editing data about several tuples

12 12 Conclusion Integrated documentation missing ...but full source downloadable from –Currently uses slight variation of InterProlog 2.1.2; hopefully this will get cleaned up soon


Download ppt "XJ: an introduction Miguel Calejo Declarativa. 2 XJ (XSB+Java) history XSB Inc. uses Prolog with large DBs for."

Similar presentations


Ads by Google