# Modeling question on prerequisites for association

**URL:** https://discourse.kitware.com/t/modeling-question-on-prerequisites-for-association/556
**Category:** Using SMTK
**Created:** [November 19, 2020, 4:24pm UTC](https://discourse.kitware.com/t/modeling-question-on-prerequisites-for-association/556 "2020-11-19T16:24:52Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![dcthomp](https://discourse.kitware.com/user_avatar/discourse.kitware.com/dcthomp/32/10_2.png) [@dcthomp](https://discourse.kitware.com/u/dcthomp)
#### Post date: [November 19, 2020, 4:24pm UTC](https://discourse.kitware.com/t/modeling-question-on-prerequisites-for-association/556/1 "2020-11-19T16:24:52Z")

</div>

Hi all but especially @Bob_Obara and @johnt,

I’m trying to model surface adhesion and sliding contact between anatomical organs for aeva. These contacts relate side sets on 2 organs (e.g., femur and ACL) to each other. At the point in the workflow where users provide information on adhesion and contact,

- surface and volume components will have an attribute representing the organ they correspond to (e.g., femur, ACL, tibia) associated to them.
- side sets (additional components related to the surface and volume components by virtue of belonging to the same parent model) will have been created; they have an integer property marking them as side/node sets.
- an attribute for the adhesion or contact will already exist (the template file will be pre-populated with the contacts/adhesions to be modeled).

Is there a way to mark the adhesion/contact attribute-definition association rule so that

- only side sets tagged with a particular organ are shown in the user interface? At this point, I understand that there is no way to say “any component that has the side-set property and whose model contains a primary-geometry component associated with organ X.” That means users will have to associate the side set with the organ directly, but this should be simple. What I am asking is whether the association rules allow property checks (i.e., is the “side-set” property present?) and prerequisites (i.e., is the component already associated with organ X?) simultaneously.
- 1 or more side sets from each of the organs involved must be associated to be valid (i.e., associating 2 femur side sets is invalid, 2 ACL side sets is invalid, but 1 of each is valid as is 2 of each)?

---

<div class="post-metadata">

### Author: ![dcthomp](https://discourse.kitware.com/user_avatar/discourse.kitware.com/dcthomp/32/10_2.png) [@dcthomp](https://discourse.kitware.com/u/dcthomp)
#### Post date: [November 19, 2020, 4:52pm UTC](https://discourse.kitware.com/t/modeling-question-on-prerequisites-for-association/556/2 "2020-11-19T16:52:01Z")

</div>

On a related note, would it be a horrible idea to allow attribute instances to specialize/parameterize their definitions?

Currently, I am creating a `surface adhesion` attribute definition and a `femur bone-acl adhesion` definition that inherits `surface adhesion`, but what I would really like is an attribute _instance_ named `femur bone-acl adhesion` of type `surface adhesion` that restricts its associations by forcing a prerequisite association to the `femur bone` or `ACL` organ attributes.

---

<div class="post-metadata">

### Author: ![amuhsin](https://discourse.kitware.com/user_avatar/discourse.kitware.com/amuhsin/32/335_2.png) [@amuhsin](https://discourse.kitware.com/u/amuhsin)
#### Post date: [November 19, 2020, 5:02pm UTC](https://discourse.kitware.com/t/modeling-question-on-prerequisites-for-association/556/3 "2020-11-19T17:02:20Z")

</div>

Python Association Rules might come in very handy for what you need to do:  
[https://gitlab.kitware.com/cmb/smtk/-/blob/master/doc/release/notes/changes\_to\_attribute.md#introduce-custom-association-rules](https://gitlab.kitware.com/cmb/smtk/-/blob/master/doc/release/notes/changes_to_attribute.md#introduce-custom-association-rules)

Also, if you set `femur bon-acl` as the `bone-type` property value for your `femur bone-acl adhesion` attribute instance then you can pick up that value in the association rule and use it to determine what you need to do.

---

<div class="post-metadata">

### Author: ![johnt](https://discourse.kitware.com/user_avatar/discourse.kitware.com/johnt/32/147_2.png) [@johnt](https://discourse.kitware.com/u/johnt)
#### Post date: [November 19, 2020, 6:09pm UTC](https://discourse.kitware.com/t/modeling-question-on-prerequisites-for-association/556/4 "2020-11-19T18:09:01Z")

</div>

I can’t add much to Ahmed’s comment, but for what it’s worth:

- Regarding your first item about mixing property and association rules, no, there’s nothing in smtk to natively support that. (Wish there was…)

- As for the association validity question, have you ruled out using two ComponentItem definitions in lieu of the attribute association?

---

<div class="post-metadata">

### Author: ![dcthomp](https://discourse.kitware.com/user_avatar/discourse.kitware.com/dcthomp/32/10_2.png) [@dcthomp](https://discourse.kitware.com/u/dcthomp)
#### Post date: [November 19, 2020, 6:09pm UTC](https://discourse.kitware.com/t/modeling-question-on-prerequisites-for-association/556/5 "2020-11-19T18:09:54Z")

</div>

Thanks, I had not thought of the Python association rules!

---

<div class="post-metadata">

### Author: ![dcthomp](https://discourse.kitware.com/user_avatar/discourse.kitware.com/dcthomp/32/10_2.png) [@dcthomp](https://discourse.kitware.com/u/dcthomp)
#### Post date: [November 19, 2020, 6:12pm UTC](https://discourse.kitware.com/t/modeling-question-on-prerequisites-for-association/556/6 "2020-11-19T18:12:25Z")

</div>

> [@johnt](#):
>
> As for the association validity question, have you ruled out using two ComponentItem definitions in lieu of the attribute association?

I did, but the user interface we have makes that kinda painful. Instead of selecting the 2 things I want to tie together and associating to an attribute, I have to select them one at a time even though the attribute doesn’t care about ordering.
