Example showing the full RegistryLookup node output in two cases for a query that returns two versions of a concept entity. In both cases the Match Policy property is set to All. In the first case the Depth Policy property is set to Return matched plus immediate related entities (Depth = 1) , and in the second case the Depth Policy property is set to Return matched only, showing immediate relationships (For compatibility only). This example also shows example ESQL to read elements of the output.
This example shows the ServiceRegistry message tree that is stored in the LocalEnvironment when an entity called ConceptA1 is retrieved from WebSphere® Service Registry and Repository (WSRR). ConceptA1 is defined in WSRR with 2 versions: 1.0 which is deprecated, and 2.0 which is classified as initial state. Additional properties and relationships have been added to the 2.0 version. The following diagram shows the relationships between the elements in the message tree.
The following message trees show the different values of the Depth Policy property.
SET OutputRoot.XMLNSC.Result.ServiceRegistry =
InputLocalEnvironment.ServiceRegistry;
The ServiceRegistry
folder element is owned by the XMLNSC parser so you can invoke a like
parser tree copy to OutputRoot.XMLNSC. The following XML, which has
been formatted, is produced when writing this output root tree.<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>
The following ESQL shows how to retrieve the values from the ServiceRegistry message tree in the LocalEnvironment when the Depth Policy property is set to Return matched plus immediate related entities (Depth = 1).
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;
The ServiceRegistry folder does not have an
owning parser so you must navigate to the ""elements
and initiate a like-parser-copy to the XMLNS owned output root tree.
The following XML is produced when writing this output root tree.<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>
The following ESQL shows how to retrieve the values from the ServiceRegistry message tree in the LocalEnvironment when the Depth Policy property is set to Return matched showing immediate relationships (For compatibility only). Note that in this case it is necessary to use the namespace qualifier.
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;