Opening Dictionary and Getting Data

Below is the example of using the OpenDim operation to open a repository dictionary. The request contains moniker of the object that is a dictionary and a pattern for getting information about dictionary structure and elements. The response contains moniker of opened dictionary and information about the structure and elements in accordance with the specified pattern.

The C# example uses the FindObjectById function, which code is given in the Getting Object Description by Its Identifier section.

SOAP request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<OpenDim xmlns="http://www.fsight.ru/PP.SOM.Som">
<tObject xmlns="">
  <id>S1!M!116</id>
  </tObject>
<tArg xmlns="">
  <openArgs />
<metaArg>
<pattern>
  <obInst>false</obInst>
  <getDescr>true</getDescr>
  <getAttrs>true</getAttrs>
  </pattern>
<elsArg>
<pattern>
  <attributes>*</attributes>
  <getParentKey>true</getParentKey>
  <getImageIndex>true</getImageIndex>
  </pattern>
  </elsArg>
  </metaArg>
  </tArg>
  </OpenDim>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<OpenDimResult xmlns="http://www.fsight.ru/PP.SOM.Som" xmlns:q1="http://www.fsight.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<id xmlns="">
  <id>S1!M!S!S3</id>
  </id>
<meta xmlns="">
<id>
  <id>S1!M!S!S3</id>
  </id>
<data>
<descr>
  <k>116</k>
  <id>DIM_1</id>
  <n>Dim_1</n>
  <vis>1</vis>
<cls>
  <k>1025</k>
  </cls>
  </descr>
<attrs>
<it>
  <k>117</k>
  <id>NAME</id>
  <n>Name</n>
  <vis>1</vis>
  <dt>1</dt>
  <predefined>Name</predefined>
  <dataDomain>0</dataDomain>
  <nullable>1</nullable>
  <hasHierarchy>0</hasHierarchy>
  </it>
<it>
  <k>118</k>
  <id>ID</id>
  <n>Identifier</n>
  <vis>1</vis>
  <dt>2</dt>
  <uniqueIndex>INDEX1</uniqueIndex>
  <predefined>Ident</predefined>
  <dataDomain>0</dataDomain>
  <nullable>1</nullable>
  <hasHierarchy>0</hasHierarchy>
  </it>
<it>
  <k>119</k>
  <id>ORDER</id>
  <n>Order</n>
  <vis>1</vis>
  <dt>2</dt>
  <predefined>Order</predefined>
  <dataDomain>0</dataDomain>
  <nullable>1</nullable>
  <hasHierarchy>0</hasHierarchy>
  </it>
<it>
  <k>122</k>
  <id>PARENT</id>
  <n>Parent</n>
  <vis>1</vis>
  <dt>2</dt>
  <dataDomain>0</dataDomain>
  <nullable>1</nullable>
  <hasHierarchy>0</hasHierarchy>
  </it>
<it>
  <k>177</k>
  <id>CODE</id>
  <n>Code</n>
  <vis>1</vis>
  <dt>1</dt>
  <dataDomain>0</dataDomain>
  <nullable>1</nullable>
  <hasHierarchy>0</hasHierarchy>
  </it>
  <ident>1</ident>
  <name>0</name>
  <order>2</order>
  </attrs>
  </data>
<els>
<els>
<e>
  <n>Item 1</n>
<a>
  <it>First element</it>
  <it>1</it>
  <it>1</it>
  <it>0</it>
  <it>A000123</it>
  </a>
<ea>
  <it v="First element" />
  <it v="1" />
  <it v="1" />
  <it v="0" />
  <it v="A000123" />
  </ea>
  <k>1</k>
  <h>1</h>
  <o>0</o>
  </e>
<e>
  <n>Item 2</n>
<a>
  <it>Second element</it>
  <it>2</it>
  <it>2</it>
  <it>1</it>
  <it>A000124</it>
  </a>
<ea>
  <it v="Second element" />
  <it v="2" />
  <it v="2" />
  <it v="1" />
  <it v="A000124" />
  </ea>
  <k>2</k>
  <h>1</h>
  <o>1</o>
  <p>1</p>
  </e>
<e>
  <n>Item 3</n>
<a>
  <it>Third element</it>
  <it>3</it>
  <it>3</it>
  <it>2</it>
  <it>A000125</it>
  </a>
<ea>
  <it v="Third element" />
  <it v="3" />
  <it v="3" />
  <it v="2" />
  <it v="A000125" />
  </ea>
  <k>3</k>
  <h>0</h>
  <o>2</o>
  <p>2</p>
  </e>
<e>
  <n>Item 4</n>
<a>
  <it>Fourth element</it>
  <it>4</it>
  <it>4</it>
  <it>0</it>
  <it>A000126</it>
  </a>
<ea>
  <it v="Fourth element" />
  <it v="4" />
  <it v="4" />
  <it v="0" />
  <it v="A000126" />
  </ea>
  <k>4</k>
  <h>0</h>
  <o>0</o>
  </e>
<e>
  <n>Fifth element</n>
<a>
  <it>Fifth element</it>
  <it>5</it>
  <it>5</it>
  <it>0</it>
  <it>A000127</it>
  </a>
<ea>
  <it v="Fifth element" />
  <it v="5" />
  <it v="5" />
  <it v="0" />
  <it v="A000127" />
  </ea>
  <k>5</k>
  <h>0</h>
  <o>0</o>
  </e>
  </els>
