Relationship classes in geodatabases(ArcInfo and ArcEditor only) |
|
|
Release 9.1
Last modified August 15, 2005 |
|
NOTE: Although you can only view relationship classes in ArcView, they can be both created and edited in ArcInfo and ArcEditor.
Like any association, relationships have particular characteristics, such as cardinality, attributes, and path labels.
Simple or peer-to-peer relationships are relationships between two or more objects in the database that exist independently of each other.
In a relationship between object A and object B, if object A is deleted from the database, object B continues to exist. For example, in a railroad network you may have railroad crossings that have one or more related signal lamps. However, a railroad crossing can exist without a signal lamp, and signal lamps exist on the railroad network where there are no railroad crossings.
Simple relationships can have one-to-one, one-to-many, or many-to-many cardinality.
Learn more about simple relationships
The geodatabase also supports the notion of a composite relationship, where the lifetime of one object controls the lifetime of its related objects. The pole–transformer relationship is an example of a composite relationship. Once a pole is deleted, a delete message is propagated to its related transformers, which are deleted from the transformers' feature class.
Composite relationships are always one-to-many but can be constrained to be one-to-one using relationship rules.
Learn more about composite relationships
One-to-one and one-to-many relationship classes do not require a new table to be created in the geodatabase to store the relationships. However, many-to-many relationship classes do require a new table in the database to store the foreign keys from the origin and destination classes to make the relationship. This table can also have other fields to store attributes of the relationship itself that are not attributed to either the origin or destination class.
For example, in a parcel database you may have a relationship class between parcels and owners in which owners "own" parcels and parcels are "owned by" owners. An attribute of that relationship may be percentage ownership.
One-to-one and one-to-many relationship classes may also have attributes; in this case, a table would be created to store the relationships.
Learn how to create an attributed relationship class
Relationship classes can have an associated set of relationship rules. Relationship rules control which object subtypes from the origin class can be related to which object subtypes in the destination class. They can also be used to specify a valid cardinality range for all permissible subtype pairs.
For example, the subtype wood pole may be able to contain from zero to three transformers, whereas the subtype steel pole may support zero to five transformers. In the first case, the cardinality range would be 0–3; in the second case, it would be 0–5.
You can establish a relationship between two or more objects in the geodatabase by using tools available in ArcMap. Once the relationship is established, use the ArcMap tools in to navigate it and symbolize features based on attributes in a related object. You can find all objects that have a relationship with a particular object through any particular relationship class.
When editing composite features, edits such as move, rotate, and delete also affect the related objects through the relationship class. There is a cost when navigating these relationships. The cost is minimized when indexes are maintained for the primary and foreign keys for the relationship class. When a new relationship class is created with ArcCatalog, the primary and foreign keys are automatically indexed if they do not already have indexes.
It is important to realize that when a feature class participates in a relationship class, that feature class utilizes messaging. When editing that feature class in ArcMap, the related class must be opened so it can respond to the message—either by moving, deleting itself, or implementing some custom behavior. If the related class is not already in the map you are working with, it will automatically be opened to respond to the message, then closed. Each time it responds to a message, it will need to be reopened.
In general, when working with a class in ArcMap, it's a good idea to have all related classes also in the map. This way, the related classes are opened once when they are added to ArcMap. If they are not in the map, then each time you access related objects, the class must be opened.
With many ArcInfo coverage data models, the feature–attribute table contained as few items as possible, and many of the attributes for a feature class were contained in a related table. This can be done with geodatabase feature classes; however, navigating a relationship in the geodatabase is a more costly operation than navigating relates in INFO. In the INFO environment, it was common to store the symbology for a feature in an external related table called a lookup table. This can still be done in the geodatabase using relationship classes; however, for large data, symbolizing this way will be slow, even with indexes on the primary and foreign keys. Try to keep attributes for symbolization on the feature class's table. For performance considerations, it is recommended that symbology information be stored in the feature class.
An exclusive lock is required when modifying a relationship class's relationship rules or when renaming or deleting a relationship class. An exclusive lock can only be acquired for a relationship class if the feature classes or tables that participate in the relationship can also be locked. Therefore, if a user has an exclusive or shared lock on either the origin class, the destination class, or both classes, the properties of the relationship class cannot be edited.
Learn more about exclusive locks and schema locking