...
- Simple Reference
- Smart Reference
Simple Reference
Simple reference is defined using name and type modifier. The data associations between two models is automatically done via SID.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<DataModel Name="VendorInfo">
<Sid Name="vendorId"/>
<String Name="vendorName"/>
<String Name="vendorCity"/>
<Reference cardinality="1..1" name="thingCat" type="ThingCategory"/>
</DataModel>
<DataModel Name="ThingCategory">
<Sid Name="thingCatID"/>
<String Name="catList" cardinality="1..n"/>
</DataModel>
<!-- Let's Create few Thing Categories. -->
<Query>
<DeleteAll>
<ThingCategory>
<thingCatID ne=""/>
</ThingCategory>
</DeleteAll>
<Create>
<ThingCategory>
<catList>
Sensors
</catList>
</ThingCategory>
</Create>
<Create>
<ThingCategory>
<catList>
Actuators
</catList>
</ThingCategory>
</Create>
<Create>
<ThingCategory>
<catList>
Sensors
</catList>
<catList>
Actuators
</catList>
<catList>
Gateways
</catList>
</ThingCategory>
</Create>
</Query>
<!-- Now create VendorInfo with ThingCategory SID Value -->
<Query>
<Create>
<VendorInfo>
<vendorId>
vendorA
</vendorId>
<vendorName>
Phidget
</vendorName>
<vendorCity>
Calgary
</vendorCity>
<thingCat>
LOBF4FOGAAAX6AAAAGEWWHEH
</thingCat>
</VendorInfo>
</Create>
</Query>
<!-- Let's do a Find on VendorInfo with nested * -->
<Query>
<Find format="all" nested="*">
<VendorInfo>
<vendorId ne=""/>
</VendorInfo>
</Find>
</Query> |