cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

How to design a model in thingworx to represent relationship between two things

Gavin2
8-Gravel

How to design a model in thingworx to represent relationship between two things

Hello all:
I want to know if there is a way to design a model in thingworx to represent relationship between two things

 

For example: I have a thing called order and a thing called car, When call service to query order information I also want to query the car information which belong to the order

 

Thanks!

3 REPLIES 3

Things can have properties that have a base type of Thingname. You can further restrict the value of a Thingname typed property by requiring the property be a Thing with a certain Thing Template or implement a certain Thing Shape.

 

For your example, a car purchase might be modeled using a Thing Template that you create called: "purchasedCar". When I buy a car, you create a Thing to represent it named AllenCar6712 using the purchaseCar Thing Template. You also create a Thing to represent the order that has a property named "carInfo" of type Thingname that can only be assigned Thingnames that are the purchasedCar type.

Hi,

 

Since your Order and Car are both Thing entities in ThingWorx, so structurally speaking(in TWX side), they are in the same level and the relationships are just information defined by Users, so you need to also create the relationship information and related services to represent the Map you wanted.

 

For example, you need to add an infotable property in Order Thing, and put all related Car information (at least Thing names) inside, and you'll add query services in Order to extract data from those Car Things.

 

To make the design easier, you can make the Order and Car Thing entities share a same Thing Template or Thing Shape, and you can use the shared property such as OrderNumber to track the correlation

slangley
23-Emerald II
(To:zyuan1)

Hi @Gavin2.

 

If one of the responses provided has answered your question, please mark it as the Accepted Solution, for the benefit of others who may have the same question.

 

Regards.

 

--Sharon

Top Tags