ICSE 2001 Logo   Rigi Logo
 
rcl_load_rsf
Back to RCL Command Index

Argument Default Description
rsfName - Name of the file in which the graph is stored.

Description:

This procedure reads a file containing a set of Rigi Standard Format (RSF) tuples. The file is a description of a graph that may be either "flat" (non-hierarchical) or "hierarchical" graph. The RSF file is usually generated by a parser although it can also be created by executing the rcl_write_rsf or rcl_save_rsf procedures. Special scripts can also be used to produce RSF (see, for example, the rcl_kb_dump example).

The existence of a hierarchy in an RSF file is detected by the presence of the word "Root" in the second element of the first tuple in the file. If the file is not hierarchical, the following warning messages are written to stderr:

    RSF file is missing "Root" as root node.
    Reading file as unstructured RSF.

Note that rcl_read_rsf, unlike this command, requires an unstructured input file.

Any existing graph in Rigi is cleared before the RSF file is loaded. The rigi modelling domain must be the same domain under which the RSF file was created.

The rsfName is the full file specification (including the directory path).

Return Value:

If an error occurs, -1 is returned; otherwise a non-negative value is returned.

Exceptions:

Errors are reported if the procedure is unable to open the input file or the RSF tuples cannot be properly parsed. Warnings may be written to stderr indicating possible problems in the data such as duplicate nodes and arcs.

Example:

# Set the domain the C-language domain. Then
# load an RSF file named "rsf" from the "userdb"
# subdirectory of the data base directory. (The data
# base directory is given by the configuration variable,
# "DBDIR.") If Rigi is unable to load the RSF file,
# issue an error message and return to the previous domain.

set domainname [rcl_get_domainname]
rcl_rigi_init c
set dbdir [rcl_env_get DBDIR]/userdb
if {[rcl_load_rsf 
dbdir/rsf] == -1} {
	rcl_msg "Unable to load 
dbdir"
	rcl_rigi_init 
domainname
}

Back to RCL Command Index