CMDBuild Forum

How to model relation like this one?

Hi,

I have just started using cmdbuild in order to model overhead power line (https://upload.wikimedia.org/wikipedia/commons/thumb/b/bf/Overhead_power_lines_in_Dnipro%2C_Ukraine.jpg/344px-Overhead_power_lines_in_Dnipro%2C_Ukraine.jpg) that is consisted of many towers. Each tower is connected to the previous and next tower (except the first and the last towers that are connected to let’s say, power plants).

So I as far as I understand philosophy of the cmdbuild, I should create a class for overhead power line which will contain some general data about overhead power line as a whole (let’s say total distance), and a class for tower.

How to treat distance between two towers? From my point of view, I need something like 1:1 relation (tower : tower) that will be between two towers. This relationship shold hold a lenght of the cable.

It would be very nice if I can see this relation as a line on the graph. Something like this:

PWR_Plant – 100 m - T1 – 250 m – T2 – 300 m – T3 – 150 m – PWR_Plant

100, 250, 300 and 150 m are lenghts between towers (and power plants).

How to model this kind of relationship?

Best regards.

If I understand correctly from what you wrote, you do not need a 1:1 “domain” (type of relationship) between Tower and Tower, but an N:N “domain” between Tower and Tower.
This is because each Tower may have indicated the distance that separates it from all the other Towers (not just one).
On this “domain” you will then need to create a “Distance” attribute of type Decimal.

Hi. I am not sure what sentence “This is because each Tower may have indicated the distance that separates it from all the other Towers (not just one).” means.
Can you please clarify?

If I have three towers A, B and C, A is connected to B and B is connected to C:
A <–> B <–> C

Let’s say that we are talking about tower B.
Between A and B there is a cable. Would it be OK if we declare cable as a Class, and in this case have two cable class cards: AB and BC.
In this case AB cable card will have two children towers A and B, while BC tower will have two towers B and C.
In this case Tower B will be children of cable AB and children of cable BC.
I am not sure if such setup is allowed in CMDBuild.

Or it could be a domain that will have Distance attribute of type Decimal as you have suggested?

As you can see, I am a bit confused.
Please suggest the best practice how CMDBuild should be used in this case.

Best regards.

In your example Tower B has a cable connecting it to Tower A and a cable connecting it to Tower C. So tower B must have two relations (with A and C) and the domain cannot be 1:1.
In this case, a 1:N domain would be sufficient.
But if Tower C in turn were connected to two or more other Towers then the domain should be N:M.

Thanks for an explanation. It really helps.
Is there some material with cmdbuild best practices, or some examples of usage.
I am particularly interested how classes and relations are organized, some use cases with implementations steps in order to get the grip.

If something like this exists, please let me know.

No I’m sorry we don’t have material on best practice examples. However, you can study the data model of CMDBuild Ready2Use and openMAINT.