How to navigate between connected parts with Automator?

Hey there,

currently I am investigating some design patterns I have in mind to model relationships between software and hardware components. The point is that an application could be deployed on different hardware, with identical or different configurations (and so on).

I wanted to understand whether Connections could be a useful tool for that, and what the benefits are. Unfortunately I fail to navigate the model with Automator.

I already achieved searching “Deploy” connections and then listing both ends, with some help from the thread Extracting Connections with Automator .

However it would be more practical to navigate the model in a “node-edge” fashion:

  1. select a part, e.g. software component “application1”
  2. find a certain owned_element, e.g. “deployed”
  3. find the info (attributes) in the “deploy” connection
  4. find the part “server1” in the end part hardware of that connection.

Is this possible? Any hints will be helpful.

Thanks,

Kai

My example

package example {

    part def Hardware {
        abstract ref part deploying : Software;
    }

    part def Software {
        ref part deployed : Hardware;
    }

    connection def Deploy {
        end part software : Software crosses hardware.deploying;
        end part hardware : Hardware crosses software.deployed;
        attribute description;
        attribute configuration;
    }

    part server1 : Hardware {
        doc locale "en_US"
        /* This is  server 1
        */
    }

    part application1 : Software;
        doc locale "en_US"
        /* This is application 1
        */

    connection deploy : Deploy connect application1 to server1;
}

Hi,

  • select a part, e.g. software component “application1”

There is no global map from unqualified names to elements. You will have to either navigate via a fully qualified name, or iterate through all elements searching for a match.

  • find a certain owned_element, e.g. “deployed”
  • find the info (attributes) in the “deploy” connection

Currently, there is no convenience function to find an inherited element with a given name. One alternative is to manually search through Type.heritage elements recursively.

  • find the part “server1” in the end part hardware of that connection.

End features are implicitly redefined by other end features in the declaration and inheritance order. So this would be the redefined feature of deploy.declaration_ends.elements[1]. The connection deploy : Deploy connect application1 to server1; does not in any way affect the structure of Deploy itself.