Summary
Adds a rule to a relationship class.
A relationship class is created with one-to-one, one-to-many, or many-to-many cardinality. A relationship class can be defined in more restrictive terms by adding a rule to a relationship class. Once a rule is added to a relationship class, that rule becomes the only valid relationship that can exist. To make other relationship combinations and cardinalities valid, additional relationship rules must be added.
Usage
If the relationship class is stored in an enterprise geodatabase, this tool can only be successfully run by the data owner.
Syntax
AddRuleToRelationshipClass(in_rel_class, {origin_subtype}, {origin_minimum}, {origin_maximum}, {destination_subtype}, {destination_minimum}, {destination_maximum})
Parameter | Explanation | Data Type |
in_rel_class | The relationship class to which a rule will be added. | Relationship Class |
origin_subtype (Optional) | Specifies the subtype of the origin class. If the origin class has subtypes, choose the subtype to which you want to associate a relationship class rule. If the origin class has no subtypes, the relationship rule will apply to all features. | String |
origin_minimum (Optional) | Specifies the minimum range cardinality for the origin class if the relationship class is many-to-many. | Long |
origin_maximum (Optional) | Specifies the maximum range cardinality for the origin class if the relationship class is many-to-many or one-to-many. | Long |
destination_subtype (Optional) | Specifies the subtype of the destination class. If the destination class has subtypes, choose the subtype to which you want to associate a relationship class rule. If the destination class has no subtypes, the relationship rule will apply to all features. | String |
destination_minimum (Optional) | Specifies the minimum range cardinality for the destination class if the relationship class is many-to-many or one-to-many. | Long |
destination_maximum (Optional) | Specifies the maximum range cardinality for the destination class if the relationship class is many-to-many or one-to-many. | Long |
Derived Output
Name | Explanation | Data Type |
out_rel_class | The updated relationship class with the relationship rule added. | Relationship Class |
Code sample
The following Python window script demonstrates how to use the AddRuleToRelationshipClass tool.
import arcpy
arcpy.AddRuleToRelationshipClass_management(
"C:\\MyProject\\sdeConn.sde\\progdb.user1.ParcelsToBuildings", "Residential",
0, 1, "House", 1, 3)
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes