com.esri.arcgis.geodatabase
Interface IRelationshipClass

All Superinterfaces:
java.io.Serializable
All Known Subinterfaces:
IRelationshipClass2
All Known Implementing Classes:
AttributedRelationshipClass, IRelationshipClass2Proxy, IRelationshipClassProxy, MemoryRelationshipClass, RelationshipClass

public interface IRelationshipClass
extends java.io.Serializable

Provides access to members that return information about the relationship class, create relationships, relationship rules and get related objects.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Description

A RelationshipClass is an association between two object classes; one is the origin class and the other the destination class.  The RelationshipClass can have cardinality taking the form of 1-1, 1-M, M-N (One-to-One, One-to-Many, Many-to-Many).  A RelationshipClass may be simple or composite.  Composite relationship classes are 1-M where the origin class controls the lifetime of the destination class.  Simple relationship classes are peer-to-peer where the related objects can exist independent of each other.

When To Use

Use the RelationshipClass when you want to maintain particular associations between objects in a geodatabase.

Remarks

Relationships can be between spatial, non-spatial objects, or between spatial and non-spatial objects.  The spatial objects will be stored in feature classes, and the non-spatial in object classes, however, all of the relationships will be maintained in the relationship class.  RelationshipClasses can be created using the IRelationshipClassContainer interface on the FeatureDataset Class.

The IRelationshipClass interface provides information about a relationship class, functionality to create and delete individual relationships, and methods to find related objects. The members of this interface can be split into three logical groups: the properties that correspond to how the relationship class was created, the object-to-object methods that deal with individual relationships, and lastly the relationship rules methods.

The OriginPrimaryKey, OriginForeignKey, DestinationPrimaryKey, and DestinationForeignKey properties can be somewhat confusing—their use is different depending on whether the relationship class is attributed.

The object-to-object methods such as GetObjectsRelatedToObjectSet make a lot of use of the ISet interface, which manipulates a set of generic objects. When adding objects to a set with a cursor, make sure that the cursor recycling is turned off

When using CreateRelationship, remember that this operation will write a value into the foreign key field. Therefore it is possible that you could overwrite, and therefore delete, an existing relationship. Similarly, DeleteRelationship will remove the foreign key value, so that field must allow null values unless you want to ensure that all objects in the class belong to relationships.

The IRelationshipClass::IsAttributed property will only return true if there are extra relationship attributes beyond those required to relate the objects. The IRelationshipClass::GetRelationship method is useful for accessing the relationship attributes.

See Also:
ISet

Method Summary
 void addRelationshipRule(IRule rule)
          Adds a relationship rule to this relationship class.
 IRelationship createRelationship(IObject originObject, IObject destinationObject)
          Creates a new relationship between the two specified objects.
 void deleteRelationship(IObject originObject, IObject destinationObject)
          Deletes the relationship that associates the two specified objects.
 void deleteRelationshipRule(IRule rule)
          Deletes a relationship rule from this relationship class.
 void deleteRelationshipsForObject(IObject anObject)
          Deletes all relationships that apply to a specified object.
 void deleteRelationshipsForObjectSet(ISet anObjectSet)
          Deletes all relationships that apply to the specified origin or destination object set.
 java.lang.String getBackwardPathLabel()
          The backward path label for the relationship class.
 int getCardinality()
          The cardinality for the relationship class.
 IObjectClass getDestinationClass()
          The destination object class.
 java.lang.String getDestinationForeignKey()
          The relationship destination foreign Key.
 java.lang.String getDestinationPrimaryKey()
          The relationship destination primary Key.
 IFeatureDataset getFeatureDataset()
          The feature dataset, if any, to which this relationship class belongs.
 java.lang.String getForwardPathLabel()
          The forward path label for the relationship class.
 int getNotification()
          The notification direction for the relationship class.
 IRelClassEnumRowPairs getObjectsMatchingObjectSet(ISet pSrcObjectSet)
          Gets rows pairs of objects that are related to the specified origin or destination object set.
 ISet getObjectsRelatedToObject(IObject anObject)
          Gets the objects that are related to the specified object.
 ISet getObjectsRelatedToObjectSet(ISet anObjectSet)
          Gets the objects that are related to the specified origin or destination object set.
 IObjectClass getOriginClass()
          The origin object class.
 java.lang.String getOriginForeignKey()
          The relationship origin foreign Key.
 java.lang.String getOriginPrimaryKey()
          The relationship origin primary Key.
 IRelationship getRelationship(IObject originObject, IObject destinationObject)
          Get the relationship that associates the two specified objects.
 int getRelationshipClassID()
          The relationship class ID.
 IEnumRule getRelationshipRules()
          The relationship rules that apply to this relationship class.
 IEnumRelationship getRelationshipsForObject(IObject anObject)
          Get all relationships that apply to a specified object.
 IEnumRelationship getRelationshipsForObjectSet(ISet anObjectSet)
          Get all relationships that apply to the specified origin or destination object set.
 boolean isAttributed()
          Indicates if the relationships in this relationship class have attributes.
 boolean isComposite()
          Indicates if the relationship class represents a composite relationship in which the origin object class represents the composite object.
 

