一、版本是什么?(
What is Version?
)
“版本”(
version
)是
ArcGIS
软件在多用户关系数据库基础上,依托
ArcSDE
服务而提供的长事务处理工具。在个人
geodatabase
中无法实现版本功能。
Versioning allows multiple users to edit spatial and tabular data simultaneously in a long transaction environment. Users can directly modify the database without having to extract data or lock features in advance. The object model provides functionality to create and administer versions, register and unregister classes as versioned, detect differences between versions, and reconcile and post versions.
Geodatabase
数据模型提供的版本化机制允许多用户在长事务处理环境中同时编辑空间和属性数据,用户无须预先数据复制和锁定要素就可以直接编辑。这一数据模型提供了诸如以下的功能:创建和管理版本、注册和不注册要素类、检测各个版本之间的差异、协调及提交版本。
二、怎样来理解版本?(
How to Understand Version?
)
版本是命了名字的
geodatabase
状态,你可以使用版本来模拟工程设计、建造工作、以及
geodatabase
的一个快照,还有任何类型的涉及正在进展的“
what if
”问题研究的流程。
版本跨越整个
geodatabase
并且拥有属性。在
ArcCatalog
中,你可以指定哪些对象在
geodatabase
中是版本化的,你可以选择性的指定哪些数据要素集、要素类还有表注册成为版本。通过设置权限你可以控制其它用户对你的数据的版本是否可见。
同一个
geodatabase
中允许多个版本的存在。
版本之间的本质区别在于行为状态而不是方案。版本创建之后,便呈现给你所有编辑工作的无中断视图。其中行的状态反应了所有的对象添加、删除以及修改操作。这些状态的变化都被保存在它的归档文件中。
每个版本
geodatabase
都有一个默认的(
default
)版本。默认版本实际是
geodatabase
本身。
三、版本与版本之间的关系
默认版本是所有版本的起始版本(
ancestor
)。除了默认版本,每个版本只能拥有一个父版本。在确保该版本的所有子版本被删除后,该版本可以被删除。
版本中的编辑变化可被协调并提交给另外一个版本。(这涉及到
geodatabase
复制,将另外专门讨论)
用户可以连接任意一个授权于他的版本。
四、
AE
提供的类图与接口

1
、
VersionedWorkspace
类及其接口:
A VersionedWorkspace is a Workspace that supports multiuser editing and multiple representations of features classes and tables in a relational database system. VersionedWorkspaces support the IVersionedWorkspace interface.
VersionedWorkspace
类是
Workspace
类的一个子类,在关系数据库系统中,它允许多用户编辑以及要素类及数据表多样化的表达。它向用户提供了
IVersionedWorkspace
接口。
A list of all versions to which the user has permissions can be retrieved using the
Versions property. The versions returned are either owned by the connected user or have public access.
通过
IVersionedWorkspace
接口提供的
Versions
的属性,用户可以得到授予他们访问权限的
VersionedWorkspace
中的所有版本。
通过
Versions
属性得到的对象是一个枚举型变量——
EnumVersionInfo
。
通过
IVersionedWorkspace
接口提供的
FindVersion
方法,用户可以通过版本名称进行查找而得到该版本。
The
IVersion interface is used to manage the properties of a version as well as create new versions. Creating a new version requires an existing version to be the parent of the new version. When the new version is created, the parent and child versions are identical
。
IVersion
接口向用户提供了创建及管理版本属性的功能。创建一个新版本要求一个已经存在的版本作为其父版本。当新版本被创建时,版本之间的关系(父与子)也就被确立了。
下面是更新版本属性的
C#
代码示例:
//
假设你已经得到
dataset
的引用
IVersion version = (IVersion)dataset.Workspace;
IVersionInfo versionInfo = version.VersionInfo;
if
(versionInfo.IsOwner)
{
version.Access = esriVersionAccess.esriVersionAccessPublic;
}
2
、
DataSet
类与
IVersionedObject
and
IVersionedObject2
接口:
通过
IVersionedOjbect
或
IVersionedObject2
接口提供的
RegisterAsVersioned
方法
,用户可以注册或不注册要素数据集或要素类为版本。如果注册为版本,则将在数据库中创建两个额外的表,以记录版本的行为状态发生的变化。
3
、
Table
类与
IVersionedTable
、
IConflictClass
接口
:
在进行协调操作之前,一般需要通过
IVersionedTabled
接口提供的
Differences
方法来检测源版本与目标版本之间存在的冲突。
经过协调(
Reconcile
)处理后,
IConflictClass
接口提供了得到冲突选择集的机制。通过其提供的
DeleteUpdate
、
UpdateDelete
、
UpdateUpdates
属性用户可以得到相应的
SelectionSet
。
参考文献:
[1]
《
Modeling Our World
》;
[2]
ArcGIS Developer Helper(ArcGIS
帮助文档
)
;