PostgreSQL 地理数据库中数据集之间的关系

关系用于管理某个表中对象与另一表中对象之间的关联。在地理数据库中的表之间创建关系类有助于保持引用完整性,使您能够更高效地编辑和查询关联表。支持地理数据库中的表之间的以下关系类型:

正如要素存储在要素类中而非空间行存储在表中一样,关系在关系类中进行存储和管理。

有关关系和关系类表间关系的详细信息,请参阅关系类属性

ArcGIS for Desktop 中的关系类

在目录树中,关系类将显示为要素数据集的一部分。关系类将使用下方图标表示:

通过右键单击关系类,然后单击属性打开关系类属性 对话框来查看关系类的相关信息。

ArcCatalog 中的“关系类属性”对话框

要素关联的注记是一种关系类。在关系类属性 对话框中,可以看到 Distribmains 要素类参与了与 DistDiam 注记要素类之间的一对多关系。将基于 Distribmains 要素类中的 objectidDistDiam 要素类中的 featureid 来连接表中的记录。这是一个复合关系类,表示某个表中的更改会影响或修改关联表中的要素。在此情况下,对源类 (Distribmains) 所做的更改会导致目标要素类 (ud_reldestfc) 发生更改。这称为向前通知。

PostgreSQL 数据库中的关系类

关系类存储在 gdb_itemsgdb_itemrelationships 表中。

XML 工作空间文档中的关系类

关系类在 XML 文档中显示为数据元素类型。以下是 XML 文档的一部分,该文档来自一个包含关系类的数据集。