Method Detail

getOriginPrimaryKey

public java.lang.String getOriginPrimaryKey()
                                     throws java.io.IOException,
                                            AutomationException
The relationship origin primary Key.

Supported Platforms

Windows, Solaris, Linux

Remarks

When using a relationship class, the OriginPrimaryKey property is used for returning a string containing the name of the origins primary key field.

Returns:
The relOrigPKey
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getDestinationPrimaryKey

public java.lang.String getDestinationPrimaryKey()
                                          throws java.io.IOException,
                                                 AutomationException
The relationship destination primary Key.

Supported Platforms

Windows, Solaris, Linux

Remarks

When using a relationship class, the DestinationPrimaryKey property is used for returning a string containing the name of the destination primary key field.

Returns:
The relDestPKey
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getOriginForeignKey

public java.lang.String getOriginForeignKey()
                                     throws java.io.IOException,
                                            AutomationException
The relationship origin foreign Key.

Supported Platforms

Windows, Solaris, Linux

Remarks

When using a relationship class, the OriginForeignKey property is used for returning a string containing the name of the origin foreign key field.

Returns:
The relOrigFKey
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getDestinationForeignKey

public java.lang.String getDestinationForeignKey()
                                          throws java.io.IOException,
                                                 AutomationException
The relationship destination foreign Key.

Supported Platforms

Windows, Solaris, Linux

Remarks

When using a relationship class, the DestinationForeignKey property is used for returning a string containing the name of the destination foreign key field.  This property is null except in the case of attributed relationship classes, in which case it is the name of a field in the relationship table.  The values in this field reference values in the field designated as the Destination PrimaryKey.

Returns:
The relDestFKey
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getRelationshipClassID

public int getRelationshipClassID()
                           throws java.io.IOException,
                                  AutomationException
The relationship class ID.

Supported Platforms

Windows, Solaris, Linux

Remarks

When using a relationship class, the RelationshipClassID property is used for returning a long variable type, containing the id of the relationship class with regard to the relationship class table. This long integer ID uniquely identifies a relationship class within its geodatabase relative to other relationship classes.  It is equivalent to IObjectClass::ObjectClassID except that it applies to relationship classes rather than object classes.

Returns:
The relClassId
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getOriginClass

public IObjectClass getOriginClass()
                            throws java.io.IOException,
                                   AutomationException
The origin object class.

Supported Platforms

Windows, Solaris, Linux

Remarks

When using a relationship class, the OriginClass property is used for returning an interface to the origin objectclass .

Returns:
A reference to a com.esri.arcgis.geodatabase.IObjectClass
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getDestinationClass

public IObjectClass getDestinationClass()
                                 throws java.io.IOException,
                                        AutomationException
The destination object class.

Supported Platforms

Windows, Solaris, Linux

Remarks

When using a relationship class, the DestinationClass property is used for returning an interface to the destination objectclass .

Returns:
A reference to a com.esri.arcgis.geodatabase.IObjectClass
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getFeatureDataset

public IFeatureDataset getFeatureDataset()
                                  throws java.io.IOException,
                                         AutomationException
The feature dataset, if any, to which this relationship class belongs.

Supported Platforms

Windows, Solaris, Linux

