Metric Ontology Functions

Metric instances and their values are created and modified in rules using special metric ontology functions.

Note: To add or update metric instances, use only the compute() and createOrUpdateMetric() functions.

To delete metric instances, use only the delete() function.

Do not use methods that are available for other entity types.

Metric Ontology Functions

When you create a metric, the following ontology functions are created for it:

  • lookup()- Searches the cache or backing store (if one is configured) for an instance of the metric based on the value of the the metric’s group by field or fields. Group by field values uniquely identify a metxric instance. For example, if group by fields are Country and State, then you might search for the metric instance for California, U.S.A
  • getMetricExtId()-Returns the extId for the metric, based on the value of the the metric’s group by field or fields. The extId can be used as a token for explicit locking (see Implicit and Explicit Locking for Metrics).
  • compute()-Creates and updates instances of a metric. Instances are created based on unique values of the group by field (or fields). Each argument of the compute() function maps to a metric field. Tracking fields are also listed as arguments. The metric fields are then populated by values coming from concepts, events, or scorecards, as appropriate.
  • createOrUpdateMetric()-This is an XSLT Mapper function (requires configuration). See Using the XSLT Mapper Function Create or Update a Metric from Studio.
  • delete()-Deletes a metric instance in the cache, based on the value of the metric’s group by field or fields. Also deletes all tracking table entries for the metric.
    Note: When you execute the delete() function, it first attempts to delete the metric instance in the cache. It then attempts to delete tracking table entries for that instance, also in the cache. The corresponding backing store entries are then also deleted. However when you execute the delete() function, it is possible that the tracking table entries are already evicted from the cache, and exist only in the backing store. It is recommended that you use database utilities to remove these orphan tracking table entries.