cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Query on a recursive metaclass

acanicio
Super Contributor

Hello,

 

What

is the correct way to write a query that implies a recursive metaclass ?
By recursive, I mean a metaclass that has a metaassociation with itself, in a father->son scheme.

Here is a part of the class diagram :
Diagramme Recursivite.jpg

 

 

Here is what part of the diagram looks like.
The links for the servers correspond to the DSI_A_Materiel_Parent metaassociation.

Ferme et serveurs.jpg

 

The top computer is an instance from metaclass "DSI_Ferme".
The bottom computers are instances from metaclass "DSI_Serveur".
They both inherit from abstract metaclasses DSI_A_Ordinateur who in turn inherits from DSI_A_Materiel.

 

The printer is an instance from metaclass "DSI_Imprimante", who inherits also from DSI_A_Materiel.

 

Now for the DSI_Ferme metaclass I need to write a query that can give all the servers (only the servers) that are attached to it.

For each server I need a query that tells me who its father is.
In the query assistant I cannot find the abstract class in order to use the recursive metaassociation so I find myself stuck in any way...

 

When I try the following query (all servers that have a father) :
<<

Select [DSI_Serveur] Where [DSI_Ferme].[Nom] Is Not null

>>

It returns nothing.
Of course, the interpreter cannot find out whether I'm looking for sons or for a father...

Is there a (simple) way ?

Thank you
Best regards
Axel

2 Replies

pvandeginste
Honored Contributor

Hi Axel,

 

In this case, wouldn't the query be: Select [DSI_Serveur] where [DSI_A_Materiel_Parent]:[DSI_Ferme] not null"?

 

Philippe

hsoegaard
MEGA Partner
MEGA Partner

Hi,

 

It should be possible to use the "Deeply" functionality in the query, eg.  Select [Organizational Process] Into @aggbusp Where [Owner Organizational Process] Deeply in @topbusp