Learn how to create a data storage module.
Data storage modules combine modules with explicite events to allow a personal event network to store data that can be shared between rulesets.
location_data
add_location_item
that listens for a pds:new_location_data
event. The attributes to this event will be key
and value
. add_location_item
rule fires, it should store the data in the value
attribute in an map entity variable using the value of the key
attribute as the key for the map. get_location_data()
that takes a key as it's sole argument and returns the value of that key in the entity variable you created above. get_location_data()
function is listed in the provides
pragma in the meta
section of the ruleset. process_fs_checkin
rule from the Foursquare Checkin exercise to raise a pds:new_location_data event the key
attribute should be fs_checkin
and the value
attribute should be a map with the venue
, city
, shout
, and createdAt
event attributes. examine_location:
location_data
ruleset as a module. show_fs_location
that shows the last Foursquare checkin in SquareTag. You've built a system of three rulesets that use explicit events and modules that looks something like this:
To demonstrate your code works (say for grading purposes), please add a send_directive()
action to the rules add_location_item
and process_fs_checkin
as follows:
send_directive()
) should be venue name for process_fs_checkin
The options for process_fs_checkin
should include an item with key equal to "checkin" with a value equal to the name of the venue. event:attr("key")
for add_location_item
. The options for add_location_item should include an item with key equal to "location" with a value equal to event:attr("value")
.