15

XML for Analysis(XMLA)开发详解-(6)Discover方法解析

Discover方法解析及示例

XMLA的Discover方法的命令很多,每个命令所附带的属性及参数也很复杂,如果逐条去掌握的话比较费力,本文主要以构建任务一中的多维数据库结构(见图1)及任务二中的Cube结构(见图2)为例介绍常用的命令及属性。这两个处理流程已经包含了基本的处理过程,更复杂的要求可以根据需要对之调整即可。

在介绍过程中,仅给出XMLA封包中的命令部分,外围的SOAP及HTTP封包(参见上一节)基本相同(除非打算在SOAP封包中显式控制SESSION及事务处理)不再重复给出。

注1由于没有特别指定SESSION及事务,因此,下面的示例每个步骤都是独立的,可以单独请求获取对应信息;

注2:本节Discover命令可通过Execute命令配合MDX语句实现类似效果。

注3本文的所有命令都是在SSAS2008下调试通过,使用的是微软提供的SSAS2008示例数据库(版本:Refresh1)Adventure Works DW 2008(http://www.codeplex.com/MSFTDBProdSamples/Release/ProjectReleases.aspx?ReleaseId=18407);

任务一:构建多维数据库结构

图1:

o_clip_image002_thumb_633616865909776624

步骤示例:

Step1获取服务器或 Web 服务上可用的 XML for Analysis (XMLA) 访问接口数据源的列表;

DISCOVER_DATASOURCES

返回结果

<Discover xmlns=”urn:schemas-microsoft-com:xml-analysis” SOAP-ENV:encodingStyle=”http://schemas.xmlsoap.org/soap/encoding/”>

<RequestType>DISCOVER_DATASOURCES</RequestType>

<Restrictions>

<RestrictionList>

</RestrictionList>

</Restrictions>

<Properties>

<PropertyList>

<Content>Data</Content>

</PropertyList>

</Properties>

</Discover>

行集:包含了可用数据源DataSource的名称、属性、支持特性等。

Step2返回指定数据源所对应的数据库中的目录(Catalog)列表;

DBSCHEMA_CATALOGS

返回结果

<Discover xmlns=”urn:schemas-microsoft-com:xml-analysis”

SOAP-ENV:encodingStyle=”http://schemas.xmlsoap.org/soap/encoding/”>

<RequestType>DBSCHEMA_CATALOGS</RequestType>

<Restrictions>

<RestrictionList>

</RestrictionList>

</Restrictions>

<Properties>

<PropertyList>

<DataSourceInfo>http://www.JBean.cn</DataSourceInfo>

<Content>Data</Content>

</PropertyList>

</Properties>

</Discover>

行集:获取上一步返回的数据源JBean 中的目录(Catalog)的名称、描述、访问控制列表ACL等信息。

Step3返回指定数据源、Catalog下多维数据集(CUBE)列表;

MDSCHEMA_CUBES

返回结果

<Discover xmlns=”urn:schemas-microsoft-com:xml-analysis”

SOAP-ENV:encodingStyle=”http://schemas.xmlsoap.org/soap/encoding/”>

<RequestType>MDSCHEMA_CUBES</RequestType>

<Restrictions>

<RestrictionList>

</RestrictionList>

</Restrictions>

<Properties>

<PropertyList>

<DataSourceInfo>http://www.JBean.cn</DataSourceInfo>

<Catalog>Adventure Works DW 2008</Catalog>

<Format>Tabular</Format>

<Content>SchemaData</Content>

</PropertyList>

</Properties>

</Discover>

行集:返回指定数据源(JBean)、Catalog(Adventure Works DW 2008)下的CUBE列表;

任务二:构建多维数据库结构

接下来介绍的是获取一个CUBE(这里是任务一最后一步获取的Adventure Works多维数据集)的维度、层次及成员结构所需的基本步骤。

如下图2所示,我们将展开‘Adventure WorksCube的维度,并展开其Sale Channel维度的层级直到该维的成员一级。

o_clip_image004_thumb_633616865935869539

步骤示例:

Step1获取指定CUBE的维度(Dimension)列表;

MDSCHEMA_DIMENSIONS

返回结果

<Discover xmlns=”urn:schemas-microsoft-com:xml-analysis”

SOAP-ENV:encodingStyle=”http://schemas.xmlsoap.org/soap/encoding/”>

<RequestType>MDSCHEMA_DIMENSIONS</RequestType>

<Restrictions>

<RestrictionList>

<CATALOG_NAME>Adventure Works DW 2008</CATALOG_NAME>

<CUBE_NAME>Adventure Works</CUBE_NAME>

</RestrictionList>

</Restrictions>

<Properties>

<PropertyList>

<DataSourceInfo>http://www.JBean.cn</DataSourceInfo>

<Catalog>Adventure Works DW 2008</Catalog>

<Format>Tabular</Format>

<Content>SchemaData</Content>

</PropertyList>

</Properties>

</Discover>

行集:返回指定数据源(JBean)及Catalog(Adventure Works DW 2008)下的CUBE(Adventure Works)的所有维度列表;

Step2获取指定维度(Dimension)的默认层次(Level)列表;

MDSCHEMA_DIMENSIONS

返回结果

<Discover xmlns=”urn:schemas-microsoft-com:xml-analysis”

SOAP-ENV:encodingStyle=”http://schemas.xmlsoap.org/soap/encoding/”>

<RequestType>MDSCHEMA_LEVELS</RequestType>

<Restrictions>

<RestrictionList>

<CATALOG_NAME>Adventure Works DW 2008</CATALOG_NAME>

<CUBE_NAME>Adventure Works</CUBE_NAME>

<DIMENSION_UNIQUE_NAME>[Sales Channel]</DIMENSION_UNIQUE_NAME>

</RestrictionList>

</Restrictions>

<Properties>

<PropertyList>

<DataSourceInfo>http://www.JBean.cn</DataSourceInfo>

<Catalog>Adventure Works DW 2008</Catalog>

<Format>Tabular</Format>

<Content>SchemaData</Content>

</PropertyList>

</Properties>

</Discover>

行集:返回指定数据源(JBean)、Catalog(Adventure Works DW 2008)、CUBE(Adventure Works)下的维度(Sales Channel)的所有层次列表;

Step3获取指定层次(Level)下的成员(Member)列表;

MDSCHEMA_MEMBERS

返回结果

<Discover xmlns=”urn:schemas-microsoft-com:xml-analysis”

SOAP-ENV:encodingStyle=”http://schemas.xmlsoap.org/soap/encoding/”>

<RequestType>MDSCHEMA_MEMBERS</RequestType>

<Restrictions>

<RestrictionList>

<CATALOG_NAME>Adventure Works DW 2008</CATALOG_NAME>

<CUBE_NAME>Adventure Works</CUBE_NAME>

<LEVEL_UNIQUE_NAME>[Sales Channel].[Sales Channel].[(All)]</LEVEL_UNIQUE_NAME>

</RestrictionList>

</Restrictions>

<Properties>

<PropertyList>

<DataSourceInfo>http://www.JBean.cn</DataSourceInfo>

<Catalog>Adventure Works DW 2008</Catalog>

<Format>Tabular</Format>

<Content>SchemaData</Content>

</PropertyList>

</Properties>

</Discover>

行集:返回维度sale Channel的指定层次(All)下的成员列表;

VN:F [1.9.13_1145]
Rating: 10.0/10 (1 vote cast)
XML for Analysis(XMLA)开发详解-(6)Discover方法解析, 10.0 out of 10 based on 1 rating

相关文章:

  1. XML for Analysis(XMLA)开发详解-(5)XMLA请求的格式及实例示意
  2. XML for Analysis(XMLA)开发详解-(7)XMLA Execute方法解析及实例
  3. XML for Analysis(XMLA)开发详解-(2)XMLA介绍
  4. XML for Analysis(XMLA)开发详解-(1)内容简介及目录
  5. XML for Analysis(XMLA)开发详解-(4)XMLA over TCP/IP访问Analysis Services 2005/2008 Olap的释疑

当前没有评论!

第一个在本文留言。

发表评论

名字(必须)
邮箱(必须),(永不被公布)
网址(建议)

字体为 粗体 是必填项目,邮箱地址 永远不会 公布。

允许部分 HTML 代码:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
URLs(网站链接)必须完整有效 (比如: http://www.bi-professional.com),所有标签都必须完整的关闭。

超出部分系统将会自动分段及换行。

请保证评论内容是与日志或 Blog 内容相关的,灌水、攻击性或不恰当的评论 可能 会被编辑或删除。