A look at Relationship Class in ArcGIS
October 26, 2012
General Basics of Join, Relate, and Relationship Class
– Relate is stored within the map document and will link spatial and non-spatial tables on-the-fly
based on a common field. Relate allows users to select and query related features within the map
documents. Relate will not make any changes to the tables. Relate allows one-one (1-1) one-many
(1-M) and many-many (M-M) relationship.
– Join will append destination tables to source tables based on a common field. Because the
destination data are appended to the source table, users can apply symbology within ArcGIS based on
an attribute field from the destination table. Join allows many-one (M-1) and one-one (1-1)
relationship.
– Relationship classes are located within a Geodatabase and store the relationship information
between spatial and non-spatial tables. Tables participating in the relationship will have to be stored
within the same Geodatabase to maintain the relationship defined by the relationship class.
Relationship class allows one-many (1-M), many-many (M-M) and one-one (1-1) relationship.
Overview of Relationship:
One-Many Relationship (1-M): Relate, Relationship ClassSchool Department (Source) is linked to
Student (Destination) based on common field, MajorID, in a 1-M relationship
Many-One Relationship (M-1): Join, Relate, Relationship ClassStudent (Source) is linked to the Year
(Destination) based on common field, Age, in a M-1 relationship.
Many-Many Relationship (M-M): Relate, Relationship ClassSchool Department (Source) is linked to
the Professor (Destination) based on common field, Faculty, in a M-M relationship.
Features of Relationship Classes
– All participating tables/feature class must reside within the Geodatabase
– Relationship Classes maintains referential integrity
– Rules can be used to further define cardinality
– Relate Table performs relate on-the-fly within ArcMap document only
– Join will append data to the source table permanently.
– Once a Relationship Class is defined, ArcGIS will automatically open the related tables when users query the source feature. This is done even if the related tables are not loaded in to the Arcmap document window.
© 2013 Esri Canada. All Rights Reserved.
– Relate is stored within the map document and will link spatial and non-spatial tables on-the-fly
based on a common field. Relate allows users to select and query related features within the map
documents. Relate will not make any changes to the tables. Relate allows one-one (1-1) one-many
(1-M) and many-many (M-M) relationship.
– Join will append destination tables to source tables based on a common field. Because the
destination data are appended to the source table, users can apply symbology within ArcGIS based on
an attribute field from the destination table. Join allows many-one (M-1) and one-one (1-1)
relationship.
– Relationship classes are located within a Geodatabase and store the relationship information
between spatial and non-spatial tables. Tables participating in the relationship will have to be stored
within the same Geodatabase to maintain the relationship defined by the relationship class.
Relationship class allows one-many (1-M), many-many (M-M) and one-one (1-1) relationship.
Overview of Relationship:
One-Many Relationship (1-M): Relate, Relationship ClassSchool Department (Source) is linked to
Student (Destination) based on common field, MajorID, in a 1-M relationship
Many-One Relationship (M-1): Join, Relate, Relationship ClassStudent (Source) is linked to the Year
(Destination) based on common field, Age, in a M-1 relationship.
Many-Many Relationship (M-M): Relate, Relationship ClassSchool Department (Source) is linked to
the Professor (Destination) based on common field, Faculty, in a M-M relationship.
Features of Relationship Classes
- Relationship class supports multiple cardinality (M-1,1-M, M-M, 1-1).
- Relationship classes are stored within the Geodatabase as an object. All tables/feature classes participating in the relationship should be stored within the same Geodatabase.
Figure 4 - DeptStudent is the Relationship Class that holds the relationship between SchoolDept and Student - Relationship is maintained permanently outside of the ArcMap environment given that the relationship class is maintained within the Geodatabase. The relationship information is stored within the Relationship Class.
- Relationship class maintains referential integrity. Once the tables are related, any changes made to the source table will alter the related records on the destination table. Depending on the types of relationship being used (Simple or Composite), the related records might be changed to NULL or be deleted automatically when the source record is removed.
- More info for creating a Simple Relationship Class- More info for creating a Composite Relationship Class Example: Based on the tables used for the (1-M) relationship above with the Department and the Student Table as Source and Destination.
For a Simple Relationship,
Removing the Biology department in the source table will change the MajorID with value of 3 in the destination table to Null. As a result, the record ‘Francis P' will have a MajorID of Null.
Figure 5 – Related record(s) are set to Null automatically when source record is removed
For a Composite Relationship,
Removing the Biology department in the source table will delete all related records with a MajorID of 3 in the destination table. As a result ‘Francis P' is no longer contained within the Student table.
Figure 6 – Related record(s) are removed automatically when source record is removed. - Related records within the destination table can be edited within an edit session while performing editing on the source feature. This allows users to maintain related records using the Relationship Class.
Note: If the destination table is not opened within ArcMap, the related table will be opened automatically at the time of editing.
Figure 7 - Related records can be altered within the attributes windows in an edit session while performing editing on the source feature class/table. In the above picture, user selected the feature (Math) in the Department table within an edit session, opened the Attributes Editing window, and expanded the related records to edit the FullName attribute from the Student table. This allows user to easily maintain related records based on the source feature. - Similarly, new features can also be added to the destination table while editing the source table within the editing session. Once the new features are created, ArcGIS will automatically populate the default value for the common field. In this case, a value of 1is automatically populated for the new feature in the destination table.
Note: If the destination table is not opened within ArcMap, the related table will be opened automatically at the time of editing.
Figure 8 - Shown above, when user creates a new records under the Student table, a value of 1 (Math Department) for the MajorID field is automatically populated. Since the new related record is created while performing editing on the Math feature, ArcGIS will therefore relate the new student directly to the Math Department by assigning a 1 to the MajorID field. - Relationship rules can be used to further define the cardinality. Users can utilize rules to restrict the number/types of features allowed to be related to the source feature. A rule can be used in this case where ArcGIS will send an error message when user tries to relate 3 or more students to each department upon validating the feature within an edit session.
Figure 9 – Rules can be defined to limit the range of cardinality inside the Relationship Class properties dialog. In this scenario, we would like to limit the number of students that can be related to each department to 3
– All participating tables/feature class must reside within the Geodatabase
– Relationship Classes maintains referential integrity
– Rules can be used to further define cardinality
– Relate Table performs relate on-the-fly within ArcMap document only
– Join will append data to the source table permanently.
– Once a Relationship Class is defined, ArcGIS will automatically open the related tables when users query the source feature. This is done even if the related tables are not loaded in to the Arcmap document window.
© 2013 Esri Canada. All Rights Reserved.
No comments:
Post a Comment