<DataElement xsi:type="esri:DERelationshipClass">
    <CatalogPath>/V=sde.DEFAULT/FD=m8db.hbear.Water/RC=m8db.hbear.Anno_19_72</CatalogPath> 
    <Name>m8db.hbear.Anno_19_72</Name> 
    <DatasetType>esriDTRelationshipClass</DatasetType> 
    <DSID>-1</DSID> 
    <Versioned>true</Versioned> 
    <CanVersion>true</CanVersion> 
    <HasOID>true</HasOID> 
    <OIDFieldName>RID</OIDFieldName> 
    <Fields xsi:type="esri:Fields">
      <FieldArray xsi:type="esri:ArrayOfField">
        <Field xsi:type="esri:Field">
          <Name>RID</Name> 
          <Type>esriFieldTypeOID</Type> 
          <IsNullable>false</IsNullable> 
          <Length>4</Length> 
          <Precision>10</Precision> 
          <Scale>0</Scale> 
          <Required>true</Required> 
          <Editable>false</Editable> 
        </Field>
        <Field xsi:type="esri:Field">
          <Name>Diameter</Name> 
          <Type>esriFieldTypeInteger</Type> 
          <IsNullable>true</IsNullable> 
          <Length>4</Length> 
          <Precision>10</Precision> 
          <Scale>0</Scale> 
        </Field>
        <Field xsi:type="esri:Field">
          <Name>bldg_id</Name> 
          <Type>esriFieldTypeInteger</Type> 
          <IsNullable>true</IsNullable> 
          <Length>4</Length> 
          <Precision>10</Precision> 
          <Scale>0</Scale> 
        </Field>
      </FieldArray>
    </Fields>
  <Indexes xsi:type="esri:Indexes">
    <IndexArray xsi:type="esri:ArrayOfIndex">
      <Index xsi:type="esri:Index">
        <Name>r206_sde_rowid_uk</Name> 
        <IsUnique>true</IsUnique> 
        <IsAscending>true</IsAscending> 
        <Fields xsi:type="esri:Fields">
          <FieldArray xsi:type="esri:ArrayOfField">
            <Field xsi:type="esri:Field">
              <Name>RID</Name> 
              <Type>esriFieldTypeOID</Type> 
              <IsNullable>false</IsNullable> 
              <Length>4</Length> 
              <Precision>10</Precision> 
              <Scale>0</Scale> 
              <Required>true</Required> 
              <Editable>false</Editable> 
            </Field>
          </FieldArray>
        </Fields>
      </Index>
    <Index xsi:type="esri:Index">
      <Name>GDB_9_Diam</Name> 
      <IsUnique>false</IsUnique> 
      <IsAscending>true</IsAscending> 
      <Fields xsi:type="esri:Fields">
        <FieldArray xsi:type="esri:ArrayOfField">
          <Field xsi:type="esri:Field">
            <Name>Diameter</Name> 
            <Type>esriFieldTypeInteger</Type> 
            <IsNullable>true</IsNullable> 
            <Length>4</Length> 
            <Precision>10</Precision> 
            <Scale>0</Scale> 
          </Field>
        </FieldArray>
      </Fields>
    </Index>
    <Index xsi:type="esri:Index">
      <Name>GDB_9_feature_id</Name> 
      <IsUnique>false</IsUnique> 
      <IsAscending>true</IsAscending> 
      <Fields xsi:type="esri:Fields">
        <FieldArray xsi:type="esri:ArrayOfField">
          <Field xsi:type="esri:Field">
            <Name>bldg_id</Name> 
            <Type>esriFieldTypeInteger</Type> 
            <IsNullable>true</IsNullable> 
            <Length>4</Length> 
            <Precision>10</Precision> 
            <Scale>0</Scale> 
          </Field>
        </FieldArray>
      </Fields>
    </Index>
  </IndexArray>
  </Indexes>
  <CLSID>{A07E9CB1-9A95-11D2-891A-0000F877762D}</CLSID> 
  <EXTCLSID /> 
  <RelationshipClassNames xsi:type="esri:Names" /> 
  <AliasName>m8db.hbear.Anno_19_72</AliasName> 
  <ModelName /> 
  <HasGlobalID>false</HasGlobalID> 
  <GlobalIDFieldName /> 
  <RasterFieldName /> 
  <ExtensionProperties xsi:type="esri:PropertySet">
    <PropertyArray xsi:type="esri:ArrayOfPropertySetProperty" /> 
  </ExtensionProperties>
  <ControllerMemberships xsi:type="esri:ArrayOfControllerMembership" /> 
  <Cardinality>esriRelCardinalityManyToMany</Cardinality> 
  <Notification>esriRelNotificationBoth</Notification> 
  <IsAttributed>true</IsAttributed> 
  <IsComposite>true</IsComposite> 
  <OriginClassNames xsi:type="esri:Names">
    <Name>m8db.hbear.Distribmains</Name> 
  </OriginClassNames>
  <DestinationClassNames xsi:type="esri:Names">
    <Name>m8db.hbear.DistDiam</Name> 
  </DestinationClassNames>
  <KeyType>esriRelKeyTypeSingle</KeyType> 
  <ClassKey>esriRelClassKeyUndefined</ClassKey> 
  <ForwardPathLabel>m8db.hbear.DistDiam</ForwardPathLabel> 
  <BackwardPathLabel>m8db.hbear.Distribmains</BackwardPathLabel> 
  <IsReflexive>false</IsReflexive> 
  <OriginClassKeys xsi:type="esri:ArrayOfRelationshipClassKey">
    <RelationshipClassKey xsi:type="esri:RelationshipClassKey">
      <ObjectKeyName>OBJECTID</ObjectKeyName> 
      <ClassKeyName /> 
      <KeyRole>esriRelKeyRoleOriginPrimary</KeyRole> 
    </RelationshipClassKey>
    <RelationshipClassKey xsi:type="esri:RelationshipClassKey">
      <ObjectKeyName>FeatureID</ObjectKeyName> 
      <ClassKeyName /> 
      <KeyRole>esriRelKeyRoleOriginForeign</KeyRole> 
    </RelationshipClassKey>
  </OriginClassKeys> 
  <DestinationClassKeys xsi:type="esri:ArrayOfRelationshipClassKey">
    <RelationshipClassKey xsi:type="esri:RelationshipClassKey">
      <ObjectKeyName>OBJECT_ID</ObjectKeyName> 
      <ClassKeyName /> 
      <KeyRole>esriRelKeyRoleDestinationPrimary</KeyRole> 
    </RelationshipClassKey>
    <RelationshipClassKey xsi:type="esri:RelationshipClassKey">
      <ObjectKeyName>Feature_ID</ObjectKeyName> 
      <ClassKeyName /> 
      <KeyRole>esriRelKeyRoleDestinationForeign</KeyRole> 
    </RelationshipClassKey>
  </DestinationClassKeys>
  <RelationshipRules xsi:type="esri:ArrayOfRelationshipRule" />
</DataElement>
9/15/2013