Be Advised: Classified, FOUO, and PII Content is Not Permitted
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
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:
If you want to filter the matches by type of class: