Namespace funnyqt.visualization

Model visualization functions.

Other Namespaces

Bidirectional transformations (BX).
Co-Evolution transformations on TGraphs.
Printing/persisting and reading/loading query results and transformation traces as EDN.
Core functions for accessing and manipulating EMF models.
Specify models extensionally.
Generic protocols extended upon many different types, and generic functions.
In-place transformation stuff.
Rule-base out-place transformations similar to ATL or QVTo.
Graph Pattern Matching on arbitrary models.
Polymorphic functions dispatching on types of model elements.
Generic query functions like regular path expressions & quantified expressions.
EMF-specific query functions
TG-specific query functions
Relational Model Querying.
Core functions for accessing and manipulating TGraphs.
Generic utility functions, e.g., for signaling errors, debugging, and profiling,
Convert XML to DOM-like TGraphs.
Index Page
Alphabetic Var Index

Public Vars

Usage Documentation

Model visualization functions.

Using the function `print-model`, TGraph and EMF models can be visualized,
either in a window or by printing them to PDF/PNG/JPG/SVG documents.
Back to top

Details of Public Vars

Var: dot-model-fns

  A map from model representation class to function creating a DOT string with
  all elements of this model.  The function accepts the model as its only
  argument.  It should produce a DOT string of the form:

    el1 [<dot-attributes>];
    elN [<dot-attributes>];
    el1 -> el2 [<dot-attributes>];
    elI -> elJ [<dot-attributes>];

  That is, it should contain all edges and vertices to be visualized.
  The DOT syntax is described at

  The surrounding

    digraph SomeName { <dot-attributes>; ... }

  is added automatically.

  By default, there is an entry for an EMF Resource, an EMF ResourceSet and one
  for a JGraLab Graph.
Back to top View Source

Function: print-model


  (print-model m f & opts)


  Prints a visualization of model `m` (a TGraph or EMF Resource or ResourceSet)
  to the file `f`.
  The file type is determined by its extension (dot, xdot, ps, svg, svgz, png,
  gif, pdf).

  `f` may also be the keyword :gtk.  In that case, no file is actually printed,
  but instead a GTK+ window showing the model is created.  `f` may also be the
  keyword :image, in which nothing is shown or printed, but the visualization
  is returned as a java.awt.Image.

  Additional `opts` may be specified.  Those are usually DOT Graph
  Attributes (, e.g.,

    (print-model m "test.pdf" :ranksep 2.2)

  Additionally, the non-DOT :name option may be used to give a name to the
  model, which affecs the title of the generated PDF for example:

    (print-model m "test.pdf" :ranksep 2.2 :name "MyModel")

  The :name must be a valid DOT ID, e.g., it must not contain whitespaces.

  An :include and an :exclude option may be given, both being seqs of model
  elements to include/exclude from printing.  If :include is nil, everything is
  included.  :exclude overrides :include.  A note for TGraphs: :include
  and :exclude usually specify only vertices.  Edges are printed if their alpha
  and omega vertex are printed.  To forbid printing of certain edges where
  alpha/omega are printed, it is possible to add them to :exclude, though.

  The option :exclude-attributes is a map of the form {pred [:attr1 :attr2]}
  determining that these two attributes should not be printed for elements for
  which pred holds.

  A :mark option is supported, too.  It is a seq of elements that should be
  highlighted (printed in red color instead of black).  It may also be a
  predicate that gets an element and returns true/false.

  A :node-attrs option may be specified.  It is a map of the form {pred
  node-attrs} where pred is a predicate applied to each element in the model.
  If (pred el) returns true, this element gets the string node-attrs appended
  to its definition.  You can use that for example to colorize the output,
  e.g., :node-attrs {#(g/has-type? % 'Person) "fillcolor=\"green\""} will
  print all Person elements with a green background.  All predicates are
  tested, and all node-attrs of all succeeding preds are appended.  Note that
  using :mark and :node-attrs where the latter sets the dot color attribute may
  interfer in case a marked node is also matched my the
  corresponding :node-attrs predicate.  In this case, the latter takes

  Similar to :node-attrs, there's the :edge-attrs option.  It has the same form
  and meaning as the former, except that the predicates are applied to
  edges.  (And therefore, this option is only available with JGraLab TGraphs.)

  If the option :qualified-names is set to true, the element types will be
  printed as fully qualified names.  If it is set to :unique, the unique names
  will be printed.  The default is false where only simple class names are

  If the option :omit-unset-attibutes is set to true, attributes that aren't
  set to some value are not printed.
Back to top View Source