Introduction

  • One way to set user interests, is by using MOCA Tags

  • Tags are small items of information with well defined semantics.

  • Each tag is associated with a counter (integer). The counter is used to track how many times the user was tagged or to sum points associated with the tag.

  • Tags are defined in MOCA Console or by the app.

  • For example: Restaurant Video Store Parking Gym

  • Tags can be attached to specific locations by using beacons or programmatically by API.

  • Tag counters are used to rank the tags.

  • MOCA provides the following methods to manipulate Tags.

@interface MOCAInstance

#pragma mark Tags

/**
 * Add a tag to this instance and increment its value by 1.
 */
-(void)addTag:(NSString*)tagName;

/**
 * Add a tag with a given value to this instance.
 * @value - update expression with syntax [=|+|-] <double> value.
 * For example "+1" increments the tag value by 1.
 * For example "-2" decrements the tag value by 2. 
 * For example "3" or "=3" assign value of 3 to the tag's value.
 */
-(void)addTag:(NSString*)tagName withValue:(NSString*)value;

/**
 * Checks if this instance contains a specific tag.
 * @return <code>YES</code> if the instance contains a tag, or <code>NO</code> otherwise.
 */
-(BOOL)containsTag:(NSString*)tagName;

/**
 * Retrieves a value of a specific tag associated with this instance.
 * @return tag value or <code>nil</code> if the tag doest not exist.
 */
-(NSNumber*)getTagValue:(NSString*)tagName;

/**
 * Retrieves top-k tags ranked by values.
 */
-(NSArray*)getTopTags:(unsigned int)topK;

/**
 * Retrieves names of all tags associated with this instance.
 */
-(NSArray*)allTags;

#pragma mark
// MARK: Tags
/**
* Add a tag to this instance and increment its value by 1.
*/
func addTag(_ tagName: String)

/**
* Add a tag with a given value to this instance.
* @value - update expression with syntax [=|+|-] <double> value.
* For example "+1" increments the tag value by 1.
* For example "-2" decrements the tag value by 2. 
* For example "3" or "=3" assign value of 3 to the tag's value.
*/
func addTag(_ tagName: String, withValue value: String) 

/**
* Checks if this instance contains a specific tag.
* @return <code>YES</code> if the instance contains a tag, or <code>NO</code> otherwise.
*/
func containsTag(_ tagName: String) -> Bool

/**
* Retrieves a value of a specific tag associated with this instance.
* @return tag value or <code>nil</code> if the tag doest not exist.
*/
func getTagValue(_ tagName: String) -> NSNumber

/**
* Retrieves top-k tags ranked by values.
*/
func getTopTags(_ topK: UInt) -> [Any] 

/**
* Retrieves names of all tags associated with this instance.
*/
func allTags() -> [Any]