Wall linked foundation

How do I recognize if the wall is linked to the foundation… let’s imagine that I have 10 unlinked walls and 2 linked walls, how do I classify them?.
ANY IDEA FOR GETTING STARTED WITH MY ROUTINE?

TANKS FRIENDS.

Get all wall foundations and use node GetHost . Extract element ID from the result and compare it to the IDs of all walls at the chosen level. Filter the walls, and you will find walls that have no foundation attached to them.

thank you
Even though the elements have the same category it does not work well, the wall that does work is created with revit and the wall that does not work is linked family as ifc format.
The IDs look different despite being from the same cement family.
I await your opinion, greetings from Peru.

Is the foundation below linked wall linked element or live element? Or is it vise versa? Or, are both wall and the foundation beneith it linked elements?

the elements under the wall if they are linked

Any idea on how to know which foundation is linked to the wall, but this time both the wall and the foundation are imported in IFC format… I imagine that for this reason it does not recognize the host element