Remarks

When using a relationship class, the FeatureDataset property is used for returning an interface to the FeatureDataset that this relationship class belongs to, if there is one.  If there is not, the variable is set to Nothing.

Returns:
A reference to a com.esri.arcgis.geodatabase.IFeatureDataset
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getForwardPathLabel

public java.lang.String getForwardPathLabel()
                                     throws java.io.IOException,
                                            AutomationException
The forward path label for the relationship class.

Supported Platforms

Windows, Solaris, Linux

Remarks

When using a relationship class, the ForwardPathLabel property is used for returning string variable containing the path label for the forward direction path.  An example can be shown by using a relationship between a pump station and its pumps.  A forward path label may be something like "Contains".  It would be read as a pump station 'Contains' pumps.

Returns:
The forwardLabel
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getBackwardPathLabel

public java.lang.String getBackwardPathLabel()
                                      throws java.io.IOException,
                                             AutomationException
The backward path label for the relationship class.

Supported Platforms

Windows, Solaris, Linux

Remarks

When using a relationship class, the BackwardPathLabel property is used for returning string variable containing the path label for the backward direction path.  An example can be shown by using a relationship between a pump station and its pumps.  A backward path label may be something like "Contained by".  It would be read as a pump is 'Contained by' the pump station.

Returns:
The backwardLabel
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getCardinality

public int getCardinality()
                   throws java.io.IOException,
                          AutomationException
The cardinality for the relationship class.

Supported Platforms

Windows, Solaris, Linux

Remarks

When using a relationship class, the Cardinality property is used for returning a esriRelCardinality enumeration type.  It refers to the type of relationship formed between an origin class and a destination class.  It can be one of three types (1)esriRelCardinalityOneToOne (1-1), (2)esriRelCardinalityOneToMany (1-N), or (3)esriRelCardinalityManyToMany (M-N).

Returns:
A com.esri.arcgis.geodatabase.esriRelCardinality constant
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getNotification

public int getNotification()
                    throws java.io.IOException,
                           AutomationException
The notification direction for the relationship class.

Supported Platforms

Windows, Solaris, Linux

Remarks

When using a relationship class, the Notification property is used for returning a esriRelNotification enumeration type.  A notification occurs when an event, such as a deletion or an edit, happens.  It can be one of four types (1) esriReNotificationNone, (2) esriRelNotificationForward, (3) esriRelNotificationBackward, or (4) esriRelNotificationBoth.  None means no notification will take place, forward means that notification will happen from the origin to the destination.  Backward means notification is from the destination to the origin, and both means notification will happen both ways when an event on the relationship class occurs.

Returns:
A com.esri.arcgis.geodatabase.esriRelNotification constant
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isAttributed

public boolean isAttributed()
                     throws java.io.IOException,
                            AutomationException
Indicates if the relationships in this relationship class have attributes.

Returns:
The isAttributed
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isComposite

public boolean isComposite()
                    throws java.io.IOException,
                           AutomationException
Indicates if the relationship class represents a composite relationship in which the origin object class represents the composite object.

Returns:
The isComposite
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

createRelationship

public IRelationship createRelationship(IObject originObject,
                                        IObject destinationObject)
                                 throws java.io.IOException,
                                        AutomationException
Creates a new relationship between the two specified objects.

Supported Platforms

Windows, Solaris, Linux

Remarks

When using a relationship class, the CreateRelationship method is used for creating a relationship between the origin object and the destination object specified in the function parameters.  By default, when a relationship class is created, a relationship is created between the objects with corresponding primary and foreign key values.  When subsequently using CreateRelationship, remember that this operation will write a value into the foreign key field.  Therefore, in the case of 1:1 and 1:M relationship classes, it is possible that you could overwrite, and therefore delete, an existing relationship. 

Parameters:
originObject - A reference to a com.esri.arcgis.geodatabase.IObject (in)
destinationObject - A reference to a com.esri.arcgis.geodatabase.IObject (in)
Returns:
A reference to a com.esri.arcgis.geodatabase.IRelationship
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getRelationship

public IRelationship getRelationship(IObject originObject,
                                     IObject destinationObject)
                              throws java.io.IOException,
                                     AutomationException
