Manage relationship class rules

When you create a relationship class, you create it with the cardinalities one-to-one, one-to-many, or many-to-many.

A relationship often needs to be defined in more restrictive terms. In a relationship of parcels and buildings, for example, you might need to require that each building be associated with a parcel or that a parcel can contain a maximum number of buildings. You want to prevent a user from forgetting to associate a building to a parcel or from associating too many buildings to a parcel.

If you have subtypes, you can constrain the number and type of objects in the origin that can relate to a certain type of object in the destination. For example, steel poles support class A transformers, while wooden poles support class B transformers. Furthermore, you may also need to specify the permissible cardinality range for each valid subtype pair. For example, a steel pole can support 0–3 class A transformers, while a wooden pole can support 0–2 class B transformers.

View relationship class rules

To view the relationship rules for your relationship class, complete these steps:

Relationship class rules on the Relationship Class Properties dialog box
  1. Right-click the relationship class in the Catalog pane to open the Relationship Class Properties dialog box.
  2. Click the Rules tab on the Relationship Class Properties dialog box.

    A list of all of the possible rules that can exist for your relationship class will display.

The Enabled column indicates which of the rules are currently active.

You can sort the relationship class rules by selecting Origin then Destination Subtype or Destination then Origin Subtype in the Sort By drop-down menu.

Add a rule to the relationship class

Once you've created the relationship class, you can refine the cardinality by adding rules. Relationship rules allow you to restrict the type of objects in the origin feature class or table that can be related to a certain kind of object in the destination feature class or table.

To add a rule to the relationship class, complete the following steps:

  1. To add a rule to a relationship class, you can add a rule directly from the Relationship Class Properties dialog box or you can use the Add Rule To Relationship Class geoprocessing tool.
    • If you choose to add a rule directly from the Relationship Class Properties dialog box, from the Catalog pane, right-click the relationship class and click Properties.
      1. From the Rules tab, check the Enabled check box for the row that represents the rule you want to add to the relationship class.
      2. If the origin table 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.
        Add a relationship class rule from the Rules tab on the Relationship Class Properties dialog box.
    • If you choose to use the Add Rule To Relationship Class geoprocessing tool, click the link to open the Add Rule To Relationship Class geoprocessing tool.
      1. Click the browse button Browse next to Input Relationship Class to browse to the geodatabase where your relationship class resides. This geodatabase can be a file, mobile, or enterprise geodatabase.
        Tip:

        If the relationship class is stored in an enterprise geodatabase, this tool can only be successfully run by the data owner.

      2. Optionally, for Origin Subtype, if the origin table has subtypes, from the drop-down menu, 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.
        Add Rule To Relationship Class geoprocessing tool dialog box
  2. Set the appropriate Min and Max cardinalities on the rule for the origin and destination by entering integers in their corresponding cells.
  3. Repeat steps 1 and 2 for each rule that you want to add.
  4. Click Run if using the Add Rule To Relationship Class geoprocessing tool or click OK on the Relationship Class Properties dialog box to apply the changes.

    Once a relationship 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.

    For example, a hazmat landfill can be related to one or two deep wells or between two and seven shallow wells. However, if a sanitary landfill is related to a deep well, but no rule has been created between these two subtypes, the Validate Features command will consider the relationship to be invalid.

    Once a rule has been added, that rule becomes the only valid relationship that can exist until you add more rules.

Delete a relationship class rule

To remove a rule from the relationship class, complete the following steps:

  1. To remove a rule from a relationship class, you can remove a rule directly from the Relationship Class Properties dialog box, or you can use the Add Rule To Relationship Class geoprocessing tool.
    • If you choose to remove a rule directly from the Relationship Class Properties dialog box, from the Catalog pane, right-click the relationship class and click Properties.
      1. From the Rules tab, uncheck the Enabled check box for the row that represents the rule you want to remove from the relationship class.
      2. If the origin table has subtypes, choose the subtype you want to remove a relationship class rule from.
        Uncheck box to remove a relationship class rule from the Rules tab on the Relationship Class Properties dialog box.
      3. Click OK to complete the changes.
    • If you choose to use the Remove Rule From Relationship Class geoprocessing tool, click the link to open the Remove Rule From Relationship Class geoprocessing tool.
      1. Click the browse button Browse next to Input Relationship Class to browse to the relationship class with the rule to remove. The geodatabase containing the relationship class can be a file, mobile, or enterprise geodatabase.
        Tip:

        If the relationship class is stored in an enterprise geodatabase, this tool can only be successfully run by the data owner.

      2. Optionally, for Origin Subtype, if the origin table has subtypes, from the drop-down menu, choose the subtype you want to remove a relationship class rule from. If the origin class has no subtypes, the relationship rule will apply to all features.
        Remove Rule From Relationship Class geoprocessing tool dialog box
      3. Optionally, for Destination Subtype, if the destination class has subtypes, from the drop-down menu, choose the subtype you want to remove a relationship class rule from.
      4. For Remove All, the following scenarios apply:
        • Checked—All relationship rules will be removed from the input relationship class.
        • Unchecked—Only rules from the origin and destination subtypes specified will be removed. This is the default.
      5. Click Run to complete the changes.

Related topics