# Should we keep Category Sections in Attribute Resource Files?

**URL:** <https://discourse.kitware.com/t/should-we-keep-category-sections-in-attribute-resource-files/136>\
**Category:** Design\
**Created:** [August 9, 2018, 1:30pm UTC](https://discourse.kitware.com/t/should-we-keep-category-sections-in-attribute-resource-files/136 "2018-08-09T13:30:55Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bob\_Obara](https://discourse.kitware.com/user_avatar/discourse.kitware.com/bob_obara/32/37_2.png) [@Bob\_Obara](https://discourse.kitware.com/u/Bob_Obara)\
**Post date:** [August 9, 2018, 1:30pm UTC](https://discourse.kitware.com/t/should-we-keep-category-sections-in-attribute-resource-files/136/1 "2018-08-09T13:30:57Z")

</div>

When I designed the original attribute XML file format, I wanted to provide the template designer the ability to define information categories for filtering and then use those categories to define analyses. Below is an example:

```xml
  <Categories Default="Mechanics">
    <Cat>Time</Cat>
    <Cat>Mechanics</Cat>
  </Categories>
  <Analyses>
    <Analysis Type="Solid Mechanics">
      <Cat>Mechanics</Cat>
      <Cat>Time</Cat>
    </Analysis>
  </Analyses>

```

In addition, after the file is read in, the reader would compare the list of categories defined in the categories section with all of the categories defined in attribute resource. If the attribute resource contained additional categories, the reader would report an error.

Since the first version of the attribute file, I had added the ability to reuse existing attribute files via the Includes Section. Though this has been a great feature, it did have an unexpected side-effect w/r to the Categories Section. When including a file with a Categories section, if the consuming file needed to add Categories, it would first need to duplicate the Categories Section of all previously included files. This can result in errors due to potential typos.

I was wondering if we should remove the Category Section from the next version (Version 3) of the attribute resource file. The Default Category could then be moved to the resource’s root node. The new check would be to compare the categories assigned to the different Analyses and if any were not being used by the attribute resource, those missing categories would be reported as warning.

Any comments?

> **Summary**
>
> This text will be hidden

---

<div class="post-metadata">

**Author:** ![Haocheng\_Liu](https://discourse.kitware.com/user_avatar/discourse.kitware.com/haocheng_liu/32/36_2.png) [@Haocheng\_Liu](https://discourse.kitware.com/u/Haocheng_Liu)\
**Post date:** [August 9, 2018, 1:47pm UTC](https://discourse.kitware.com/t/should-we-keep-category-sections-in-attribute-resource-files/136/2 "2018-08-09T13:47:38Z")

</div>

@tj.corona @johnt @dcthomp It seems that default notification settings would not send you an email about a new topic. I changed it from `Normal` to `Watching` hoping to fix the problem. I guess you guys do not see a notification about Bob’s post as well?

---

<div class="post-metadata">

**Author:** ![Haocheng\_Liu](https://discourse.kitware.com/user_avatar/discourse.kitware.com/haocheng_liu/32/36_2.png) [@Haocheng\_Liu](https://discourse.kitware.com/u/Haocheng_Liu)\
**Post date:** [August 9, 2018, 1:57pm UTC](https://discourse.kitware.com/t/should-we-keep-category-sections-in-attribute-resource-files/136/3 "2018-08-09T13:57:57Z")

</div>

> [@Bob\_Obara](#):
>
> I was wondering if we should remove the Category Section from the next version (Version 3) of the attribute resource file. The Default Category could then be moved to the resource’s root node. The new check would be to compare the categories assigned to the different Analyses and if any were not being used by the attribute resource, those missing categories would be reported as warning.

Since Solid Mechanics is a subset of Mechanics, may I ask why it needs to duplicate the `Mechanics` and `Time` again? Shouldn’t SMTK automatically populate these two entries?

---

<div class="post-metadata">

**Author:** ![Bob\_Obara](https://discourse.kitware.com/user_avatar/discourse.kitware.com/bob_obara/32/37_2.png) [@Bob\_Obara](https://discourse.kitware.com/u/Bob_Obara)\
**Post date:** [August 9, 2018, 2:05pm UTC](https://discourse.kitware.com/t/should-we-keep-category-sections-in-attribute-resource-files/136/4 "2018-08-09T14:05:02Z")

</div>

If you are referring to the Analyses section where Solid Mechanics is being defined - Time and Mechanics Categories are not being duplicated - it is saying that a Solid Mechanics Analysis uses information belonging to either the Time or Mechanics categories.

---

<div class="post-metadata">

**Author:** ![tj.corona](https://discourse.kitware.com/user_avatar/discourse.kitware.com/tj.corona/32/35_2.png) [@tj.corona](https://discourse.kitware.com/u/tj.corona)\
**Post date:** [August 9, 2018, 2:20pm UTC](https://discourse.kitware.com/t/should-we-keep-category-sections-in-attribute-resource-files/136/5 "2018-08-09T14:20:11Z")

</div>

> I was wondering if we should remove the Category Section from the next version (Version 3) of the attribute resource file.

Sure. Will there be another filtering mechanism to replace categories? Or are you suggesting that categories will hereafter be scoped to analyses and not resources?

---

<div class="post-metadata">

**Author:** ![Bob\_Obara](https://discourse.kitware.com/user_avatar/discourse.kitware.com/bob_obara/32/37_2.png) [@Bob\_Obara](https://discourse.kitware.com/u/Bob_Obara)\
**Post date:** [August 9, 2018, 2:30pm UTC](https://discourse.kitware.com/t/should-we-keep-category-sections-in-attribute-resource-files/136/6 "2018-08-09T14:30:56Z")

</div>

Thats sort of the issue - In the currently categories are assigned to attribute items independently of the Categories Section. So an item can be assigned category “foo” without “foo” being specified in the Category section - in that case you would get an error. However, if you omitted the Category section all together you would get no such error. So actually the section is already sort of optional.

---

<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:** [August 9, 2018, 3:07pm UTC](https://discourse.kitware.com/t/should-we-keep-category-sections-in-attribute-resource-files/136/7 "2018-08-09T15:07:12Z")

</div>

I’m good with making \<Categories\> optional, but I’m not sure I’m ready to drop the section completely.

I use the \<Category\> section as a reference, which I can copy & paste from into other parts of the template. But I guess I _could_ list the categories in an xml comment…

---

<div class="post-metadata">

**Author:** ![Bob\_Obara](https://discourse.kitware.com/user_avatar/discourse.kitware.com/bob_obara/32/37_2.png) [@Bob\_Obara](https://discourse.kitware.com/u/Bob_Obara)\
**Post date:** [August 9, 2018, 3:13pm UTC](https://discourse.kitware.com/t/should-we-keep-category-sections-in-attribute-resource-files/136/8 "2018-08-09T15:13:08Z")

</div>

If its in an XML comment then it would not be retained during I/O so using comments probably won’t work. We could keep the section optionally (which is today). What about validation ? Should we still report errors if categories are missing and/or add the new check that would warn you that an Analysis is referring to categories that are not associated with any item/attribute?

---

<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:** [August 9, 2018, 5:11pm UTC](https://discourse.kitware.com/t/should-we-keep-category-sections-in-attribute-resource-files/136/9 "2018-08-09T17:11:26Z")

</div>

FWIW – Regarding the comments not being retained by I/O, that doesn’t apply to my current use case, which is authoring template files manually. If/when we migrate to a template editor app, I would lobby for that to present a list of categories, rendering the point moot.

In terms of validation – My use case might be too narrow, but I would be interested in knowing about any categories applied to items that aren’t in the \<Categories\> section. But I would not make this a fatal error, just a warning.

Side note: I have to use xml entity syntax to get the brackets to display correctly in discourse, e.g. &lt;

---

<div class="post-metadata">

**Author:** ![Bob\_Obara](https://discourse.kitware.com/user_avatar/discourse.kitware.com/bob_obara/32/37_2.png) [@Bob\_Obara](https://discourse.kitware.com/u/Bob_Obara)\
**Post date:** [August 9, 2018, 5:27pm UTC](https://discourse.kitware.com/t/should-we-keep-category-sections-in-attribute-resource-files/136/10 "2018-08-09T17:27:27Z")

</div>

When I was referring to I/O - I was think specifically if you wanted to update a template from V2 to V3 - in that case the Categories would have disappeared if you were using a comment.

In terms of validation I can have it report both set of issues.