<id>
  <id>S1!M!S!S3</id>
  </id>
  </els>
  </meta>
  </OpenDimResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"OpenDim" :
{
"tObject" :
{
"id" : "S1!M!116"
},
"tArg" :
{
"openArgs" : "",
"metaArg" :
{
"pattern" :
{
"obInst" : "false",
"getDescr" : "true",
"getAttrs" : "true"
},
"elsArg" :
{
"pattern" :
{
"attributes" : "*",
"getParentKey" : "true",
"getImageIndex" : "true"
}
}
}
}
}
}

JSON response:

{
"OpenDimResult" :
{
"id" :
{
"id" : "S1!M!S!S3"
},
"meta" :
{
"id" :
{
"id" : "S1!M!S!S3"
},
"data" :
{
"descr" :
{
"k" : "116",
"id" : "DIM_1",
"n" : "Dim_1",
"vis" : "1",
"cls" :
{
"k" : "1025"
}
},
"attrs" :
{
"it" :
[
{
"k" : "117",
"id" : "NAME",
"n" : "Name",
"vis" : "1",
"dt" : "1",
"predefined" : "Name",
"dataDomain" : "0",
"nullable" : "1",
"hasHierarchy" : "0"
},
{
"k" : "118",
"id" : "ID",
"n" : "Identifier",
"vis" : "1",
"dt" : "2",
"uniqueIndex" : "INDEX1",
"predefined" : "Ident",
"dataDomain" : "0",
"nullable" : "1",
"hasHierarchy" : "0"
},
{
"k" : "119",
"id" : "ORDER",
"n" : "Order",
"vis" : "1",
"dt" : "2",
"predefined" : "Order",
"dataDomain" : "0",
"nullable" : "1",
"hasHierarchy" : "0"
},
{
"k" : "122",
"id" : "PARENT",
"n" : "Parent",
"vis" : "1",
"dt" : "2",
"dataDomain" : "0",
"nullable" : "1",
"hasHierarchy" : "0"
},
{
"k" : "177",
"id" : "CODE",
"n" : "Code",
"vis" : "1",
"dt" : "1",
"dataDomain" : "0",
"nullable" : "1",
"hasHierarchy" : "0"
}
],
"ident" : "1",
"name" : "0",
"order" : "2"
}
},
"els" :
{
"els" :
{
"e" :
[
{
"n" : "First element",
"a" :
{
"it" :
[
"First element",
"1",
"1",
"0",
"A000123"
]
},
"ea" :
{
"it" :
[
{
"@v" : "First element"
},
{
"@v" : "1"
},
{
"@v" : "1"
},
{
"@v" : "0"
},
{
"@v" : "A000123"
}
]
},
"k" : "1",
"h" : "1",
"o" : "0"
},
{
"n" : "Second element",
"a" :
{
"it" :
[
"Second element",
"2",
"2",
"1",
"A000124"
]
},
"ea" :
{
"it" :
[
{
"@v" : "Second element"
},
{
"@v" : "2"
},
{
"@v" : "2"
},
{
"@v" : "1"
},
{
"@v" : "A000124"
}
]
},
"k" : "2",
"h" : "1",
"o" : "1",
"p" : "1"
},
{
"n" : "Third element",
"a" :
{
"it" :
[
"Third element",
"3",
"3",
"2",
"A000125"
]
},
"ea" :
{
"it" :
[
{
"@v" : "Third element"
},
{
"@v" : "3"
},
{
"@v" : "3"
},
{
"@v" : "2"
},
{
"@v" : "A000125"
}
]
},
"k" : "3",
"h" : "0",
"o" : "2",
"p" : "2"
},
{
"n" : "Fourth element",
"a" :
{
"it" :
[
"Fourth element",
"4",
"4",
"0",
"A000126"
]
},
"ea" :
{
"it" :
[
{
"@v" : "Fourth element"
},
{
"@v" : "4"
},
{
"@v" : "4"
},
{
"@v" : "0"
},
{
"@v" : "A000126"
}
]
},
"k" : "4",
"h" : "0",
"o" : "0"
},
{
"n" : "Fifth element",
"a" :
{
"it" :
[
"Fifth element",
"5",
"5",
"0",
"A000127"
]
},
"ea" :
{
"it" :
[
{
"@v" : "Fifth element"
},
{
"@v" : "5"
},
{
"@v" : "5"
},
{
"@v" : "0"
},
{
"@v" : "A000127"
}
]
},
"k" : "5",
"h" : "0",
"o" : "0"
}
]
},
"id" :
{
"id" : "S1!M!S!S3"
}
}
}
}
}
public static OpenDimResult OpenDimensionEx(MbId mb, string id)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tOpen = new OpenDim()
{
tArg = new OpenDimArg()
{
metaArg = new GetDimMetadataArg()
{
elsArg = new GetDimElementsArg()
{
pattern = new ElsPattern()
{
attributes = "*",
getParentKey = true
}
},
pattern = new DmMetadataPattern()
{
getAttrs = true,
getDescr = true,
obInst = false
}
},
openArgs = new DmOpenArgs()
},
tObject = new OdId() { id = mb.id + "!" + FindObjectById(mb, id).k }
};
//Open dictionary and getting metadata
var tResult = somClient.OpenDim(tOpen);
return tResult;
}

See also:

OpenDim: Operation