Symaptic Web Hierarchical Explorer – Configuration for your own Database

To configure you own database, it is best to start with the Cambridge PNI Database example and modify to suit your own needs.

First, review the sync_camdb_pni_hierachical_explorer.magik script stored in the smallworld\install_config_scripts directory of your Symaptic Web and Mobile Package installation. This script contains the trunk, branches and  leaves, definition that you need to set in order to get the Symaptic Web Hierarchical Explorer going.

Setting the Installation Location

The first parameters are at the top of the script set the location of where the Symaptic Web and Mobile Package was installed.

###########################################################################
# The base configurations for the Symaptic Web and Mobile Package
###########################################################################

system.putenv("SYMAPTIC_BASE_DIR", "C:\symaptic")

Defining the Trunk

Now you need to define the structure of the hierarchy. For the PNI example, the parent->child hierarchy is

 Hub
   Bay
     Shelf
       Slot
         Card
           Port

The Hub is the trunk, the Bay, Shelf, Slot and Card are branches, while the Port is a leaf.

To define the trunk, add an element to the explorer_mapping rope shared variable with the following parameters defined:

###########################################################################
# Configure the hierarchical relationships
###########################################################################

# First you must have at least one trunk object
_local p << property_list.new_with(
		    :type, :trunk,
		    :dataset, :gis,
		    :object, :mit_hub,
		    :display_id, {:name},
		    :children, {:mit_bay},
		    :query, :method,
		    :arguments, {:mit_bays})

# Add the trunk object to our configuration using the object rwo_type as the key
symaptic_network_explorer.explorer_mapping[:mit_hub] << p

At this current point in time, the query parameter only supports the value of :method. This defines that a method is called that returns the children of the :mit_hub object. The children can be branches or leaves (see definitions below). A method name is stored in the arguments parameter. The value of the arguments parameter is a rope of the method name and optionally the arguments of for method (see the following example for the Branches).

Defining the Branches

The Branches are defined similarly to the Trunk, except with a type of :branch. Note the arguments value which shows the method to run to find the children of the branch including arguments for the method.

# Now add some branches to the trunk
# Branches have a parent and optionally children (leaves)
p << property_list.new_with(
		:type, :branch,
		:dataset, :gis,
		:object, :mit_bay,
		:display_id, {:description},
		:children, {:mit_shelf},
		:query, :method,
		:arguments, {{:|all_rme_components()|,{:rwo_type,{:mit_shelf}}}})
symaptic_network_explorer.explorer_mapping[:mit_bay] << p

Defining the Leaves

Finally the leaves of the hierarchy can be defined. Leaves are similar to Trunks and Branches except that they have no children.

# And finally we have some leaves
# Leave can have no children/leaves of their own
p << property_list.new_with(
	     :type, :leaf,
	     :object, :mit_rme_port,
	     :display_id, {:description})
symaptic_network_explorer.explorer_mapping[:mit_rme_port] << p

Running the script

That’s it. Run the script to populate the Solr database with your trunk, branches and leaves. Wait for the script to finish and access http://localhost/explorer.php. You should now see the Symaptic Web Hierarchical Explorer application.