...
CherryPicked attributes are defined as type of Attribute. The value is defined as the name of an attribute from another model. For example, <Attribute name="SensorVendorSysId" value="VendorInfo.VendorSysId"/>.
In this example the DataModel SensorVendorInfo contains SensorVendorSysId, SensorVendorName defined and available in from DataMdoel VendorInfo.
Code Block |
---|
language | xml |
---|
title | Unique Constraint Violation Error |
---|
linenumbers | true |
---|
|
<DataModel#
DataModel(Name=: "VendorInfo">):
<Sid name=Sid(Name: "VendorSysId"/>)
<String name=String(Name: "VendorName"/>)
<String name=String(Name: "VendorTitle"/>)
<PostalAddress name=PostalAddress(Name: "VendorAddress"/>)
<String Name=String(Name: "DeviceTypes", Cardinality=: "0..m"/>)
<Unique Name=Unique(Name: "UniqueVendorName", Value=: "VendorName"/>
</DataModel>
<DataModel name=)
DataModel(Name: "SensorVendorInfo">):
<Attribute name=Attribute(Name: "SensorVendorSysId", value=: "VendorInfo.VendorSysId"/>)
<Attribute name=Attribute(Name: "SensorVendorName", value=: "VendorInfo.VendorName"/>
</DataModel>) |
Once VendorInfo Data is created using Create TQL Query. The SensorVendorInfo will automatically have the Data as well.
...
Code Block |
---|
language | xml |
---|
title | Create Vendor Info |
---|
linenumbers | true |
---|
|
<Query>#
Query:
<Create> Create:
<VendorInfo> VendorInfo:
<vendorName>Phidget</vendorName> vendorName: Phidget
<vendorTitle>Sensor Provider</vendorTitle> vendorTitle: "Sensor Provider"
<vendorAddress> vendorAddress:
<Street>123 TQL Way</Street> Street: "123 TQL Way"
<City>Sunnyvale</City> City: Sunnyvale
<Zipcode>91234</Zipcode> Zipcode: 91234
</vendorAddress> DeviceTypes: <DeviceTypes>Sensors</DeviceTypes>Sensors
<DeviceTypes>Actuators</DeviceTypes>
</VendorInfo>
</Create>
</Query>DeviceTypes: Actuators |
Query SensorVendorInfo DataModel
Code Block |
---|
language | xml |
---|
title | Find on DataModel with Cherry picked Attributes |
---|
linenumbers | true |
---|
|
<Query>#
Query:
<Find> Find:
<SensorVendorInfo> SensorVendorInfo:
<SensorVendorSysId SensorVendorSysId(ne=""/>
</SensorVendorInfo>
</Find>
</Query>: "") |
SensorVendorInfo Find Result Contains data created in VendorInfo DataModel.
Code Block |
---|
language | xml |
---|
title | Find Result of DataModel with Cherry picked Attributes |
---|
linenumbers | true |
---|
|
<Find#
Find(Status="Success">):
<Result>Result:
<SensorVendorInfo>SensorVendorInfo:
<SensorVendorSysId>chag3vw7tcet7dvg2athubjwl2gvth73</SensorVendorSysId>SensorVendorSysId: chag3vw7tcet7dvg2athubjwl2gvth73
<SensorVendorName>Phidget</SensorVendorName> </SensorVendorInfo>
</Result>
</Find>SensorVendorName: Phidget |
Note that Data can be created in opposite direction as well i.e. Once created in SensorVendorInfo the common attributes will be available in VendorInfo as well.
Code Block |
---|
language | xml |
---|
title | Create SensorVendor Info |
---|
linenumbers | true |
---|
|
<Create>#
Create:
<SensorVendorInfo> SensorVendorInfo:
<SensorVendorName>Phidget2</SensorVendorName> SensorVendorName: Phidget2
</SensorVendorInfo>
</Create>
<!-- # Lets Find from VendorInfo
-->Find:
<Find> VendorInfo:
<VendorInfo> <VendorName ne=VendorName(ne: ""/>)
</VendorInfo> </Find> <!--
Here#Here is Find Result
-->
<Find Status=Find(Status: "Success">):
<Result>Result:
<VendorInfo>VendorInfo:
<VendorSysId>KP3XJHCLAAAAUAABBN4HSJE7</VendorSysId>VendorSysId: KP3XJHCLAAAAUAABBN4HSJE7
<VendorName>Phidget2</VendorName> VendorName: Phidget2
</VendorInfo>Result:
</Result> VendorInfo:
<Result> <VendorInfo> VendorSysId: chag3vw7tcet7dvg2athubjwl2gvth73
<VendorSysId>chag3vw7tcet7dvg2athubjwl2gvth73</VendorSysId> DeviceTypes: Sensors
<DeviceTypes>Sensors</DeviceTypes> DeviceTypes: Actuators
<DeviceTypes>Actuators</DeviceTypes> VendorAddress:
<VendorAddress> City: Sunnyvale:
<City>Sunnyvale</City> Street: <Street>123"123 TQL Way</Street>Way"
<Zipcode>91234</Zipcode>Zipcode: 91234 </VendorAddress>
<VendorTitle>Sensor Provider</VendorTitle>
VendorTitle: "Sensor Provider"
<VendorName>Phidget</VendorName> </VendorInfo>
</Result>
</Find>VendorName: Phidget |
DataModel by picking Attributes from other defined DataModel + newly defined Attributes
...
Code Block |
---|
language | xml |
---|
title | Cherry picked DataModel |
---|
linenumbers | true |
---|
|
<DataModel#
DataModel(Name=: "VendorInfo">):
<Sid name=Sid(Name: "VendorSysId"/>")
<String name=String(Name: "VendorName"/>")
<String name=String(Name: "VendorTitle""/>)
<PostalAddress name=PostalAddress(Name: "VendorAddress"/>")
<String String(Name=: "DeviceTypes", Cardinality=: "0..m"/>")
<Unique Unique(Name=: "UniqueVendorName", Value=: "VendorName"/>
</DataModel>
<DataModel name=")
DataModel(Name: "SensorVendorInfo">):
<Attribute name=Attribute(Name: "SensorVendorSysId", value=: "VendorInfo.VendorSysId""/>)
<Attribute name=Attribute(Name: "SensorVendorName", value=: "VendorInfo.VendorName""/>)
<String String(Name=: "SensorTypes, Cardinality=: "0..m""/>) </DataModel> |
Let's create SensorVendorInfo now using Create TQL Query:
Code Block |
---|
language | xml |
---|
title | Create DataModel from Cherry picked Attributes |
---|
linenumbers | true |
---|
|
<Query>#
Query:
<Create> Create:
SensorVendorInfo:
<SensorVendorInfo> SensorVendorName: <SensorVendorName>Phidget</SensorVendorName>Phidget
<SensorVendorTitle>Sensor Provider</SensorVendorTitle>
SensorVendorTitle: "Sensor Provider"
<SensorTypes>Temperature</SensorTypes> SensorTypes: Temperature
<SensorTypes>Light</SensorTypes> </SensorVendorInfo>
</Create>
</Query>SensorTypes: Light |
Let's do a Find on VendorInfo. We get the VendorInfo and VendorTitle data back.
Code Block |
---|
language | xml |
---|
title | Find VendorInfo |
---|
linenumbers | true |
---|
|
<Query>#
Query:
<Find> Find:
<VendorInfo> VendorInfo:
<vendorSysId vendorSysId(ne=""/>
</VendorInfo>
</Find>
</Query>: "") |
Find VendorInfo Result
Code Block |
---|
language | xml |
---|
title | Find VendorInfo Result |
---|
linenumbers | true |
---|
|
<Find#
Find(Status=: "Success">):
<Result>Result:
<VendorInfo>VendorInfo:
<VendorSysId>KNTR2FJXAAAAUAABA5OUP375</VendorSysId>VendorSysId: KNTR2FJXAAAAUAABA5OUP375
<VendorName>Phidget</VendorName> </VendorInfo>
</Result>
</Find>VendorName: Phidget |
Selective Cherry picking using Constraint
...
Code Block |
---|
language | xml |
---|
title | Find VendorInfo Result |
---|
linenumbers | true |
---|
|
<DataModel#
DataModel(name=: "SensorVendorInfo">):
<Attribute name=Attribute(name: "SensorVendorSysId", value=: "VendorInfo.VendorSysId"/>)
<Attribute name=Attribute(name: "SensorVendorName", value=: "VendorInfo.VendorName"/>)
<String Name=String(name: "SensorTypes", Cardinality=: "0..m"/>)
<Constraint target=Constraint(target: "VendorInfo.DeviceTypes", eq=: "lit.Sensor"/>
</DataModel>) |