Domains in a geodatabase in SQL Server
Domains in a geodatabase in SQL Server
|
Release 9.3 |
|
Note:This topic was updated for 9.3.1.
Domains are rules applied to a field in a business table. They enforce data integrity by allowing only those values specified for the domain to be entered into the field. Domains are defined for the geodatabase and can be applied to multiple feature classes, tables, or subtypes.
There are two types of domains you can define—range domains and coded domains. Range domains can only be applied to numeric fields. For an explanation of domains, see An overview of attribute domains.
Domains in ArcCatalog
The domains for a geodatabase are accessed in ArcCatalog by way of the database Properties dialog box. Right-click the geodatabase and click Properties.
In the example above, the list of all the domains defined for a geodatabase are listed at the top of the dialog box. The FittingType domain is selected in the list. The Domain Properties and Coded Values shown pertain to this selected domain. As shown in the Domain Properties, the FittingType domain is a coded domain.
When a domain is applied to a subtype, it will be listed in the Subtype tab of the feature class properties dialog box. Right-click the feature class and click Properties.
The FittingType domain is being applied to the SUB_TYPE field of the Fittings feature class.
When you edit the attributes of the Fittings feature class in ArcMap, you will only be able to enter one of the codes specified for the FittingType domain in the SUB_TYPE field.
Domains in a SQL Server DBMS
In the database, domains are stored in the system tables GDB_DOMAINS. Coded domains are tracked in the GDB_CODEDDOMAINS system table, and range domains are tracked in the GDB_RANGEDOMAINS system table.
The GDB_FIELDINFO system table stores one record for every field in every user-defined table in the geodatabase. This table also stores the name of the domain (if any) that is associated with each field.
The GDB_ATTRULES table stores the name of a field, the name of the domain associated with that field, the subtype code for the feature class, and the rule ID.
The following are the domain system tables. The dashed lines indicate an implicit relationship between tables.
Domains in an XML workspace document
Domains in XML workspace documents are enclosed with a Domain tag.
The lines in an XML workspace document for the FittingType domain are as follows:
<Domain xsi:type="esri:CodedValueDomain">
<DomainName>FittingType</DomainName>
<FieldType>esriFieldTypeString</FieldType>
<MergePolicy>esriMPTDefaultValue</MergePolicy>
<SplitPolicy>esriSPTDuplicate</SplitPolicy>
<Description>Valid fitting type codes</Description>
<Owner>RJP</Owner>
<CodedValues xsi:type="esri:ArrayOfCodedValue">
<CodedValue xsi:type="esri:CodedValue">
<Name>Tee</Name>
<Code xsi:type="xs:string">TEE</Code>
</CodedValue>
<CodedValue xsi:type="esri:CodedValue">
<Name>Sleeve</Name>
<Code xsi:type="xs:string">SLV</Code>
</CodedValue>
<CodedValue xsi:type="esri:CodedValue">
<Name>Reduser</Name>
<Code xsi:type="xs:string">RED</Code>
</CodedValue>
<CodedValue xsi:type="esri:CodedValue">
<Name>Expansion joint</Name>
<Code xsi:type="xs:string">EOP</Code>
</CodedValue>
<CodedValue xsi:type="esri:CodedValue">
<Name>Cross</Name>
<Code xsi:type="xs:string">CRS</Code>
</CodedValue>
<CodedValue xsi:type="esri:CodedValue">
<Name>Bend</Name>
<Code xsi:type="xs:string">BEND</Code>
</CodedValue>
<CodedValue xsi:type="esri:CodedValue">
<Name>Cap</Name>
<Code xsi:type="xs:string">CAP</Code>
</CodedValue>
<CodedValue xsi:type="esri:CodedValue">
<Name>Coupling</Name>
<Code xsi:type="xs:string">CPL</Code>
</CodedValue>
<CodedValue xsi:type="esri:CodedValue">
<Name>Offset</Name>
<Code xsi:type="xs:string">OFF</Code>
</CodedValue>
<CodedValue xsi:type="esri:CodedValue">
<Name>Plug</Name>
<Code xsi:type="xs:string">PLG</Code>
</CodedValue>
<CodedValue xsi:type="esri:CodedValue">
<Name>Saddle</Name>
<Code xsi:type="xs:string">SDL</Code>
</CodedValue>
<CodedValue xsi:type="esri:CodedValue">
<Name>Tap</Name>
<Code xsi:type="xs:string">TAP</Code>
</CodedValue>
<CodedValue xsi:type="esri:CodedValue">
<Name>Weld</Name>
<Code xsi:type="xs:string">WLD</Code>
</CodedValue>
<CodedValue xsi:type="esri:CodedValue">
<Name>Riser</Name>
<Code xsi:type="xs:string">RIS</Code>
</CodedValue>
</CodedValues>
</Domain>
The FittingType domain is a coded domain. The entries for a range domain called RotAngle in an XML workspace document are shown below:
<Domain xsi:type="esri:RangeDomain">
<DomainName>RotAngle</DomainName>
<FieldType>esriFieldTypeInteger</FieldType>
<MergePolicy>esriMPTDefaultValue</MergePolicy>
<SplitPolicy>esriSPTDuplicate</SplitPolicy>
<Description>Valid rotation angles</Description>
<Owner>RJP</Owner>
<MaxValue xsi:type="xs:double">359</MaxValue>
<MinValue xsi:type="xs:double">0</MinValue>
</Domain>