Get the relationship that associates the two specified objects.

Supported Platforms

Windows, Solaris, Linux

Remarks

When using a relationship class, the GetRelationship method is used for returning a relationship interface to the relationship between the origin object and destination object specified in the function parameters.  This can be used to retrieve the relationship between two objects.

Parameters:
originObject - A reference to a com.esri.arcgis.geodatabase.IObject (in)
destinationObject - A reference to a com.esri.arcgis.geodatabase.IObject (in)
Returns:
A reference to a com.esri.arcgis.geodatabase.IRelationship
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

deleteRelationship

public void deleteRelationship(IObject originObject,
                               IObject destinationObject)
                        throws java.io.IOException,
                               AutomationException
Deletes the relationship that associates the two specified objects.

Supported Platforms

Windows, Solaris, Linux

Remarks

When using a relationship class, the DeleteRelationship method is used for deleting the relationship between the origin object and destination object specified in the function parameters.  This will remove the entry for this relationship from the relationship class.

Parameters:
originObject - A reference to a com.esri.arcgis.geodatabase.IObject (in)
destinationObject - A reference to a com.esri.arcgis.geodatabase.IObject (in)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getObjectsRelatedToObject

public ISet getObjectsRelatedToObject(IObject anObject)
                               throws java.io.IOException,
                                      AutomationException
Gets the objects that are related to the specified object.

Supported Platforms

Windows, Solaris, Linux

Remarks

When using a relationship class, the GetObjectsRelatedToObject method is used for returning an ISet interface to the objects related to the object specified in the function parameter.  An example of its use would be to retrieve the set of capitals related to a particular state.

Parameters:
anObject - A reference to a com.esri.arcgis.geodatabase.IObject (in)
Returns:
A reference to a com.esri.arcgis.system.ISet
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getRelationshipsForObject

public IEnumRelationship getRelationshipsForObject(IObject anObject)
                                            throws java.io.IOException,
                                                   AutomationException
Get all relationships that apply to a specified object.

Supported Platforms

Windows, Solaris, Linux

Remarks

The GetRelationshipsForObject method is used for returning an IEnumRelationship interface to the relationships of the specified relationship class.  An example of its use might be for the state of Arizona, to find all the relationships with its cities, in a 'StatesToCities' relationship class.

Parameters:
anObject - A reference to a com.esri.arcgis.geodatabase.IObject (in)
Returns:
A reference to a com.esri.arcgis.geodatabase.IEnumRelationship
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

deleteRelationshipsForObject

public void deleteRelationshipsForObject(IObject anObject)
                                  throws java.io.IOException,
                                         AutomationException
Deletes all relationships that apply to a specified object.

Supported Platforms

Windows, Solaris, Linux

Remarks

The DeleteRelationshipsForObject method is used for removing all of the relationships in the relationship class that the specified object belongs to.  An example of its use might be for the state of Arizona, to remove all the relationships with its cities, in a 'StatesToCities' relationship class. Note that this method is bi-directional; the specified object could belong to the origin class or destination class.

Parameters:
anObject - A reference to a com.esri.arcgis.geodatabase.IObject (in)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getObjectsRelatedToObjectSet

public ISet getObjectsRelatedToObjectSet(ISet anObjectSet)
                                  throws java.io.IOException,
                                         AutomationException
Gets the objects that are related to the specified origin or destination object set.

Supported Platforms

Windows, Solaris, Linux

Remarks

When using a relationship class, the GetObjectsRelatedToObjectSet method is used for returning an ISet interface that contains the objects that the objects specified in the function parameter is related to.  So for example this could be used to get all cities for all states.  Using a set which contained all 50 states as the function parameter you could use this method to get all of the cities related to all of the states.

Parameters:
anObjectSet - A reference to a com.esri.arcgis.system.ISet (in)
Returns:
A reference to a com.esri.arcgis.system.ISet
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getRelationshipsForObjectSet

public IEnumRelationship getRelationshipsForObjectSet(ISet anObjectSet)
                                               throws java.io.IOException,
                                                      AutomationException
Get all relationships that apply to the specified origin or destination object set.

Supported Platforms

Windows, Solaris, Linux

Remarks

