您的位置:首页 > 其它

基于Geodatabase数据模型的版本机制

2007-04-13 17:25 441 查看

基于Geodatabase数据模型的版本机制

一、版本是什么?(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) [/code]
{

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帮助文档);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: