HABot Walkthrough (2/n): Semantic Tagging & Item Resolving

Definitely not! You can add tags through rules. If you are using scripted automation, Jython, and the helper libraries, it would look like this…


from core.log import logging, LOG_PREFIX#, log_traceback
LOG = logging.getLogger("{}.TEST_2".format(LOG_PREFIX))

test_item = itemRegistry.getItem("Virtual_Switch_1")
LOG.warn("Before: {}".format(test_item.getTags()))
test_item.addTag("Add tag through rule example")
LOG.warn("After: {}".format(test_item.getTags()))

If you are still holding on to the rules DSL, it would look like…

rule "Test DSL rule"
when
    System started
then
    logWarn("Rules", "Before: {}", Virtual_Switch_1.getTags)
    Virtual_Switch_1.addTag("Tag example from DSL")
    logWarn("Rules", "After: {}", Virtual_Switch_1.getTags)
end

So, just build these out with all of the Items that you want to add tags to.