Skip to main content

关系类属性

汇总

Describe 函数可返回关系类的以下属性。 还支持 地理数据库表 、 表 和 数据集 属性组。

对于关系类, Describe dataType 属性将返回值 "RelationshipClass" 的值。

属性

属性 说明 数据类型

backwardPathLabel

(只读)

关系类的后向路径标注。

String

cardinality

(只读)

关系类的基数。

  • OneToOne

  • OneToMany

  • ManyToMany

String

classKey

(只读)

用于关系类的类键。

  • Undefined

  • ClassID

  • ClassCode

String

destinationClassKeys

(只读)

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

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

(只读)

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

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))