Customization > Extensibility Through Profiles, Stereotypes, Tag Definitions and Scripts > Lightweight extensions of PTC profiles > Overview of lightweight extensions of PTC profiles > Worked example: Creating a lightweight extension of a link type
  
Worked example: Creating a lightweight extension of a link type
In this section we create a new link type named Partially Satisfy, which is an extension of the SysML Satisfy link.
We start by creating a profile Package in which we can create our lightweight extensions.
We right-click the Model, point to New, and then click Package. We name the Package MyExts.
We must apply the «LightweightProfile» stereotype to the MyExts package, else Modeler will ignore any lightweight extensions we create in the Package. We right-click the MyExts package, point to Applied Stereotypes, and click LightweightProfile.
We open the Property Pages of the MyExts package and we select the Profile Package check box.
The name of the Package is important because in selection dialogs it will be used to scope the new item types we create. Note that if the name of the package ends in Profile, the text 'Profile' will be removed when it appears in dialogs.
In Modeler, our model contains the SysML Profile, which contains the Satisfy link we want to extend.
We create a Profile Diagram in our MyExts package so that we can create our new Stereotype and define it as an extension of the SysML Satisfy link. We right-click our Package, point to New, point to UML, point to Profiles, and then click Profile Diagram.
On the Profile Diagram, we create a Stereotype named PartiallySatisfy for our new link type. We click the Stereotype toolbar button, click in free space, and then type PartiallySatisfy.
We now add the SysML «Satisfy» stereotype to the diagram. We click the Stereotype toolbar button, right-click in free space, and then select the SysML «Satisfy» stereotype.
* 
By default on a Profile Diagram a Stereotype's Scripts and Tag Definitions are shown. In the examples shown in this topic we have hidden the Scripts and Tag Definitions of the Stereotypes through their View Options.
We want to create a Generalization between the «PartiallySatisfy» and «Satisfy» stereotypes, but before we can do so we must unprotect the SysML profile. We open the SysML Profile package's Property Pages, click the Access Permissions tab, clear the Protected check box, and then click the Copy Protected Flag to Child Packages button.
We click the Generalization button, click the «PartiallySatisfy» stereotype, and then click the SysML «Satisfy» stereotype.
The PartiallySatisfy type now inherits all the properties and scripts of the Block type.
We must set the check boxes on the Options and Directly-Stereotyped Options tabs of the «PartiallySatisfy» stereotype's Property Pages to the same as those of the Stereotype we are extending. We can do this quickly through the Copy Super Stereotype Options command.
We now want to specify an icon to use for our new link type, which will be used in the Modeler browsers and for its toolbar buttons. In addition, we want to define the presentation of our new link type on diagrams. To do this we open the «PartiallySatisfy» stereotype's Property Pages, click the Style tab, click the Edit button, and then through the Style Modification dialog set up the icon and presentation.
Our new PartiallySatisfy link inherits the 'Satisfies' and 'Satisfied By' link start and link end names from the Satisfy link. We want to change these link end names to 'Partially Satisfies' and 'Partially Satisfied By', which we can do through a child Comment.
Note that you can find out the link start and link end names of a link through the Wrapper Details report. In the Dictionary pane, we right-click a Satisfy link, point to Tools, point to Profile Extension, and then click Wrapper Details. On the Meta Model Viewer dialog, we expand the Information folder. The link start and link end names are shown as the 'Raw Start to End Role' and 'Raw End to Start Role' properties.
Note that if you right-click a Satisfy link on a diagram, the 'Raw Start to End Role' and 'Raw End to Start Role' properties are not shown on the Meta Model Viewer dialog.
To change the link end names, we create a Comment from the «PartiallySatisfy» stereotype and set the Full Text property of the Comment to as follows.
After defining our new link type, we right-click the model, and then click Reinitialize Profile Helper. This creates the roles that are required for creating the scripts.
We need to create the scripts that are required for our new profile Package, which we do by running the Create Scripts command against our profile Package.
We also need to create scripts in all the supported PTC profiles that are affected by our new link type. The SysML profile requires scripts to define commands that create, link and populate our new Partially Satisfy link, as well as the scripts that define the diagram toolbar buttons for creating our link on the SysML diagrams. We create these scripts by running the Create Scripts command against our SysML Package as well.
Important: Creating scripts for the SysML profile does not create scripts for the SysML Requirements profile. After creating scripts for the SysML profile, we expand the SysML profile, and then run the Create Scripts command against the Requirements profile it contains.
We now want to see if our new PartiallySatisfy type is available in the same places as the Block type in the Modeler user interface.
A Satisfy link can be created between a SysML Requirement and any other item, so we should be able to create a Partially Satisfy link between a SysML Requirement and any other item. We right-click a SysML Requirement and click Links > Start Link, and then right-click a Block and click Links > End Link.
Our new PartiallySatisfy link is available for selection through the Partially Specified By entry.
Important: If we make further changes to the lightweight extensions in the Model, we must change the Lightweight Profile Version to a later version number. The changes made to the lightweight extensions will take effect only after updating the Lightweight Profile Version. To change the Lightweight Profile Version, use the Build Cache/Extensions command.
* 
While developing lightweight extensions you can see the effects of any changes you make without having to change the Lightweight Profile Version number by disabling Profile Helper caching. To disable Profile Helper caching, use the Caching Enabled command, and set caching enabled to False.