Hi,
I use CMDBuild V2.4.3 and tried to design the following data model:
- Create a central class information which is referenced by all other classes (Application, Server, Cluster, Desktop, ...)
- Create superclass which should contain the reference to the information class and is the basis for the other classes above
- Create a domain from the superclass to the central class (cardinality 0,1:n)
- Edit the superclass and insert the reference to the information class
Steps 1 to 3 were made successfully. Step 4 isn't possible. I see the domain of step 3 in the domain tab of the superclass but I cannot choose it while inserting the new reference field.
Is it the wrong way to create the data model? Is there another way to spare the insertion of the refrence to the information class in every other class?
Many thanks for your efforts
Uwe
If the domain between the central class and the superclass is of type 1:N it’s strange that it does not work.
In
our data models it is normal to have a 1:N domain from a class to a
superclass, to define a reference attribute on the superclass, and then
to create some subclasses by inheriting the reference attribute.
You
can see an example like this in the simplified demo of CMDBuild, with
the Supplier class, the superclass Asset with the reference to Supplier,
and the subclasses PC, Monitor, Printer, etc.
I
recommend cleaning the server-side cache using the Setup => Server
Management => Clear cache function in the Administration Module.
If, on the
other hand, the domain between the central class and the superclass
is of the N:1 type, it is normal that the reference attribute
(conceptually corresponds to a Foreign Key) must be on the N side class,
therefore not on the superclass but on the central class.
CMDBuild Team
Hi CMDBuild Team,
thank you for your quick reply. The way you described I can understand. But in the creation process I want to:
- Create one of the other classes (basis from superclass) and
- Optionally create an information (class) if necessary.
I thought that if I use cardinality 1:N I could insert the reference on the 1 side so that it is possible to create a N side element via "1 side - reference field - domain - N side".
Is something like this possible?
Thanks
Uwe
If you create a domain with cardinality 1:N, the reference attribute must be in the N-side class, and indicate which is the only parent of that card.
It’s exactly as if you in a relational database create a Foreign Key column.
CMDBuild introduced the Reference attribute only because Postgres does not support Foreign Key inheritance.
CMDBuild Team