Exemplo mostrando a saída do nó RegistryLookup completa nos dois casos para uma consulta que retorna duas versões de uma entidade de conceito. Em ambos os casos a propriedade Política de Correspondência é configurada como Todos. No primeiro caso, a propriedade Política de Profundidade é configurada como Retornar entidades correspondidas mais entidades relacionadas imediatas (Profundidade = 1) e, no segundo caso, a propriedade Política de Profundidade é configurada como Retornar somente correspondência, mostrando relacionamentos imediatos (Apenas para compatibilidade). Este exemplo também mostra ESQL de exemplo para ler elementos da saída.
Este exemplo mostra a árvore de mensagens ServiceRegistry que é armazenada em LocalEnvironment quando uma entidade chamada ConceptA1 é recuperada do WebSphere Service Registry and Repository (WSRR). ConceptA1 é definido no WSRR com 2 versões: 1.0 que está reprovada e 2.0 que está classificada como estado inicial. Propriedades e relacionamentos adicionais foram incluídos na versão 2.0. O diagrama a seguir mostra os relacionamentos entre os elementos na árvore de mensagens.
As árvores de mensagens a seguir mostram os diferentes valores da propriedade Política de Profundidade.
SET OutputRoot.XMLNSC.Result.ServiceRegistry =
InputLocalEnvironment.ServiceRegistry;
O elemento da pasta ServiceRegistry
pertence ao analisador XMLNSC, portanto, você pode invocar uma cópia
de árvore do analisador semelhante para OutputRoot.XMLNSC. O XML a seguir, que foi
formatado, é produzido ao gravar esta árvore de raiz de saída.<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>
A ESQL a seguir mostra como recuperar os valores da árvore de mensagens ServiceRegistry em LocalEnvironment quando a propriedade Política de Profundidade é configurada como Retornar entidades correspondidas mais entidades relacionadas imediatas (Profundidade = 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;
A pasta ServiceRegistry não possui um
analisador próprio, portanto, é necessário navegar até os elementos ""
e iniciar uma cópia de analisador semelhante para a árvore de raiz de saída
pertencente a XMLNS.
O XML a seguir é produzido ao gravar esta árvore
de raiz de saída.<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>
A ESQL a seguir mostra como recuperar os valores da árvore de mensagens ServiceRegistry em LocalEnvironment quando a propriedade Política de Profundidade é configurada como Retornar correspondência mostrando relacionamentos imediatos (Apenas para compatibilidade). Observe que, neste caso, é necessário usar o qualificador de espaço de nomes.
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;