Schemaball is an SQL database schema viewer. It requires Perl and a few modules, such as GD and optionally Math::Bezier and SQL::Translator. Schemaball creates flexible visualizations of database schemas. Schemas may be read from an SQL schema dump, flat file or live database.

schemaball

home about screenshots requirements

documentation

tour tutorials README CHANGES man page

download

Perl code

Tutorials

These tutorials illustrate different features of Schemaball. Tutorials are divided into sections. Each section covers a particular aspect of a feature or set of features. Each section has its own documentation, configuration file and schema ball image.

tutorial 3.0.description

all tutorials | description | Sections 1 2 3 4 5 6 7 8 9

NAME

sbtut_03 - adjusting colour and visiblity

SYNOPSIS

  <image>
  background = c2cdef
  foreground = 61,95,197
  <image>

  <link>
  color  = 3d5fc5
  </link>
  <table>
  fill    = 255,219,150
  outline = 3d5fc5
  </table>

  <table>
  <hide_rx>
  misc
  gene
  feature
  .{15,}
  <hide_rx>
  <table>

  <table>
  invisible_hide = yes
  </table>

  <link>
  link_to_invisible = yes
  </link>

  <link>
  show_links = no
  </link>

  <link>
  <hide_rx>
  ^seq_region__
  __analysis$
  ^object_xref__go_xref$
  </hide_rx>
  <link>

  <link>
  <hide_rx>
  !_(seq_region|analysis)
  </hide_rx>
  <link>

PURPOSE

In this tutorial, we'll look at some of the parameters which are used to adjust the way the diagram is drawn. Specifically, we'll focus on colour and visibility.

TUTORIAL

Table glyphs are circles whose outline colour, outline thickness and fill colour can be adjusted. The constraint lines, regardless whether they are lines or bezier curves, may have their colour and width adjusted.

Adjusting Element Colour

Let's adjust the background and foreground of the image. The foreground colour will be used for the colour of all labels and text.

  <image>
  ...
  background = c2cdef
  foreground = 61,95,197
  ...
  <image>

Colours may be defined using HEX or RGB notation. Do not include # in the hex definition.

Let's also adjust the link and table colours.

  <link>
  ...
  color  = 3d5fc5
  ...
  </link>

  <table>
  ...
  fill    = 255,219,150
  outline = 3d5fc5
  ...
  </table>

The diagram with the adjusted colours is sbtut_03_01.png.

Adjusting Table Visibility

The visibility of tables and links can be adjusted using regular expressions. Adjusting visibility is a good way to isolate elements of the schema. Let's first look at how tables may be hidden or removed from the schema altogether.

We'll get rid of all tables with the string ``misc'', ``gene'' and ``feature'' in them, as well as any table whose name is longer than 15 characters.

  <table>
  ...
  <hide_rx>
  misc
  gene
  feature
  .{15,}
  <hide_rx>
  ...
  <table>

The diagram with adjusted colours and hidden tables is sbtut_03_02.png

You'll notice that all the hidden tables have been removed from the schema and the remaining tables have been uniformly redistributed around the circle. Hidden tables may be made invisible by using

  <table>
  ...
  invisible_hide = yes
  ...
  </table>

This has the effect of keeping the hidden tables in the schema diagram, but makes them invisible. The resulting effect is that a gap is created along the circle where the table glyph would have been. The diagram with adjusted colours and invisible tables is sbtut_03_03.png

Normally, links are not drawn to invisible tables. To force links to be drawn to such tables use

  <link>
  ...
  link_to_invisible = yes
  ...
  </link>

The diagram with adjusted colours and invisible but linked tables is sbtut_03_04.png

Adjusting Constraint Visibility

To turn off all links, toggle the 'show_links' parameter.

  <link>
  ...
  show_links = no
  ...
  </link>

This is not as exciting as selectively toggling link visiblity. Constraints are made invisible in a manner similar to hiding tables. Regular expressions are defined in a <hide_rx> subblock and applied to the string table1__table2. Let's hide the following constraints: all constraints from seq_region, all constraints to analysis and the constraint between object_xref and go_xref.

  <link>
  ...
  <hide_rx>
  ^seq_region__
  __analysis$
  ^object_xref__go_xref$
  </hide_rx>
  ...
  <link>

It's not always necessary to include the anchors ^ and $ in the regular expressions, but here they're left in for clarity.

The diagram with adjusted colours, invisible tables and hidden constraints is sbtut_03_05.png. Some constraint lines at the seq_region table remain because we have hidden all constraints in which the seq_region table is the referer, but not when it is the referent.

To delete all constraints except those for some tables, a regular expression with a leading ``!'' flag should be used. This flag negates the result of the regular expression check. This flag implements the equivalent of a ``hide all except'' mechanism. Thus, any constraint which *does not* match the regular expression (seq_region|analysis) will be hidden.

  <link>
  ...
  <hide_rx>
  !_(seq_region|analysis)
  </hide_rx>
  ...
  <link>

The diagram links only to/from seq_region and analysis tables is sbtut_03_06.png

Creating Multiple Layers

Continuing on the last example, what if you wanted the constraints that connected to the seq_region table to be a different colour than those that connected to the analysis table? You can create multiple schema diagrams and compose them with your favourite image editing program.

In the first image, show only the seq_region links (sbtut_03_07.png). In the second image, hide all the tables, and show only analysis links, while toggling 'link_to_invisible' (sbtut_03_08.png). A composite image created from these two layers is sbtut_03_09.png.

A more flexible way to accomplish this effect is to highlight link elements. This is covered in the next tutorial.

HISTORY

BUGS

Please report errors and suggestions to martink@bcgsc.ca

AUTHOR

Martin Krzywinski, mkweb.bcgsc.ca, martink@bcgsc.ca

$Id: schemaball,v 1.5 2003/10/27 20:25:11 martink Exp $

CONTACT

  Martin Krzywinski
  Genome Sciences Centre
  Vancouver BC Canada
  mkweb.bcgsc.ca
  www.bcgsc.ca
  martink@bcgsc.ca