addData static method

Future<void> addData(
  1. Map<String, dynamic> data
)

Adds data to the recommender engine

The data map can contain has the following fields

['pois'] : a list of strings identifying the pois

['categories'] : a list of strings identifying the pois

['links_categories'] : a list of maps with:

      ['category1']: The string id of the first category to link

      ['category2']: The string id of the second category to link

['links_poi_category']: a list of maps with:

      ['poi']: the string id of the poi to link

      ['category']: the stdring id of the category to link

['person']: A map with:

  ['pois']: a list of string ids of pois a person like/visited

  ['categories']: a list of string ids of categories the person is interested in 

The methods throws a LgcreException if setting data fails, for instance:

  1. if passing an invalid key in the data map, 2) adding a link between two unexisting entities that are not bein added in this call or have been added in a previous call to add data or 3) an internal error occurs

Entities (categories, pois etc.) are identified by unique ids. If an entity is added twice, either in the same call or in different calls, only one time is added. The same happens for relations/links between items added by means of the links_categories, links_poi_category, person poi's and person categories's fields. Such relations/links are only added once.

This method is transactional and can be executed concurrently with other transactional methods

Implementation

static Future<void> addData(Map<String, dynamic> data)  async
{
  try
  {
    await _channel.invokeMethod('addData', data);

  } on PlatformException catch (e)
  {
    throw new LgcreException('${e.message}');
  }
}