ModelRight Home
<% currentPage="resources" %>
<% currentItem="scripting" %>

ModelRight's Model Explorer and Browsers

Contents

  • Overview of ModelRight's Explorer and Browsers
  • Comparison or Model Explorer and Browsers
  • Model Explorer View
  • Model Browser View
  • Metamodel Browser View
  • Tips

Overview of ModelRight's Explorer and Browsers

ModelRight provides several explorers and browsers, three of which are of great importance to you as a programmer. Briefly they compare as follows:

Model Explorer with Property Browser: This is a pair of browser panels which end-users will employ all the time. For the model currently loaded, the Model Explorer panel shows a treeview of familiar database objects (Tables...Columns) and graphics (Models... Model Subsets... Diagrams). As the user selects items in the treeview, their Properties appear over in the Property Browser panel.  (Of course, much of this information duplicates what is shown on the drawing in diagrammatic form.)

Model Browser: This again shows the information of the currently-loaded database model, but presented as a single treeview, in an arrangement that reflects the structure of MRObjects and MRProperties. For programmers, this as a map with which to write code to navigate the MRObjects and Properties for this particular model. This view has the advantage that you can verify your understanding of the model by inspecting values on the diagram or in the Property Browser, and then finding them in the Model Browser.

Metamodel Browser: This browser presents a single treeview displaying the model metadata that ModelRight is using to structure the information in the model.  This tells all the types of children and properties that are expected at each level of the model for this vendor's database. This browser shows nothing specific to the model currently loaded (other than being appropriate to the particular database vendor/product/version). However, the advantage of this browser is that it shows absolutely all objects and properties that such a model can contain. Also, there are explicit nodes in the tree for the "Children" and "Properties" collections, which correspond directly to the programming statements you would use to navigate the model.

Comparison or Model Explorer and Browsers

The following sections show the three explorer/browser displays, comparing what they each show for the same part of a database model.

Model Explorer View

Here is the Model Explorer view of column actor_id in table actor, showing:

  • information pertaining to the database model (Model Objects panel) and
  • graphics data used to display that information on the diagram (Diagrams panel).

Tip: If the Model Explorer Diagrams tree doesn't show tables and columns, you can make these visible using Tools > Options > Model Explorer > Diagrams: Display Graphics Objects.

Model Explorer versus Diagram

As you select an item in either the Model Objects or Graphics panel, the Property Browser panel changes to show associated properties:

Property Browser for Column actor_id
(Column tab selected)
Property Browser for Column's Graphics
  (Graphics tab selected)

Note how the information about actor.actor_id corresponds between the Explorer treeviews, the diagram, and the two Property Browser panes.

Model Browser View

The Model Browser treeview presents a comprehensive view of the same information as above. (Sections of tree have been omitted in order to show all levels of the tree down to the column and properties in this limited space.) 

Model Browser showing Column
Model > Tables > Columns > Column actor_id
Model Browser showing Column's Graphics
  Model > Model Subset > Diagram > Table Graphics > actor > Column Graphics > actor_id

These screenshots show how:

  • This information corresponds to the Explorer + Properties view shown in the previous section.
  • The database model and the graphics settings are accessed through two separate branches of the tree: The Table(s) branch, and the Model Subset branch.

Metamodel Browser View

The Metamodel Browser shows the structure of data that ModelView can handle for a particular database vendor/product/version. (As such it does not show any data pertaining to a particular database model that you've created.)  To demonstrate this point, the sceencaps below compare the Model Browser's display to the Metamodel Browser's display.

Model Browser showing Column (same as above)
Model > Tables > Columns > Column actor_id
Metamodel Browser showing Column
Model > Children > (of Type) Table
> Children > (of Type) Column(s) > Properties > various

Here we have expanded the Metamodel Browser (right) to show that, for this type of database (MySQL), a database Model will have children of various types including Table, and these have children of various types including Column, and these have Properties of various names, including  Datatype, Datatype Length, and Name. (Many more child objects and properties are not shown here).  You can see the database model data in the Model Browser (left), where the Column data indeed show properties and their values corresponding to the structure defined by the Metamodel.

As a guide for programmers writing scripts for ModelRight, the Metamodel Browser nodes provide an explicit map to the parameters you can use:

  • The labels of nodes appearing under a Children node can be used with the MRObject.Children family of methods.
  • The labels of nodes appearing under a Properties node can be used with the MRObject.Properties family of methods.

Alternatively, you can see how most of this same information appears in more condensed form in the Model Browser, and can also be inferred from the Explorer and Properties panels.

Note that the Metamodel Browser shows all objects and properties that are possible, while the Model Browser shows only the properties that have actually been set in a particular model.

Tips

Viewing Browsers while programming

Since the Model and Metamodel browsers are such important references, you may wish to have one or other open while writing a script. The Metamodel browser is non-modal, so you can open it and leave it open as you need.  The Model browser is modal, so cannot be open while editing a script. However, you can work around this by running a second copy of ModelRight, load the same database model file (or a copy of it) and then open the Model Browser. (Be careful not to get confused about which instance you are editing!)

Next - Some ModelRight Programming Topics in more Detail  >>

Original article by Graham Wideman