bridge building
Note: Bridge Building is a very advanced topic. It's not required to understand how SQLINQ works.
This topic is all about building a Bridge to a different modelling tool or model representation for use with SQLINQ. It describes the underlying GenerationSpec class. The Bridge transforms a UML model into a GeneratorSpec object, then the generator works off of new instance. This was to prevent coupling between the Software Ideas Modeller's way of representing things and the architecture the generator uses.
It's recommended that you replace the UMLModelParser class with your own, instead of modifying the SQLINQGenerator, as your changes may prevent future updates of the SQLINQGenerator.
Note: If you are building a Bridge to Sparx Enterprise Architect; contact the developer. SQLINQ's original generator was based on Sparx EA then transformed to SIM; entirely because of licensing costs.
This topic is all about building a Bridge to a different modelling tool or model representation for use with SQLINQ. It describes the underlying GenerationSpec class. The Bridge transforms a UML model into a GeneratorSpec object, then the generator works off of new instance. This was to prevent coupling between the Software Ideas Modeller's way of representing things and the architecture the generator uses.
It's recommended that you replace the UMLModelParser class with your own, instead of modifying the SQLINQGenerator, as your changes may prevent future updates of the SQLINQGenerator.
Note: If you are building a Bridge to Sparx Enterprise Architect; contact the developer. SQLINQ's original generator was based on Sparx EA then transformed to SIM; entirely because of licensing costs.
Generator spec class
This class defines the following objects that are defined in the class.
public List<ModelObject> Objects = new List<ModelObject>();
public Dictionary<string, List<string>> MissingComments = new Dictionary<string, List<string>>();
OBJECTS is used in the main loop of the generator to write out all the table and domain classes and the aspects of the Factory class. See the ModelObject class for it's specifications.
MISSINGCOMMENTS is used to report objects that have missing comments. It's formatted by type and by the name of the object within that type that has missing comments. It's only used to report the comments are missing, it's not used in the actual generation process. The "type" you report is entirely up to you, as it's to help people using your Bridge know where to find comments that are missing.
public List<ModelObject> Objects = new List<ModelObject>();
public Dictionary<string, List<string>> MissingComments = new Dictionary<string, List<string>>();
OBJECTS is used in the main loop of the generator to write out all the table and domain classes and the aspects of the Factory class. See the ModelObject class for it's specifications.
MISSINGCOMMENTS is used to report objects that have missing comments. It's formatted by type and by the name of the object within that type that has missing comments. It's only used to report the comments are missing, it's not used in the actual generation process. The "type" you report is entirely up to you, as it's to help people using your Bridge know where to find comments that are missing.
Model object class
This class is used to store all of the unique details about an object. All the attributes, except ObjectIdentifier, is used in generation.
public string ObjectIdentifier;
public string Name;
public string ObjectType;
public string SubType;
public string Stereotype;
public bool isAbstract;
public string Note;
public List<ModelConnection> StartConnections;
public List<ModelConnection> EndConnections;
public List<ModelAttribute> Attributes;
ATTRIBUTES
OBJECTIDENTIFIER is a utility attribute used to help you uniquely identify classes when locating objects so that connections can be properly connected between objects. You can use this attribute in any way you want. It's not used by the generator.
OBJECTTYPE is contains only one value "class" (case sensitive). It contains classes and enumerations. Enumerations are identified with the stereotype "enumeration". The reason for this differentiation is that the original GeneratorSpec came from a Bridge from Sparx Enterprise Architect, and there was no way to differentiate between classes and other "nodes".
STEREOTYPE identifies the type of object. Currently it's black for regular classes and "enumeration" for enumeration classes/objects.
ISABSTRACT is used to define an abstract class. Essentially creating class that cannot be instantiated. It's often used by base classes in an inheritance hierarchy, or introducing a class that has a common set of attributes between several subclasses.
SUBTYPE is the 20 character (or less) identifier for the class. It's used by the factory to decide which constructor to call for that table instance.
NAME and NOTE are used to describe the classes. NAME is a character string which defines the table and/or domain class. I cannot contain spaces.
LISTS<>
STARTCONNECTIONS identify all the connections that start at this object and end at another object (or in some cases to the same object), such as to define a hierarchical data/object relationship. See ModelConnector for more information.
ENDCONNECTIONS identify all connections that start at another object and end/point to this object. See ModelConnector for more information.
ATTRIBUTES contains a list of attributes define for this class. Remember, you do not define OIDs or SubTypes; this is handled automatically by the generator.
public string ObjectIdentifier;
public string Name;
public string ObjectType;
public string SubType;
public string Stereotype;
public bool isAbstract;
public string Note;
public List<ModelConnection> StartConnections;
public List<ModelConnection> EndConnections;
public List<ModelAttribute> Attributes;
ATTRIBUTES
OBJECTIDENTIFIER is a utility attribute used to help you uniquely identify classes when locating objects so that connections can be properly connected between objects. You can use this attribute in any way you want. It's not used by the generator.
OBJECTTYPE is contains only one value "class" (case sensitive). It contains classes and enumerations. Enumerations are identified with the stereotype "enumeration". The reason for this differentiation is that the original GeneratorSpec came from a Bridge from Sparx Enterprise Architect, and there was no way to differentiate between classes and other "nodes".
STEREOTYPE identifies the type of object. Currently it's black for regular classes and "enumeration" for enumeration classes/objects.
ISABSTRACT is used to define an abstract class. Essentially creating class that cannot be instantiated. It's often used by base classes in an inheritance hierarchy, or introducing a class that has a common set of attributes between several subclasses.
SUBTYPE is the 20 character (or less) identifier for the class. It's used by the factory to decide which constructor to call for that table instance.
NAME and NOTE are used to describe the classes. NAME is a character string which defines the table and/or domain class. I cannot contain spaces.
LISTS<>
STARTCONNECTIONS identify all the connections that start at this object and end at another object (or in some cases to the same object), such as to define a hierarchical data/object relationship. See ModelConnector for more information.
ENDCONNECTIONS identify all connections that start at another object and end/point to this object. See ModelConnector for more information.
ATTRIBUTES contains a list of attributes define for this class. Remember, you do not define OIDs or SubTypes; this is handled automatically by the generator.
Model attribute class
Identifies the details for an attribute.
public string Name;
public string Type;
public List<string> Stereotypes;
public string Notes;
public string Default;
NAME identifies the attribute.
TYPE is the internal type for the attribute. ONLY primitives (int, string, char, float, double) or structs (Guid, DateTime, etc.) are permitted. Use associations to relate instances together or identify a connection.
STEREOTYPES is a list of stereotypes specified for the attribute. Stereotypes like, find, index, notnull, etc. are expected here.
NOTES are the description for the attribute. It's used as documentation for arguments on methods.
DEFAULT is only used for enumerations, identifies the integer value for the name.
public string Name;
public string Type;
public List<string> Stereotypes;
public string Notes;
public string Default;
NAME identifies the attribute.
TYPE is the internal type for the attribute. ONLY primitives (int, string, char, float, double) or structs (Guid, DateTime, etc.) are permitted. Use associations to relate instances together or identify a connection.
STEREOTYPES is a list of stereotypes specified for the attribute. Stereotypes like, find, index, notnull, etc. are expected here.
NOTES are the description for the attribute. It's used as documentation for arguments on methods.
DEFAULT is only used for enumerations, identifies the integer value for the name.
Model connection class
Defines the relationship/association/generalization between two objects. Based on our Bridge work, it's best/easiest to load all the objects first, then try to connect them by reading the model a second time.
public string ConnectionType;
public string StartRole;
public string EndRole;
public ModelObject StartObject;
public ModelObject EndObject;
public string Note;
CONNECTIONTYPE identifies the connection between two objects. It can either be "relationship" (most common) or "generalization". A relationship is used to show a connection between two objects and usually represents an association. It also represents a connection to define how enumerations are related to the class they are used within.
NOTE is the descriptive text for the connection. It is ignored for generalizations.
STARTROLE is the name of the role at the start of the connection. STARTOBJECT is the actual object that the START of the connection refers to.
ENDROLE is the name of the role at the end of the connection. ENDOBJECT is the actual object that the END of the connection refers to.
public string ConnectionType;
public string StartRole;
public string EndRole;
public ModelObject StartObject;
public ModelObject EndObject;
public string Note;
CONNECTIONTYPE identifies the connection between two objects. It can either be "relationship" (most common) or "generalization". A relationship is used to show a connection between two objects and usually represents an association. It also represents a connection to define how enumerations are related to the class they are used within.
NOTE is the descriptive text for the connection. It is ignored for generalizations.
STARTROLE is the name of the role at the start of the connection. STARTOBJECT is the actual object that the START of the connection refers to.
- "generalizations", this value is ignored.
- "relationship" connecting enumerations to classes, the name of the role must match exactly the attribute name in the class and is case sensitive.
- "relationship" connecting two classes together is the most common. The start role is used to define an attribute in the object referred to as the "EndObject" that is the master/parent in the one-to-many relationship. See LazyMasters for more information.
ENDROLE is the name of the role at the end of the connection. ENDOBJECT is the actual object that the END of the connection refers to.
- "generalizations", this value is ignored.
- "relationship" connecting enumerations to classes, this value is ignored.
- "relationship" connecting two classes together is the most common. The end role is used to define an attribute in the object referred to as the "StartObject" that lists all the children in the one-to-many relationship. See LazyChildren for more information.