Tagging Framework
Description
Tagging framework provides VOLTTRON users the ability to add semantic tags to topics/topic prefixes, enabling query based on semantic tags instead of specific topic name or topic name pattern.
This library, volttron-lib-tagging, provides
a BaseTaggingAgent that implementing agents can extend to store tag data in a specific data store. For example, SQLiteTaggingAgent extends the BaseTaggingAgent and stores the tag data in a SQLite3 database
a data_model directory that has a list of haystack3 tags, tag categories, tag units.
a simplified sql-like query language to query for topic names based on tags. Queries can specify tag names with values or tags without values (for boolean tags or markers). Queries can also combine multiple conditions with keyword AND, and OR, and use the keyword NOT to negate a conditions.
Taxonomy
This framework uses tags from Project Haystack3. Tags defined by haystack version 3 are imported into VOLTTRON and grouped by categories. This is used to tag topics or topic name prefixes.
Dependencies and Limitations
When adding tags to topics this library calls the platform.historian’s (or a configured historian’s) get_topic_list and hence requires a platform.historian or configured historian to be running, but it doesn’t require the historian to use sqlite3 or any specific database. It requires historian to be running only for using this api (add_tags) and does not require historian to be running for any other api.
Resource files that provides the list of valid tags is mandatory and should be in data_model/tags.csv
Tagging library only provides APIs to query for topic names based on tags. Once the list of topic names is retrieved, users should use the historian APIs to get the data corresponding to those topics.
Current version of tagging library does not support versioning of tag/values. When tags values are set it will overwrite any existing tag entries in the database
Features
User can tag individual components of a topic such as campus, building, device, point etc.
Using the tagging service users can only add tags already defined in the volttron tagging schema. New tags should be explicitly added to the tagging schema before it can be used to tag a topic or topic prefix
Users can batch process and tag multiple topic names or topic prefix using simple pattern matching.
When users query for topics based on a tag, the results would correspond to the current metadata values. It is up to the calling agent/application to periodically query for latest updates if needed.
Users should be able query based on tags on a specific topic or its topic prefix/parents. Query API supports
count and skip parameters to restrict count and allow pagination
Configuration
The base tagging agent supports a single optional configuration, historian_vip_identity, that points to the vip identity of the historian that should be queried when attempting to find topics that match a given topic pattern. By default this points to “platform.historian”
API
1. Get the list of tag categories available
rpc call to tagging service method ‘get_categories’ with optional parameters:
include_description - set to True to return available description for each category. Default = False
skip - number of categories to skip. this parameter along with count can be used for paginating results
count - limit the total number of tag categories returned to given count
order - ASCENDING or DESCENDING. By default, it will be sorted in ascending order