Expanding Category Constraints

Category Constraints indicate if an Attribute or Item is considered relevant based on a set of category strings. Typically this set is represented as the current set of active categories that has been specified by an Analysis. If the constraint is satisfied by the set of categories then the Item and/or Attribute is considered relevant to the Analysis and its information will be used in creating input decks.

Category Constraints in SMTK 24.01

A discussion on the current implementation of categories constraints can be found here.

The limitation of the current implementation is that it can model expressions such as
(a op b op c op) op1 !(d op2 e op2 f). The left side is referred to as the inclusion set and the right side (omitted the !) is referred to as the exclusion set. The binary operations (op, op1, and op2) are either and or or.
What we can not represent are general constraints such as
((a or b) and c) and (e and !(f or g)).

Proposed Change

Using Pegtl we should be able to design a grammar to represent a category constraint such as the one shown above. For example the grammar made be:

  • (expression)
  • expression & expression
  • expression | expression
  • ! expression
  • category

Where a category can either be a quoted or unquoted name.

API Changes

  • Categories would now consist of a set of Category::Expressions and not Categories::Set
  • Categories::Set would ideally be deprecated if possible.

XML Format Changes

    <AttDef Type="physics" Label="Physics" BaseType="" >
      <CategoryInfo Combination="And">
        <Include Combination="Or">
           <Cat>A</Cat>
           <Cat>B</Cat>
        </Include>
       <Exclude Combination="And">
          <Cat>C</Cat>
          <Cat>D</Cat>
       </Exclude>
     </CategoryInfo>
   </AttDef>

Would be replaced (in a new SBT File Format Version) with:

    <AttDef Type="physics" Label="Physics" BaseType="" >
      <CategoryExpression>
         (A | B) & !(C & D)
      </CategoryExpression>
   </AttDef>

Note that InheritanceMode would still be an attribute to CategoryExpression

@dcthomp @johnt @justin.2.wilson @Aaron @rohith FYI