Tag Rule components

The tagdictionary palette contains the default TagRule, TagForType which has the IsType condition, however the Condition slot is frozen, uneditable, limiting its usage. In also contains additional Rule components allowing you to add custom TagRules (with different Conditions) to smart tag dictionaries. These new TagRule components in the palette cover all possible conditions (except Never), which means that tags can be implied using more complex logic.

For additional information, see “tagdictionary-TagRuleList” in this guide.

Figure 36.   Example tag rule (Haystack Tag Dictionary)
Image

The tag rule shown here is the BooleanFilterRule. The rule’s Condition slot has a Filter field containing the NEQL predicate which queries for the following tags: hs:ahu or hs:vav or hs:chiller or hs:chillerPlant or hs:coolingTower or hs:heatExchanger or hs:boiler or hs:boilerPlant. Also, the rule’s Tag List is configured with the hvac marker tag. This tag rule queries objects in the station, filtering for those that have one or more of the tags specified in the condition Filter field. If the query returns true for any object (as having one of more of the queried tags), then the rule applies the hvac implied tag to the object as well.

Each of the TagRule components is configured for a certain condition. If these conditions are met (present in station objects) then the specified tag(s) and/or relation(s) become implied for those objects.

tagdictionary-ScopedTagRule

Tag rules may have a scope in which they apply. This means that an entity will only have tags implied by a rule if the entity is in the tag rule's scope. The effect of this is to focus evaluation of NEQL queries on applicable entities, which may reduce the amount of time it takes to complete a search or to perform hierarchy traversal. Several Scopes components are available in the tagdictionary palette.

Regular tag rules do not have a scope container in which to drop scope components, so they cannot be scoped. The special ScopedTagRule type has a Scope List container in which scopes may be dropped from the palette. A scoped tag rule is targeted to a particular place in the station via the Scope Ord property. Also, within a custom smart tag dictionary, you can create multiple scoped tag rules, each with a different root Scope Ord. Moreover, a single ScopedTagRule may have multiple scopes defined in its scope container — if an entity is in any of these scopes, the rule applies.

 NOTE: For tag rules that are not targeted to a particular place in the station, it is better to use a “regular” TagRule rather than a Scoped Tag Rule because the scoping mechanism requires some time to complete the evaluation so it may slow performance if everything is in scope. 

The reason to use a scoped tag rule is to speed up certain kinds of tag rule evaluations. In particular, using a hasAncestor condition to specify a particular part of a station (such as, hasAncestor with n:name = Building1Folder) in a tag rule is slow and this new scoping mechanism speeds up those kinds of rules. However, if the rule is something that does not require checking an entity's ancestors, then a regular TagRule should be used instead.

For example, suppose you are using a rule to tag components by their name, say a rule with a BooleanFilter with n:name like "Lighting.*East", and you know that those components will only live in a particular part of the station, say under a folder called "Campus". You might think that using a scoped tag rule would make the queries faster because it would not have to check outside the Campus folder. That is not the case though. It still has to check every component and decide if it is in scope or not. In this case, determining if a component is in scope is probably slower than just checking the name of the component, so using the scoped rule could hurt performance slightly.

Basically, the scoped tag rule exists as an alternative to using the slower hasAncestor condition to check for a component's scope in the station. A best practice is to consider if you did not use a scoped tag rule, would you use a hasAncestor condition to accomplish the same thing. If so, use a scoped tag rule. If not, use a regular TagRule.

AlwaysRule

If the AlwaysRule is present in an installed tagdictionary, the condition is true for all station objects and so the specified tag(s) may be applied to each and every object.

Name Value Description
Condition true (default) There is no criteria to be met. The condition is always “true” so a filter is not necessary.
Tag List tag(s) Tag Info List contains the list of tag(s) to be applied.
Tag Group List tag group(s) Tag Group Info List contains the list of tag groups to be applied.
Relation List relation Id(s) Relation Info List contains the relation Ids to be applied.

AndRule

The specified tag definitions may be applied if the target object has all of the conditions listed under the Condition property.

