ICSE 2001 Logo   Rigi Logo
 
rcl_read_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 "flat" or "non-hierarchical" graph. The RSF file is usually generated by a parser although it can also be created by executing the rcl_write_rsf procedure or by executing a special script (see, for example, the rcl_kb_dump example).

The existence of a hierarchy in an RSF file is detected by the existence of the word "Root" in the second element of the first tuple in the file. Hierarchical RSF files should be read using the rcl_load_rsf procedure. 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.") Finally, if the RSF file has been loaded
# successfully, select all of the nodes of type
# "File" and collapse them into a single node named
# "FileSubsystem."

rcl_rigi_init c
set dbdir [rcl_env_get DBDIR]/userdb
if {[rcl_read_rsf 
dbdir/rsf] != -1} {
	rcl_select_type File
	rcl_collapse "" FileSubsystem
}

Back to RCL Command Index