Declarative Objectivity (DO) Language : Schema Clauses : RENAME CLASS Clause
RENAME CLASS Clause
A RENAME CLASS clause changes the name of an existing class in the schema of a federated database.
   
Syntax 
renameClassClause : RENAME CLASS className TO className;
Used In 
UPDATE SCHEMA Statement
Quick Look 
Rename an existing schema class:
UPDATE SCHEMA 
{
   RENAME CLASS FleetData.EfficiencyReport TO FleetData.EfficiencySurvey
};
Discussion 
A RENAME CLASS clause is an action clause of an UPDATE SCHEMA Statement. The clause:
Instructs UPDATE SCHEMA to change the name of an existing schema class.
Provides the new cname for the class. If the class is to belong to a schema namespace, the new class name must include the namespace qualification.
You can include any number of RENAME CLASS clauses in a single UPDATE SCHEMA statement.
The new class name becomes available to concurrent database access when the enclosing UPDATE SCHEMA statement returns. No class is renamed if the enclosing UPDATE SCHEMA statement returns an error.
Refering to Renamed Classes in the Same Schema Update
You can include a RENAME CLASS clause in the same UPDATE SCHEMA statement with other action clauses. If any of the action clauses must refer to the renamed class, it must do so using the class’s new name, regardless of the relative order of the clauses within the statement.
Note:To avoid confusion, it is recommended that you perform RENAME CLASS actions in a separate UPDATE SCHEMA statement, instead of combining them with other schema actions in the same statement.
Example. Assume a class called Test exists in the schema. The following statement renames the existing class and creates two new classes that depend on it. Notice that the ALTER CLASS clause must use the new class name to refer to the renamed class, even though the RENAME CLASS clause follows it.
UPDATE SCHEMA 
{
   CREATE CLASS Dependent {
     referenceAttr : Reference {Referenced: NewName}
   }
   RENAME CLASS Test TO NewName 
   CREATE CLASS Inheritor SUPERCLASS NewName {
     uniqueId : Guid
   }
};
Moving a Class to Another Namespace
You can use a RENAME CLASS clause to move an existing class from one schema namespace to another. If the destination namespace does not yet exist in the schema, it is automatically added.
Example. Assume a class called Test exists in a schema namespace called Namespace1. The following statement moves that class into Namespace2.
UPDATE SCHEMA 
{
   RENAME CLASS Namespace1.Test TO Namespace2.Test 
};
Renaming a Class With Dependents
You can use a RENAME CLASS clause to rename an existing class that has dependents. Doing so automatically adjusts the class name within the description of each dependent class.
If you rename a class that is used as a superclass, the subclasses are adjusted to inherit from the renamed class.
If the renamed class is used as the referenced or embedded class for an attribute of a dependent class, then the attribute description is adjusted within the dependent class.