presentation - InterProlog Consulting

Download Report

Transcript presentation - InterProlog Consulting

Prolog Studio Overview
By Miguel Calejo
InterProlog Consulting
http://interprolog.com
Copyright InterProlog Consulting 2014
1
Preamble
• Open source core spun off during previous projects
• Integrates best of breed open source
–
–
–
–
–
XSB Prolog
InterProlog Java bridge, including cloud capability
XJ declarative Swing UI
Smart Prolog text editor
Graph and other Java frameworks
Copyright InterProlog Consulting 2014
2
Components
•
•
•
•
•
•
•
•
Console (Prolog) listener
Syntax Editor for Prolog
Code browsers
Query Window
User graphs
Other XJ and InterProlog visualizers
Full dynamic access to Java, XSB
1.0beta1 released Oct 24, 1.0 due Xmas 2014.
Copyright InterProlog 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
• InterProlog 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 InterProlog 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 InterProlog Consulting 2014
5
Graph visualization
Copyright InterProlog Consulting 2014
6
Example (model)
%
integers_edge(NodeID1,NodeID2,EdgeID,EdgeType,EdgeTerm,EdgeTip,
…)
integers_edge(N1,N2,N1-N2,succ,null,N1-N2,Size) :succUntil(Size,N1,N2).
% node_relation(+NodeID,-Type,-Term,-Tip)
roman_polymorphic_node(ID,Type,Term,Tip) :polymorphic_node(ID,Type,_,Tip),
intToRoman(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 InterProlog Consulting 2014
7
Example (presentation)
graph3 :- Size = 100,
InitialNodeCount is Size div 2, findInitialNodes(InitialNodeCount,Size,InitialNodes),
xjGenericGraph(
InitialNodes, integers_edge(_,_,_,_,_,_,Size), roman_polymorphic_node(_,_,_,_),
% Global graph properties:
[labelsInNodes, cubicCurve, maxItems=Size, myGUI(GraphUI),
operation(term(_,_),(
javaMessage(GraphUI,Array,getSelectedNodeIDs),
recoverTermModelArray(Array,IDs), writeln(iDs-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=N1-N2, buildTermModelArray([N1,N2],Array),
javaMessage(GraphUI,collapseNodes(Array))
), menu('Collapse my endpoints'))]],
GraphUI),
javaMessage(GraphUI,expandAll).
Copyright InterProlog Consulting 2014
8
XJ graph recap
• Graph edges (and node IDs) are defined by a Prolog/Flora
relation with 6 or more args:
– myEdge(NodeID1,NodeID2,EdgeID,Type,Term,Tip,…)
• Nodes are fully defined by another Prolog relation:
– myNode(NodeID, 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
– browseGraphRelation(TwoArgPredicate), ...,
browseGraphFloraRelation(FloraGoalAtom,InitialNodes,GUI),…
xjGenericGraph/7, xjCreateComponent/2.
– Initial set of nodes, then its edges are expanded until “fixpoint”
Copyright InterProlog Consulting 2014
9
A bit more about XJ
• Powers a few Java apps in use
• Tables, trees, forms, …
Copyright InterProlog Consulting 2014
10
Pushing the Swing envelope...
Data can be
(lazily) fetched
from Prolog as
needed
Copyright InterProlog Consulting 2014
11
Conclusion
• InterProlog Consulting
– Provides contract development services
– Will cooperate with academia to extend “logic for your app”
open source
• Open source ingredients for projects
– InterProlog Java bridge
– IDE for Prolog, extensible
Watch quick tour and download now at
http://interprolog.com
Copyright InterProlog Consulting 2014
12