The GetRelationshipsForObjectSet method is used for returning an IEnumRelationship interface that contains the relationships that the specified objects are in, for a particular relationship class.  An example of its use might be to get all of the relationships that all of the states belong to, for a 'StatesToCapitals' relationship class.

Parameters:
anObjectSet - A reference to a com.esri.arcgis.system.ISet (in)
Returns:
A reference to a com.esri.arcgis.geodatabase.IEnumRelationship
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getObjectsMatchingObjectSet

public IRelClassEnumRowPairs getObjectsMatchingObjectSet(ISet pSrcObjectSet)
                                                  throws java.io.IOException,
                                                         AutomationException
Gets rows pairs of objects that are related to the specified origin or destination object set.

Supported Platforms

Windows, Solaris, Linux

Remarks

The GetObjectsMatchingObjectSet method is used for returning a combined set of related object pairs, for all the relationships in a particular relationship class that the specified objects participate in..  For example, using a set of states as the funtion parameter, an IRelClassEnumRowPairs interface containing the states and the related capitals will be returned if using that relationship class.

Parameters:
pSrcObjectSet - A reference to a com.esri.arcgis.system.ISet (in)
Returns:
A reference to a com.esri.arcgis.geodatabase.IRelClassEnumRowPairs
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

deleteRelationshipsForObjectSet

public void deleteRelationshipsForObjectSet(ISet anObjectSet)
                                     throws java.io.IOException,
                                            AutomationException
Deletes all relationships that apply to the specified origin or destination object set.

Supported Platforms

Windows, Solaris, Linux

Remarks

The DeleteRelationshipsForObjectSet method is used for removing all relationships in a particular relationship class for the specified set of objects.  An example of its use might be to delete the relationships for all of the state objects with respect to a 'StatesToCities' relationship class.

This method works in the same way as the DeleteRelationshipsForObject method, except on a set of objects rather than a single one.

Parameters:
anObjectSet - A reference to a com.esri.arcgis.system.ISet (in)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getRelationshipRules

public IEnumRule getRelationshipRules()
                               throws java.io.IOException,
                                      AutomationException
The relationship rules that apply to this relationship class.

Supported Platforms

Windows, Solaris, Linux

Remarks

When using a relationship class, the RelationshipRules method is used for retrieving all of the relationship rules of this relationshipclass from the geodatabase.  Relationship classes can have an associated set of relationship rules.  These rules are used to 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 permissable subtype pairs.  An example would be the subtype wood poles may be allowed to have attached between 1 and 3 transformers, however, the subtype steel pole may be allowed to have attached between 1 and 5 transformers.  These are referred to as the cardinality range.

Returns:
A reference to a com.esri.arcgis.geodatabase.IEnumRule
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

addRelationshipRule

public void addRelationshipRule(IRule rule)
                         throws java.io.IOException,
                                AutomationException
Adds a relationship rule to this relationship class.

Supported Platforms

Windows, Solaris, Linux

Remarks

When using a relationship class, the AddRelationshipRule method is used for adding a new relationship rule to the geodatabase.  Relationship classes can have an associated set of relationship rules.  These rules are used to 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 permissable subtype pairs.  An example would be the subtype wood poles may be allowed to have attached between 1 and 3 transformers, however, the subtype steel pole may be allowed to have attached between 1 and 5 transformers.  These are referred to as the cardinality range.

Parameters:
rule - A reference to a com.esri.arcgis.geodatabase.IRule (in)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

deleteRelationshipRule

public void deleteRelationshipRule(IRule rule)
                            throws java.io.IOException,
                                   AutomationException
Deletes a relationship rule from this relationship class.

Supported Platforms

Windows, Solaris, Linux

Remarks

When using a relationship class, the DeleteRelationshipRule method is used for deleting a relationship rule from the geodatabase.  Relationship classes can have an associated set of relationship rules.  These rules are used to 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 permissable subtype pairs.  An example would be the subtype wood poles may be allowed to have attached between 1 and 3 transformers, however, the subtype steel pole may be allowed to have attached between 1 and 5 transformers.  These are referred to as the cardinality range.

Parameters:
rule - A reference to a com.esri.arcgis.geodatabase.IRule (in)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.