关系类属性

摘要

Describe 函数可返回关系类的以下属性。同时还支持 GDB 表属性表属性数据集属性

关系类可返回 "RelationshipClass"dataType

属性

属性说明数据类型
backwardPathLabel
(只读)

关系类的后向路径标注。

String
cardinality
(只读)

关系类的基数。

  • OneToOne
  • OneToMany
  • ManyToMany
String
classKey
(只读)

关系类的类键。

  • Undefined
  • ClassID
  • ClassCode
String
destinationClassKeys
(只读)

包含对象关键名称和关键角色的元组列表(DestinationPrimaryDestinationForeign)。

tuple
destinationClassNames
(只读)

包含各目标类名称的列表。

String
forwardPathLabel
(只读)

关系类的前向路径标注。

String
isAttachmentRelationship
(只读)

指示关系类是否体现表附件。

Boolean
isAttributed
(只读)

指示此关系类中的关系是否含有属性。

Boolean
isComposite
(只读)

指示关系类是否表示复合关系,即源对象类表示复合对象。

Boolean
isReflexive
(只读)

指示源集与目标集是否相交。

Boolean
keyType
(只读)

关系类的键类型。

  • Single
  • Dual
String
notification
(只读)

关系类的通知方向。

  • None
  • Forward
  • Backward
  • Both
String
originClassNames
(只读)

包含各源类名称的列表。

String
originClassKeys
(只读)

包含对象关键名称和关键角色的元组列表(OriginPrimaryOriginForeign)。

tuple
relationshipRules
(只读)

列出适用于此关系类的关系规则属性的关系规则对象的列表。

Object
splitPolicy
(只读)

为关系类设置的分割策略。

  • DuplicateRelatedObjects
  • UseDefault
String

代码示例

关系类属性示例(独立脚本)

以下独立脚本显示关系类的属性。

import arcpy

# Create a Describe object
#
desc = arcpy.Describe("C:/data/moad.gdb/West/bapCompAttRel")

# Print relationship class properties
#
print ("Backward Path Label: {}".format(desc.backwardPathLabel))
print ("Cardinality: {}".format(desc.cardinality))
print ("Class key: {}".format(desc.classKey))
print ("Destination Class Names: {}".format(desc.destinationClassNames))
print ("Forward Path Label: {}".format(desc.forwardPathLabel)) 
print ("Is Attributed: {}".format(desc.isAttributed))
print ("Is Composite: {}".format(desc.isComposite)) 
print ("Is Reflexive: {}".format(desc.isReflexive))
print ("Key Type: {}".format(desc.keyType))
print ("Notification Direction: {}".format(desc.notification))
print ("Origin Class Names: {}".format(desc.originClassNames))

在本主题中