Hi Alex,
You may want to make use of the mendix SDK. Have you already looked into the documentation:
https://docs.mendix.com/apidocs-mxsdk/mxsdk/
https://docs.mendix.com/apidocs-mxsdk/mxsdk/mendix-metamodel/
https://docs.mendix.com/apidocs-mxsdk/mxsdk/finding-things-in-the-model/
As it is possible to generate complete models through the SDK, it must also be possible to answer your question from there.
Good luck!