Kara: A System for Visualising and Visual Editing of Interpretations for Answer-Set Programs
In answer-set programming (ASP), the solutions of a problem are encoded in dedicated models, called answer sets, of a logical theory. These answer sets are computed from the program that represents the theory by means of an ASP solver and returned to the user as sets of ground first-order literals. As this type of representation is often cumbersome for the user to interpret, tools like ASPVIZ and IDPDraw were developed that allow for visualising answer sets. The tool Kara, introduced in this paper, follows these approaches, using ASP itself as a language for defining visualisations of interpretations. Unlike existing tools that position graphic primitives according to static coordinates only, Kara allows for more high-level specifications, supporting graph structures, grids, and relative positioning of graphical elements. Moreover, generalising the functionality of previous tools, Kara provides modifiable visualisations such that interpretations can be manipulated by graphically editing their visualisations. This is realised by resorting to abductive reasoning techniques. Kara is part of SeaLion, a forthcoming integrated development environment (IDE) for ASP.
💡 Research Summary
The paper presents Kara, a novel system that bridges the gap between the textual nature of answer‑set programming (ASP) solutions and the need for human‑readable, manipulable representations. Traditional ASP solvers output answer sets as collections of ground literals, which become difficult to interpret for large or complex solutions. Existing visualization tools such as ASPVIZ and IDPDraw alleviate this problem by allowing users to define static visualizations, but they are limited to absolute coordinates and a small set of graphical primitives, and they do not support editing of the visual representation.
Kara extends these ideas in three major ways. First, it uses ASP itself as the language for specifying visualizations. A “visualization program” V is an ASP program that contains a fixed set of reserved predicates (e.g., visrect, visellipse, visline, visposition) together with user‑defined auxiliary predicates. When V is combined with a concrete interpretation I (the answer set to be visualized), the union V ∪ I yields a new answer set Iᵥ that contains only the reserved predicates. These predicates describe the graphical objects, their positions, sizes, colors, and other attributes. Because V can contain rules that compute positions relative to other objects, use function symbols to generate identifiers on the fly, and employ layout directives for grids or graphs, Kara supports high‑level specifications such as automatic graph layout, relative positioning, and grid‑based arrangements—capabilities that static‑coordinate tools lack.
Second, Kara provides a generic visualization mode that does not require a user‑written V. In this mode, any interpretation is rendered as a labelled hypergraph: individuals become nodes, literals become hyper‑edges, and predicate names are shown as edge labels with distinct colors. This ensures that even without a custom visual specification, users obtain an immediate visual overview of the structure of the answer set.
Third, and most innovatively, Kara allows the visual representation to be edited and the changes to be reflected back into a new ASP interpretation. The visual editor is built on Eclipse’s Graphical Editing Framework (GEF). When a user moves, resizes, adds, or deletes graphical elements, the underlying visual answer set I₀ᵥ is updated accordingly. To recover a corresponding domain interpretation I₀, Kara constructs an abductive reasoning program λ(I₀ᵥ, V). This program contains:
- a set of abducible predicates Pₐ derived from V (typically non‑visual predicates that appear only in rule bodies);
- a domain Dₐ for the arguments of those predicates, extracted from both I₀ᵥ and the rules of V, while filtering out auxiliary symbols;
- integrity constraints over a selected subset of visual predicates Pᵢ (e.g., color, label, connectivity) that must match between the edited visual answer set and the answer set produced by V ∪ I₀.
Solving λ yields an answer set whose projection onto the abducible predicates gives I₀, the modified interpretation that exactly explains the edited visualization. This abductive loop enables visual debugging (the user can manually construct the intended answer set by drawing it) and testing of post‑processing components (mock answer sets can be generated graphically).
Kara is implemented as a plugin for SeaLion, an Eclipse‑based IDE for ASP development. Within SeaLion, users can write ASP programs, launch solvers, author visualization programs, view the resulting graphics, edit them interactively, and export the final visualizations as SVG files for external use. The paper provides a comprehensive list of reserved visualization predicates (Appendix A) and formal definitions of the transformation from (I, V) to λ(I₀ᵥ, V).
The authors illustrate the system with several examples: a bookshelf scenario where books and globes are placed on shelves, a graph layout example, and a grid‑based puzzle. In each case, the visual representation is concise and intuitive, and the editing process demonstrates how a small graphical change (e.g., moving a book) leads to a new, logically consistent answer set.
Compared to ASPVIZ and IDPDraw, Kara offers richer specification capabilities, supports relative and automatic layout, provides a generic hypergraph fallback, and crucially adds a bidirectional editing mechanism based on abductive reasoning. The paper concludes by highlighting the potential of visual‑centric workflows for ASP and outlines future work such as scaling to larger answer sets, integrating more sophisticated layout algorithms, and extending the set of integrity predicates for finer‑grained control.
Comments & Academic Discussion
Loading comments...
Leave a Comment