...
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.
Note that Data can be create in opposite direction as well i.e. Once created in SensorVendorInfo the common attributes will be available in VendorInfo as well.
Create VendorInfo Data:
Code Block |
---|
language | xml |
---|
title | Unique Constraint Violation ErrorCreate 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:
SensorVendorInfo:
SensorVendorSysId: chag3vw7tcet7dvg2athubjwl2gvth73
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:
SensorVendorInfo:
SensorVendorName: Phidget2
# Lets Find from VendorInfo
Find:
VendorInfo:
VendorName(ne: "")
#Here is Find Result
Find(Status: "Success">
<Result>"):
Result:
VendorInfo:
VendorSysId: KP3XJHCLAAAAUAABBN4HSJE7
VendorName: Phidget2
Result:
VendorInfo:
VendorSysId: chag3vw7tcet7dvg2athubjwl2gvth73
DeviceTypes: Sensors
DeviceTypes: Actuators
VendorAddress:
City: Sunnyvale:
Street: "123 TQL Way"
Zipcode: <SensorVendorInfo>91234
<SensorVendorSysId>chag3vw7tcet7dvg2athubjwl2gvth73</SensorVendorSysId> <SensorVendorName>Phidget</SensorVendorName>
VendorTitle: "Sensor Provider"
</SensorVendorInfo> </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>) |