Showing results for 
Search instead for 
Did you mean: 

Query on a recursive metaclass


Query on a recursive metaclass




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

2 Replies
MEGA Partner

Re: Query on a recursive metaclass



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 

Frequent Contributor

Re: Query on a recursive metaclass

Hi Axel,


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