Open ZTY-star opened 4 years ago
Hi ZTY-star, You can not define the foreign keys in IDL files. But you can use the foreign key concepts in your applications.
Hi ZTY-star, You can not define the foreign keys in IDL files. But you can use the foreign key concepts in your applications.
Sorry, I do n’t understand. Can you give an example?
To understand relationship in DDS you need to understand following concepts: Distributed Relational Information Modeling – Topic Keys can be used to identify instances as well as relationships – Relationships can be navigated by relying on a subset of SQL – One-to-many relationships can be captured using foreign keys – Many-to-many relationships need to be modeled using a topics – Keys can be represented by an arbitrary number of Topic fields
Suppose you have 3 topics named Floor,Room and TempSensor. Topics types are given below: Floor has a primary key fID. Room has a primary key rID and attribute fID is a foreign key. same in TempSensor, tID is a primary key and attribute rID acts as a foreign key.
struct Floor { short fID; short level; short open; };
struct Room { int rID; float width; float height; float length; short fId; // Foreign Key };
struct TempSensor
{
short tID;
float temp;
float huminity;
int rID; // Foreign Key
};
Now you need to maintain these relationship in your applications means you need to validate the received data as per the dependency and process accordingly.
How are foreign keys defined in IDL? What does it do?