SQL Server 中地理数据库中数据集之间的关系
关系用于管理某个表中对象与另一表中对象之间的关联。在地理数据库中的表之间创建关系类有助于保持引用完整性,使您能够更高效地编辑和查询关联表。支持地理数据库中的表之间的以下关系类型:
- 空间关系 - 将要素与要素关联
- 非空间关系 - 将行与行关联
- 空间至非空间关系 - 将要素与行关联
正如要素存储在要素类中而非空间行存储在表中一样,关系在关系类中进行存储和管理。
有关关系和关系类表间关系的详细信息,请参阅关系类属性。
ArcGIS for Desktop 中的关系
在目录树中,关系类将显示为要素数据集的一部分。关系类将使用下方图标表示:
通过右键单击关系类,然后单击属性打开关系类属性 对话框来查看关系类的相关信息。
Microsoft SQL Server 数据库中的关系类
关系类存储在 GDB_ITEMS 和 GDB_ITEMRELATIONSHIPS 表中。
XML 文档中的关系类
关系类在 XML 文档中显示为数据元素类型。以下是 XML 文档的一部分,该文档来自一个包含关系类的数据集。
<DataElement xsi:type="esri:DERelationshipClass">
<CatalogPath>/V=sde.DEFAULT/FD=sde.RJP.Landbase_rel/RC=sde.RJP.prcl2bld</CatalogPath>
<Name>spdb.RJP.prcl2bld</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>APN</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>R249_SPDB_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_APN</Name>
<IsUnique>false</IsUnique>
<IsAscending>true</IsAscending>
<Fields xsi:type="esri:Fields">
<FieldArray xsi:type="esri:ArrayOfField">
<Field xsi:type="esri:Field">
<Name>APN</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_bldg_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>spdb.RJP.prcl2bld</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>spdb.RJP.Parcels_1</Name>
</OriginClassNames>
<DestinationClassNames xsi:type="esri:Names">
<Name>spdb.RJP.bldgs</Name>
</DestinationClassNames>
<KeyType>esriRelKeyTypeSingle</KeyType>
<ClassKey>esriRelClassKeyUndefined</ClassKey>
<ForwardPathLabel>spdb.RJP.bldgs</ForwardPathLabel>
<BackwardPathLabel>spdb.RJP.Parcels_1</BackwardPathLabel>
<IsReflexive>false</IsReflexive>
<OriginClassKeys xsi:type="esri:ArrayOfRelationshipClassKey">
<RelationshipClassKey xsi:type="esri:RelationshipClassKey">
<ObjectKeyName>APN</ObjectKeyName>
<ClassKeyName />
<KeyRole>esriRelKeyRoleOriginPrimary</KeyRole>
</RelationshipClassKey>
<RelationshipClassKey xsi:type="esri:RelationshipClassKey">
<ObjectKeyName>APN</ObjectKeyName>
<ClassKeyName />
<KeyRole>esriRelKeyRoleOriginForeign</KeyRole>
</RelationshipClassKey>
</OriginClassKeys>
<DestinationClassKeys xsi:type="esri:ArrayOfRelationshipClassKey">
<RelationshipClassKey xsi:type="esri:RelationshipClassKey">
<ObjectKeyName>BLDG_ID</ObjectKeyName>
<ClassKeyName />
<KeyRole>esriRelKeyRoleDestinationPrimary</KeyRole>
</RelationshipClassKey>
<RelationshipClassKey xsi:type="esri:RelationshipClassKey">
<ObjectKeyName>bldg_id</ObjectKeyName>
<ClassKeyName />
<KeyRole>esriRelKeyRoleDestinationForeign</KeyRole>
</RelationshipClassKey>
</DestinationClassKeys>
<RelationshipRules xsi:type="esri:ArrayOfRelationshipRule" />
</DataElement>
5/10/2014