Be Advised: Classified, FOUO, and PII Content is Not Permitted

How to show usage in an instance table?

Assumptions for this example:

Model has two classes: Car and Tire

Car has a property "Tires" of type Tire [1..*] (i.e. car has 1 or more instances of objects of type Tire)

Model has multiple instances of cars and tires.

 

I want to create an instance table (built in diagram type) that shows all the instances of type Tire and have one of the columns in that table be the instance of the car that uses each tire in its "Tires" property. Basically it would let me see all the tires and also see which cars use that tire (by "use" I don't mean the "usage" relationship, I mean use that tire instance as a value).

I have found how to add derived properties and can easily add columns for properties of objects that the tires own, but I can't find a way to go up the chain of composition.

The closest I have come to doing this is adding a new derived column under "simple navigation", select the "instance" criterion with "target to source" as the direction. The problem with doing that is the column returns the list of every class that the tire instance is used and doesn't let me filter by only objects of type Car. i.e. if a tire instance was also used as a property of another object, all the parent objects show up. I only want parent objects of a particular class (Car) that use that instance of the tire in the Instance table.

Seems like it should be easy but I'm obviously missing something...

  • See the below project for a table I would recommend using to show decomposition of system parts. Change txt extension to mdzip.

     

    car instances.txt

  • Thanks Justin! Really appreciate you showing this example. This is close, but I think there's a difference in what I'm asking about. What I need is an instance list of all the tires with cars, where in your example it is an instance list of all the cars with their tires. I need it that way because there is need to see all tire instances regardless if they are used on a car or not...kind of like a LEFT JOIN from SQ, a list of every tire instance and a column to show the car(s) it is used on _if_ the tire happens to be used by a car.

    Also, I'm using classes rather than blocks....I don't think that matters in solving this problem since it's all dealing with instance diagrams.
  • Do you really mean instances or usages as type? I tend not to use instances since defining the classes/blocks and part properties has been enough for my work.

    The thing I think you want is a metachain of "typed element of type." You could also make a table of part properties with Name, Type, Owner, Multiplicity that may do what you want.
  • I do mean instances. I appreciate what you mention, I've also built models where the class definitions were enough. In this case we are actually using instances (in object diagrams) to model how the execution manifests in the real world. Of course it isn't really cars & tires, that was just my analogous example, but it does capture what I'm trying to do. I played with the metachain and also thought that should work, but kept striking out finding a way to connect from the tire to the car. For example, picking "InstanceSpecification" on the metaclass and using the property of "Usage" or "_elementValueOfElement" or "_instanceValueOfInstance" doesn't produce any results. I'll admit I'm stabbing in the dark with how to use the metachain navigation though.
  • It is not as easy as you would think.  Instances in UML are a little wierd, but with the right query operations, it is possible.  Make sure your Expression builder is in Expert mode.

    First, You really need to understand how instance specifications work within the language.  Specifically Section 9.8

    Instance Specifications are "instances" of InstanceValues.

    InstanceValues are "value" of Slots.

    Slots have "owningInstances".

    Your outermost query is will be the Filter, with the metachain query as the Input.  

    Your "meta" navigation chain needs to be InstanceSpecification (of Tire classifier) -> instanceValue InstanceValue -> owningSlot Slot -> owningInstance

    This metachain query finds you all the owning instances, not just the cars.  The Filter will filter the final list to make sure the owningInstance is of classifier Car.  This is a little tricky.

    The predicate of the Filter will be a TypeTest.  The TypeTest is tricky because you can't just use the triple dots ... to find the "Car" type, you need to manually specify it using the Expression containment tree by hitting the "Reset" button and then selecting "Element", then you can navigate to the Class you want to check, "Car" for example.

    I have attached a model to show this better.  It uses companies with people as employees and parents with people as children.  Given the children, we want to find their parents, not their employer.

    InstancesTypeTest.txt (change to mdzip)

  • I got it working based on your examples! Yes, that TypeTest is tricky, I don't think I ever would have got that on my own. Thank you!

    As a complete solution, here are all the steps to follow. I may make a video of this so people can see it visually step-by-step:

    1. Create instance table
    2. Click “Columns”, then “New Custom Column”
    3. Title the column
    4. Expert Mode
    5. Select “Metachain Navigation” in the Expression tree
    6. Click Insert: Instance Specification -> _instanceValueOfInstance
    7. Click Insert: Instance Value -> Owning Slot
    8. Click Insert: slot -> Owning Instance
    9. Click “OK” button to display column and see results

    If you want to filter the matches by type of class:

    1. Right-click column, “Edit Custom Column”
    2. Select “Metachain Navigation” in the Expression tree and click “Use as…”
    3. Select “Input of a new Filter”
    4. On the “Predicate” click the “Type Test” operation
    5. Expand “Body” and select “Type = null” in the Expression tree
    6. Click “Reset” button
    7. Select “Element” under “Values”
    8. Click three-dots “…” button
    9. Select your class and click “OK”
    10. Click “OK” to close dialog and display updated column