Name Value Description
Condition true (default) There is no criteria to be met. The condition is always “true” so a filter is not necessary.
Condition sub-properties tagdictionary: conditionName null (default) Add slots under Condition property or drag any of the Condition components (Always, And, BooleanFilter, HasAncestor, HasRelation, IsType, Never, Or) from the palette.
Tag List tag(s) Tag Info List contains the list of tag(s) to be applied.
Tag Group List tag group(s) Tag Group Info List contains the list of tag groups to be applied.
Relation List relation Id(s) Relation Info List contains the relation Ids to be applied.

BooleanFilterRule

The specified tags may be applied if the target object has a tag listed in the Filter property.

Figure 37.   Example BooleanFilter tag rule
Image
Name Value Description
Condition   Criteria to be met by target objects.
Condition sub-properties baja:stringfalse (default) Target object must meet the filter criteria (NEQL query).
Tag List tag(s) Tag Info List contains the list of tag(s) to be applied.
Tag Group List tag group(s) Tag Group Info List contains the list of tag groups to be applied.
Relation List relation Id(s) Relation Info List contains the relation Ids to be applied.

HasAncestorRule

The specified tag definition(s) may be applied if the target object, or one of its ancestors, has the tags listed in the Filter property.

Name Value Description
Condition   Criteria to be met by target objects.
Filter baja:stringfalse (default) Target object or one of its ancestors must meet the filter criteria (NEQL query).
Tag List tag(s) Tag Info List contains the list of tag(s) to be applied.
Tag Group List tag group(s) Tag Info List contains the list of tag(s) to be applied.
Relation List relation Id(s) Relation Info List contains the relation Ids to be applied.

HasRelationRule

The specified tag definition(s) may be applied if the target object, or an object along the relation specified in the Relation Id field, has the tags listed in the Filter property and has the relation specified in the Relation Id field.

Name Value Description
Condition   Criteria to be met by target objects.
Filter baja:stringfalse (default) Target object must meet the filter criteria (NEQL query).
Relation Id baja:string Relation along which objects will be searched for one that meets the Filter criteria.
Tag List tag(s) Tag Info List contains the list of tag(s) to be applied.
Tag Group List tag group(s) Tag Group Info List contains the list of tag groups to be applied.
Relation List relation Id(s) Relation Info List contains the relation Ids to be applied.

IsTypeRule

The specified tag definition(s) may be applied if the target object is one of the specified object type.

Name Value Description
Condition   Criteria to be met by target objects.
Is Type Condition (sub-property) baja:TypeSpec Target object must be or extend this specified type.
Tag List tag(s) Tag Info List contains the list of tag(s) to be applied.
Tag Group List tag group(s) Tag Group Info List contains the list of tag groups to be applied.
Relation List relation Id(s) Relation Info List contains the relation Ids to be applied.

NotRule

The specified tag definition(s) may be applied if the child condition of the Not tag rule condition evaluates to false. The tag definition(s) will not be applied if the Not tag rule condition has no child condition.

Figure 38.   NotRule tag rule
Image
Name Value Description
Condition (Not)   Criteria to be met by target objects.
Child Condition (sub-property) tagdictionary:TagRuleCondition Target object must be or extend this specified type. The NotRule condition only accepts a single child tag rule condition. The IsType condition is shown but the child condition can be any subclass of BTagRuleCondition.
Tag List tag(s) Tag Info List contains the list of tag(s) to be applied.
Tag Group List tag group(s) Tag Group Info List contains the list of tag groups to be applied.
Relation List relation Id(s) Relation Info List contains the relation Ids to be applied.

OrRule

The specified tag definition(s) may be applied if the target object has any of the conditions listed under the Condition property.

Figure 39.   Example OrRule tag rule
Image
Name Value Description
Condition   Criteria to be met by target objects.
Condition sub-properties tagdictionary: conditionName null (default) Add slots under Condition property or drag any of the Condition components (Always, And, BooleanFilter, HasAncestor, HasRelation, IsType, Never, Or) from the palette.
Tag List tag(s) Tag Info List contains the list of tag(s) to be applied.
Tag Group List tag group(s) Tag Group Info List contains the list of tag groups to be applied.
Relation List relation Id(s) Relation Info List contains the relation Ids to be applied.