Store Data in Declared In-Memory Stores
Declared In-Memory Stores must be added as connections by Business Analytics administrators before you can load datasets from them.
Declared stores:
May already exist and may already contain data that has been stored by other systems.
Business Analytics can also store data in declared In-Memory Stores using <storeto>.
Have configuration defined in an
ehcache.xml file that defines the connection and behavior of the store. For example, declared stores may define search criteria or use different eviction policies.
Have names in the form
data-source.store-name. The data source name is assigned by the
Business Analytics administrator to the configuration file and the store name is defined in the configuration for each store that is declared in the file.
The following example retrieves legislator data from a URL and stores this dataset in the sample In-Memory Store named sample-cache.LegislatorsDeclCache:
<mashup xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns='http://www.openmashup.org/schemas/v1.0/EMML'
xmlns:macro = "http://www.openmashup.org/schemas/v1.0/EMMLMacro"
name='LoadLegislatorsDeclarativeCache'>
<output name='result' type='string'>
Data loaded in cache. Use query-decl-cache.emml to query data from this cache.
</output>
<variable name="congressTupleStream" type="document" stream="true" />
<variable name="congress" type="document"/>
<directinvoke stream="true" outputvariable="congress"
endpoint="http://mdc.jackbe.com/prestodocs/data/legislators.xml" />
<raql query="select * from congress " stream="true"
outputvariable="congressTupleStream" />
<storeto clearcache="true" cache="sample-cache.LegislatorsDeclCache" key="firstname,lastname,state" variable="$congressTupleStream"/>
</mashup>
Some points to keep in mind in this example:
The
clearcache attribute is set to true to flush any existing data in this declared
In-Memory Store.
The
cache attribute contains both parts of the
In-Memory Store name:
Data source name,
sample-cache, that was assigned to the configuration file that defines the connection to this
In-Memory StoreThe store name,
LegislatorsDeclCache, that is defined in the configuration for this store.
The
key that is assigned to each row in this dataset combines the first name, last name and state of each legislator. This is an example of a multi-column key. See
Set Unique Keys for Dataset Rows for more information on different methods to assign unique keys.