Example: Collections

This example illustrates how the BPM OData Service translates a collection into an own entity type in the EDM.

Sample XSD

<complexType name="customer">
 <sequence>
	<element name="name" type="string"></element> 
	<element name="address" type="tns:address"></element>
	<element name="phone-numbers" type="string" maxOccurs="unbounded" minOccurs="0"></element> 
	<element name="vcards" type="tns:vcard" maxOccurs="unbounded" minOccurs="0"></element>
 </sequence>

</complexType><complexType name="address"> 
 <sequence>
	<element name="street" type="string"></element> 
	<element name="city" type="string"></element> 
	<element name="zip" type= "string"></element> 
	<element name="country" type="string"></element>
 </sequence> 
</complexType> 

<complexType name="vcard"> 
 <sequence> 
	<element name="attr1" type="string"></element> 
	<element name="attr2" type="string"></element>
	<element name="attr3" type="string"></element> 
 </sequence>
</complexType>

Resulting EDM

<EntityType Name="customer">
	<Key><PropertyRef Name="EDM_Key"/></Key> 
	<Property Name="EDM_Key" Type="Edm.String" Nullable="false"/> 
	<Property Name="name" Type="Edm.String" Nullable="true"/> 
	<NavigationProperty Name="address" Relationship="BPMTaskData.customer_address" FromRole="customer" ToRole="address"/>
	<NavigationProperty Name="phone-numbers" Relationship="BPMTaskData.customer_phone-numbers" FromRole="customer" ToRole="phone-numbers"/> 
	<NavigationProperty Name="vcards" Relationship="BPMTaskData.customer_vcard" FromRole="customer" ToRole="vcard"/> 
</EntityType>

<!-- address -->
<EntityType Name="address"> 
	<Key><PropertyRef Name="EDM_Key"/></Key>
	<Property Name="EDM_Key" Type="Edm.String" Nullable="false"/> 
	<Property Name="street" Type="Edm.String" Nullable="true"/> 
	<Property Name="city" Type="Edm.String" Nullable="true"/> 
	<Property Name="zip" Type="Edm.String" Nullable="true"/> 
	<Property Name="country" Type="Edm.String" Nullable="true"/> 
</EntityType> 

<Association Name="customer_address">
	<End Type="BPMTaskData.customer" Multiplicity="1" Role="customer"/> 
	<End Type="BPMTaskData.address" Multiplicity="1" Role="address"/> 
</Association>

<!-- phone-numbers --> 
<EntityType Name="phone-numbers"> 
	<Key><PropertyRef Name="EDM_Key"/></Key> 
	<Property Name="EDM_Key" Type="Edm.String" Nullable="false"/>
	<Property Name="phone-numbers" Type="Edm.String" Nullable="true"/> 
</EntityType> 

<Association Name="customer_phone-numbers">
	<End Type="BPMTaskData.customer" Multiplicity="1" Role="customer"/>
	<End Type="BPMTaskData.phone-numbers" Multiplicity="*" Role="phone-numbers"/>
</Association>

<!-- vcard --> 
<EntityType Name="vcard">
	<Key><PropertyRef Name="EDM_Key"/></Key> 
	<Property Name="EDM_Key" Type="Edm.String" Nullable="false"/> 
	<Property Name="attr1" Type="Edm.String" Nullable="true"/> 
	<Property Name="attr2" Type="Edm.String" Nullable="true"/> 
	<Property Name="attr3" Type="Edm.String" Nullable="true"/> 
</EntityType> 

<Association Name="customer_vcard"> 
	<End Type="BPMTaskData.customer" Multiplicity="1" Role="customer"/> 
	<End Type="BPMTaskData.vcard" Multiplicity="*" Role="vcard"/> 
</Association>

Resulting Task Input Data

In the following, the task input data is simplified and shown in JavaScript Object Notation (JSON).

"customer": {
   "__metadata": {"type": "BPMTaskData.customer"},
   "EDM_Key":  "540ac92ff9b311e2a810000000288732_I_1",
   "name":  "John Doe",
   "address": {
     "__metadata": {"type": "BPMTaskData.address"},
     "EDM_Key":  "540ac92ff9b311e2a810000000288732_I_1_1",
     "street":  "Main St",
     "city":  "Springfield",
     "zip":  "19064",
     "country":  "US"
  },
   "phone-numbers": {
     "results": [
      {
         "__metadata": {"type": "BPMTaskData.phone-numbers"},
         "EDM_Key":  "540ac92ff9b311e2a810000000288732_I_1_2_1",
         "phone-numbers":  "-1"
      },
      {
         "__metadata": {"type": "BPMTaskData.phone-numbers"},
         "EDM_Key":  "540ac92ff9b311e2a810000000288732_I_1_2_2",
         "phone-numbers":  "2"
      },
      {
         "__metadata": {"type": "BPMTaskData.phone-numbers"},
         "EDM_Key":  "540ac92ff9b311e2a810000000288732_I_1_2_3",
         "phone-numbers":  "3"
      }
    ]
  },
   "vcards": {
     "results": [
      {
         "__metadata": {"type": "BPMTaskData.vcard"},
         "EDM_Key":  "540ac92ff9b311e2a810000000288732_I_1_3_1",
         "attr1":  "John
        Doe",
         "attr2":  "john.doe@provider.com",
         "attr3":  "john.doe"
      },
      {
         "__metadata": {"type": "BPMTaskData.vcard"},
         "EDM_Key":  "540ac92ff9b311e2a810000000288732_I_1_3_2",
         "attr1":  "Johnny",
         "attr2":  "johnny@provider.com",
         "attr3":  "johnny"
      },
      {
         "__metadata": {"type": "BPMTaskData.vcard"},
         "EDM_Key":  "540ac92ff9b311e2a810000000288732_I_1_3_3",
         "attr1":  "J. D.",
         "attr2":  "jd@provider.com",
         "attr3":  "jd"
      }
    ]
  }
}