照会に対して概念エンティティーの 2 つのバージョンを返す、2 つのケースの完全な RegistryLookup ノード出力を示す例です。 両方のケースで、「マッチ・ポリシー」プロパティーは「すべて」に設定されています。 最初のケースでは、「深さのポリシー」プロパティーは「一致項目と直接の関連エンティティーを返す (深さ = 1)」に設定されており、2 番目のケースでは、「深さのポリシー」プロパティーは「一致項目だけを返し、直接の関係を表示する (互換性のため)」に設定されています。 この例には、出力のエレメントを読み取る ESQL の例も示されています。
この例は、WebSphere® Service Registry and Repository (WSRR) から ConceptA1 と呼ばれるエンティティーが検索された際に、LocalEnvironment 中に保管される ServiceRegistry メッセージ・ツリーを示します。 ConceptA1 は WSRR 中で 2 つのバージョンで定義されています。バージョン 1.0 は非推奨で、2.0 が初期状態と分類されます。 追加のプロパティーおよび関係がバージョン 2.0 に追加されています。 次の図は、メッセージ・ツリー中のエレメント間の関係を示しています。
次のメッセージ・ツリーは、「深さのポリシー」プロパティーの異なった値を示しています。
SET OutputRoot.XMLNSC.Result.ServiceRegistry =
InputLocalEnvironment.ServiceRegistry;
ServiceRegistry フォルダー・エレメントは XMLNSC パーサーが所有しているので、OutputRoot.XMLNSC への同種パーサー・ツリー・コピーを呼び出すことができます。 この出力ルート・ツリーを書き込む際に、以下のフォーマット済み XML が生成されます。<ServiceRegistry>
<Entity
bsrURI="33a9ad33-d4a4-442e.b3a6.37e62137a605"
name="ConceptA1"
namespace="http://www.examples.com/ConceptA1"
version="2.0"
description="A version 2 of the existing one"
owner="UNAUTHENTICATED"
lastModified="1230116323343"
creationTimestamp="1227176757406"
lastModifiedBy="UNAUTHENTICATED"
primaryType="">
<classificationURIs>
http://www.ibm.com/xmlns/prod/serviceregistry/6/0/governance/
DefaultLifecycle#InitialState0
</classificationURIs>
<classificationURIs>
http://www.ibm.com.policy/GovernancePolicyDomain
</classificationURIs>
<userDefinedProperties name="property1" value="value1 for v1" />
<userDefinedProperties name="property2" value="value1 for v2" />
<userDefinedProperties name="property3" value="value1 for v3" />
<userDefinedRelationships name="ContainsChildren">
<targetEntities>
<Entity
bsrURI="8203cb82-8827-4757.99e1.36de6036e1af"
name="ConceptB1"
namespace="http://www.examples.com/ConceptB1"
version="2.0"
description="Next revision of this concept"
owner="UNAUTHENTICATED"
lastModified="1227191748250"
creationTimestamp="1227177460156"
lastModifiedBy="UNAUTHENTICATED"
primaryType="" />
<Entity
bsrURI="a0d2bba0-f395-45bc.929e.04d143049eb5"
name="ConceptB2"
namespace="http://www.examples.com/ConceptB2" version="1.0"
description="Testing"
owner="UNAUTHENTICATED"
lastModified="1227191700812"
creationTimestamp="1227177334515"
lastModifiedBy="UNAUTHENTICATED"
primaryType="" />
</targetEntities>
</userDefinedRelationships>
<userDefinedRelationships name="ReferTo">
<targetEntities>
<Entity
bsrURI="81e45381-a9be-4ea4.9519.53657953196d"
name="ConceptC1"
namespace="http://www.examples.com/ConceptC1"
version="1.0"
description="Test stuff C1"
owner="UNAUTHENTICATED"
lastModified="1227874855140"
creationTimestamp="1227177519609"
lastModifiedBy="UNAUTHENTICATED" primaryType="" />
</targetEntities>
</userDefinedRelationships>
</Entity>
<Entity
bsrURI="b68952b6-8d68-4840.8e5e.a3716da35e2e"
name="ConceptA1"
namespace="http://www.examples.com/ConceptA1"
version="1.0"
description="The original concept"
owner="UNAUTHENTICATED"
lastModified="1229030287593"
creationTimestamp="1227173773250"
lastModifiedBy="UNAUTHENTICATED"
primaryType="">
<classificationURIs>
http://www.ibm.com/xmlns/prod/serviceregistry/6/0/governance/
DefaultLifecycle#Deprecate
</classificationURIs>
<userDefinedProperties name="property1" value="value1" />
<userDefinedProperties name="property2" value="value2" />
<userDefinedRelationships name="ContainsChildren">
<targetEntities>
<Entity
bsrURI="7d5fd37d-e90a-4ab0.89eb.d25b81d2ebec"
name="ConceptB1"
namespace="http://www.examples.com/ConceptB1" version="1.0"
description="" owner="UNAUTHENTICATED"
lastModified="1227874785062"
creationTimestamp="1227177401265"
lastModifiedBy="UNAUTHENTICATED"
primaryType="" />
<Entity
bsrURI="a0d2bba0-f395-45bc.929e.04d143049eb5"
name="ConceptB2"
namespace="http://www.examples.com/ConceptB2" version="1.0"
description="Testing" owner="UNAUTHENTICATED"
lastModified="1227191700812"
creationTimestamp="1227177334515"
lastModifiedBy="UNAUTHENTICATED"
primaryType="" />
</targetEntities>
</userDefinedRelationships>
</Entity>
</ServiceRegistry>
以下の ESQL は、「深さのポリシー」プロパティーが「一致項目と直接の関連エンティティーを返す (深さ = 1)」に設定されている場合に、LocalEnvironment 中の ServiceRegistry メッセージ・ツリーから値を検索する方法を示しています。
DECLARE c1 CHARACTER;
-- Following sets c1 to “ConceptA1” by indexing the first entity
SET c1 = InputLocalEnvironment.ServiceRegistry.Entity[1].name;
-- Following sets c1 to “2.0” by indexing the first entity
SET c1 = InputLocalEnvironment.ServiceRegistry.Entity[1].version;
-- Following sets c1 to “property1” by indexing the first
-- userDefinedProperties within the first entity
SET c1 = InputLocalEnvironment.ServiceRegistry.Entity[1].
userDefinedProperties[1].name;
-- Following sets c1 to “value1 for v2” by indexing the first
-- userDefinedProperties within the first entity
SET c1 = InputLocalEnvironment.ServiceRegistry.Entity[1].
userDefinedProperties[1].value;
DECLARE I INTEGER 1;
DECLARE J INTEGER;
SET J = CARDINALITY(InputLocalEnvironment.ServiceRegistry.Entity[]);
WHILE I < J DO
SET OutputRoot.XMLNS.ServiceRegistry.Entity[I] =
InputLocalEnvironment.ServiceRegistry.Entity[I];
SET I = I + 1;
END WHILE;
ServiceRegistry フォルダーが所有するパーサーを持っていないので、"" エレメントにナビゲートして、XMLNS の所有する出力ルート・ツリーへの同種パーサー・コピーを開始する必要があります。
この出力ルート・ツリーを書き込む際に、以下の XML が生成されます。<ServiceRegistry>
<Entity
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sdo="http://www.ibm.com/xmlns/prod/serviceregistry/6/0/sdo"
xsi:type="sdo:GenericObject"
bsrURI="33a9ad33-d4a4-442e.b3a6.37e62137a605"
name="ConceptA1"
namespace="http://www.examples.com/ConceptA1"
version="2.0"
description="A version 2 of the existing one"
owner="UNAUTHENTICATED"
lastModified="1229439847694"
creationTimestamp="1227176757406"
lastModifiedBy="UNAUTHENTICATED"
primaryType="">
<sdo:classificationURIs>
http://www.ibm.com/xmlns/prod/serviceregistry/6/0/governance/
DefaultLifecycle#InitialState0
</sdo:classificationURIs>
<sdo:classificationURIs>
http://www.ibm.com.policy/GovernancePolicyDomain
</sdo:classificationURIs>
<sdo:userDefinedRelationships
name="ContainsChildren"
targets="8203cb82-8827-4757.99e1.36de6036e1af
a0d2bba0-f395-45bc.929e.04d143049eb5" />
<sdo:userDefinedRelationships
name="ReferTo"
targets="81e45381-a9be-4ea4.9519.53657953196d" />
<sdo:userDefinedProperties name="property1" value="value1 for v2" />
<sdo:userDefinedProperties name="property2" value="value2 for v2" />
<sdo:userDefinedProperties name="property3" value="value3 for v2" />
<sdo:userDefinedProperties name="WSRRencoding" value="DEFAULT" />
</Entity>
<Entity>
<NS1:type
xmlns:NS1="http://www.w3.org/2001/XMLSchema-instance">
sdo:GenericObject
</NS1:type>
<bsrURI>b68952b6-8d68-4840.8e5e.a3716da35e2e</bsrURI>
<name>ConceptA1</name>
<namespace>http://www.examples.com/ConceptA1</namespace>
<version>1.0</version>
<description>The original concept</description>
<owner>UNAUTHENTICATED</owner>
<lastModified>1229030287593</lastModified>
<creationTimestamp>1227173773250</creationTimestamp>
<lastModifiedBy>UNAUTHENTICATED</lastModifiedBy>
<primaryType></primaryType>
<NS2:classificationURIs
xmlns:NS2="http://www.ibm.com/xmlns/prod/serviceregistry/6/0/sdo">
http://www.ibm.com/xmlns/prod/serviceregistry/6/0/governance/
DefaultLifecycle#Deprecate
</NS2:classificationURIs>
<NS3:userDefinedRelationships
xmlns:NS3="http://www.ibm.com/xmlns/prod/serviceregistry/6/0/sdo">
</NS3:userDefinedRelationships>
<NS4:userDefinedProperties
xmlns:NS4="http://www.ibm.com/xmlns/prod/serviceregistry/6/0/sdo">
</NS4:userDefinedProperties>
<NS5:userDefinedProperties
xmlns:NS5="http://www.ibm.com/xmlns/prod/serviceregistry/6/0/sdo">
</NS5:userDefinedProperties>
<NS6:userDefinedProperties
xmlns:NS6="http://www.ibm.com/xmlns/prod/serviceregistry/6/0/sdo">
</NS6:userDefinedProperties>
</Entity>
</ServiceRegistry>
以下の ESQL は、「深さのポリシー」プロパティーが「一致項目を返し、直接の関係を表示する (互換性のみのため)」に設定されている場合に、LocalEnvironment 中の ServiceRegistry メッセージ・ツリーから値を検索する方法を示しています。 このケースでは、ネーム・スペース修飾子の使用が必要であることに注意してください。
DECLARE ns1 NAMESPACE 'http://www.ibm.com/xmlns/prod/serviceregistry/6/0/sdo';
DECLARE c1 CHARACTER;
-- Following sets c1 to “ConceptA1” by indexing the first entity
SET c1 = InputLocalEnvironment.ServiceRegistry.Entity[1].name;
-- Following sets c1 to “2.0” by indexing the first entity
SET c1 = InputLocalEnvironment.ServiceRegistry.Entity[1].version;
-- Following sets c1 to “property1” by indexing the first
-- userDefinedProperties within the first entity
SET c1 = InputLocalEnvironment.ServiceRegistry.Entity[1].ns1:
userDefinedProperties[1].name;
-- Following sets c1 to “value1 for v2” by indexing the first
-- userDefinedProperties within the first entity
SET c1 = InputLocalEnvironment.ServiceRegistry.Entity[1].ns1:
userDefinedProperties[1].value;