Prolog Studio Overview By Miguel Calejo Inter Prolog
Prolog Studio Overview By Miguel Calejo Inter. Prolog Consulting http: //interprolog. com Copyright Inter. Prolog Consulting 2014 1
Preamble • Open source core spun off during previous projects • Integrates best of breed open source – – – XSB Prolog Inter. Prolog Java bridge, including cloud capability XJ declarative Swing UI Smart Prolog text editor Graph and other Java frameworks Copyright Inter. Prolog Consulting 2014 2
Components • • Console (Prolog) listener Syntax Editor for Prolog Code browsers Query Window User graphs Other XJ and Inter. Prolog visualizers Full dynamic access to Java, XSB 1. 0 beta 1 released Oct 24, 1. 0 due Xmas 2014. Copyright Inter. Prolog Consulting 2014 3
Studio architecture • Light, scalable – single jar file for JDK 1. 6+, let data stay in XSB • Java-centric, Prolog-centric – Java app with XSB subprocesses – symmetric Java/Prolog callbacks • Inter. Prolog bridge (improved): – Control, performance improvements • XJ (open source from XSB Inc. ) – any Swing visual hierarchy – Declarative JTrees, JTables, Graphs – Supports RAD for custom projects • Amenable to support for SWI, YAP, Ciao Prolog, … Copyright Inter. Prolog Consulting 2014 4
Prolog editor • Lexical coloring • Call graph features – Ctrl-click: Navigate to predicate definition – Popup menu for: Call Tree, Callers • Variable highlighting, completion • Based on open source Java text framework (RSTA) • Extensible Copyright Inter. Prolog Consulting 2014 5
Graph visualization Copyright Inter. Prolog Consulting 2014 6
Example (model) % integers_edge(Node. ID 1, Node. ID 2, Edge. ID, Edge. Type, Edge. Term, Edge. Tip, …) integers_edge(N 1, N 2, N 1 -N 2, succ, null, N 1 -N 2, Size) : succ. Until(Size, N 1, N 2). % node_relation(+Node. ID, -Type, -Term, -Tip) roman_polymorphic_node(ID, Type, Term, Tip) : polymorphic_node(ID, Type, _, Tip), int. To. Roman(ID, Term). polymorphic_node(ID, even_number, ID, 'I''m even!') : 0 is ID mod 2, !. polymorphic_node(ID, odd_number, ID, 'I feel odd'). Copyright Inter. Prolog Consulting 2014 7
Example (presentation) graph 3 : - Size = 100, Initial. Node. Count is Size div 2, find. Initial. Nodes(Initial. Node. Count, Size, Initial. Nodes), xj. Generic. Graph( Initial. Nodes, integers_edge(_, _, _, Size), roman_polymorphic_node(_, _, _, _), % Global graph properties: [labels. In. Nodes, cubic. Curve, max. Items=Size, my. GUI(Graph. UI), operation(term(_, _), ( java. Message(Graph. UI, Array, get. Selected. Node. IDs), recover. Term. Model. Array(Array, IDs), writeln(i. Ds-IDs) ), menu('Print list of selected numbers')) ], % Node types: [even_number=[color=green], odd_number=[color=pink]], % Edge types: [succ=[color=blue, dotted, operation(term(ID, _), ( ID=N 1 -N 2, build. Term. Model. Array([N 1, N 2], Array), java. Message(Graph. UI, collapse. Nodes(Array)) ), menu('Collapse my endpoints'))]], Graph. UI), java. Message(Graph. UI, expand. All). Copyright Inter. Prolog Consulting 2014 8
XJ graph recap • Graph edges (and node IDs) are defined by a Prolog/Flora relation with 6 or more args: – my. Edge(Node. ID 1, Node. ID 2, Edge. ID, Type, Term, Tip, …) • Nodes are fully defined by another Prolog relation: – my. Node(Node. ID, Type, Term, Tip) • Types have XJ property lists defining aspect and operations – Color=red, dotted, … – operation(term(ID, _), mygoal(ID), menu(‘My command’)) • A XJGraph can be used anywhere in a XJ or Swing hierarchy • Several entrypoints – browse. Graph. Relation(Two. Arg. Predicate), . . . , browse. Graph. Flora. Relation(Flora. Goal. Atom, Initial. Nodes, GUI), … xj. Generic. Graph/7, xj. Create. Component/2. – Initial set of nodes, then its edges are expanded until “fixpoint” Copyright Inter. Prolog Consulting 2014 9
A bit more about XJ • Powers a few Java apps in use • Tables, trees, forms, … Copyright Inter. Prolog Consulting 2014 10
Pushing the Swing envelope. . . Data can be (lazily) fetched from Prolog as needed Copyright Inter. Prolog Consulting 2014 11
Conclusion • Inter. Prolog Consulting – Provides contract development services – Will cooperate with academia to extend “logic for your app” open source • Open source ingredients for projects – Inter. Prolog Java bridge – IDE for Prolog, extensible Watch quick tour and download now at http: //interprolog. com Copyright Inter. Prolog Consulting 2014 12
- Slides: 12