UNPKG

qminer

Version:

A C++ based data analytics platform for processing large-scale real-time streams containing structured and unstructured data

1,140 lines (1,137 loc) 75.2 kB
<!doctype html> <html> <head> <meta name="generator" content="JSDoc 3"> <meta charset="utf-8"> <title>Class: Store</title> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css"> <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css"> <link href="css/baseline.css" rel="stylesheet"> </head> <body onload="prettyPrint()"> <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar"> <div id="jsdoc-navbar-container"> <div id="jsdoc-navbar-content"> <a href="index.html" class="jsdoc-navbar-package-name">QMiner JavaScript API v9.4.0</a> </div> </div> </nav> <div id="jsdoc-body-container"> <div id="jsdoc-content"> <div id="jsdoc-content-container"> <div id="jsdoc-main" role="main"> <header class="page-header"> <div class="symbol-detail-labels"><span class="label label-kind">class</span>&nbsp;<span class="label label-static">static</span></div> <h1><small><a href="module-qm.html">qm</a>.<wbr></small><span class="symbol-name">Store</span></h1> <p class="source-link">Source: <a href="qminerdoc.js.html#source-line-817">qminerdoc.<wbr>js:817</a></p> <dl class="dl-compact"> </dl> </header> <section id="summary"> <div class="summary-callout"> <h2 class="summary-callout-heading">Properties</h2> <div class="summary-content"> <div class="summary-column"> <dl class="dl-summary-callout"> <dt><a href="module-qm.Store.html#allRecords">allRecords</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#backwardIter">backwardIter</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#base">base</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#empty">empty</a></dt> <dd> </dd> </dl> </div> <div class="summary-column"> <dl class="dl-summary-callout"> <dt><a href="module-qm.Store.html#fields">fields</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#first">first</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#forwardIter">forwardIter</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#joins">joins</a></dt> <dd> </dd> </dl> </div> <div class="summary-column"> <dl class="dl-summary-callout"> <dt><a href="module-qm.Store.html#keys">keys</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#last">last</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#length">length</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#name">name</a></dt> <dd> </dd> </dl> </div> </div> </div> <div class="summary-callout"> <h2 class="summary-callout-heading">Methods</h2> <div class="summary-content"> <div class="summary-column"> <dl class="dl-summary-callout"> <dt><a href="module-qm.Store.html#addStreamAggr">addStreamAggr(arg)</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#addTrigger">addTrigger(trigger)</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#cell">cell(recId, fieldName)</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#clear">clear([num])</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#each">each(callback)</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#field">field(fieldName)</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#getMatrix">getMatrix(fieldName)</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#getStreamAggrNames">getStreamAggrNames()</a></dt> <dd> </dd> </dl> </div> <div class="summary-column"> <dl class="dl-summary-callout"> <dt><a href="module-qm.Store.html#getVector">getVector(fieldName)</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#inspect">inspect(depth)</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#isDate">isDate(fieldName)</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#isNumeric">isNumeric(fieldName)</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#isString">isString(fieldName)</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#key">key(keyName)</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#loadJson">loadJson(file[, limit])</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#map">map(callback)</a></dt> <dd> </dd> </dl> </div> <div class="summary-column"> <dl class="dl-summary-callout"> <dt><a href="module-qm.Store.html#newRecord">newRecord(obj)</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#newRecordSet">newRecordSet(idVec)</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#push">push(rec[, triggerEvents])</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#recordByName">recordByName(recName)</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#resetStreamAggregates">resetStreamAggregates()</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#sample">sample(sampleSize)</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#toJSON">toJSON()</a></dt> <dd> </dd> <dt><a href="module-qm.Store.html#triggerOnAddCallbacks">triggerOnAddCallbacks([arg])</a></dt> <dd> </dd> </dl> </div> </div> </div> </section> <section> <h2 id="Store"><span class="symbol-name">Store</span><span class="signature"><span class="signature-params">()</span></span></h2> <p>Stores are containers of records. <br> <b>Factory pattern:</b> this class cannot be construced using the new keyword. This class is constructed when calling a specific method or attribute, e.g. constructing the <a href="module-qm.Base.html">module:qm.Base</a> using schema or with the <a href="module-qm.Base.html#createStore">module:qm.Base#createStore</a>. </p> <section> <h3> Examples </h3> <div> <p>Creating a store with createStore function</p> <pre class="prettyprint"><code>// import qm module var qm &#x3D; require(&#x27;qminer&#x27;); // factory based construction using base.createStore var base &#x3D; new qm.Base({ mode: &#x27;createClean&#x27; }); base.createStore([{ name: &quot;People&quot;, fields: [ { name: &quot;Name&quot;, type: &quot;string&quot;, primary: true }, { name: &quot;Gender&quot;, type: &quot;string&quot;, shortstring: true }, { name: &quot;Age&quot;, type: &quot;int&quot; } ], joins: [ { name: &quot;ActedIn&quot;, type: &quot;index&quot;, store: &quot;Movies&quot;, inverse: &quot;Actor&quot; }, { name: &quot;Directed&quot;, type: &quot;index&quot;, store: &quot;Movies&quot;, inverse: &quot;Director&quot; } ], keys: [ { field: &quot;Name&quot;, type: &quot;text&quot; }, { field: &quot;Gender&quot;, type: &quot;value&quot; } ] }, { name: &quot;Movies&quot;, fields: [ { name: &quot;Title&quot;, type: &quot;string&quot;, primary: true }, { name: &quot;Plot&quot;, type: &quot;string&quot;, store: &quot;cache&quot; }, { name: &quot;Year&quot;, type: &quot;int&quot; }, { name: &quot;Rating&quot;, type: &quot;float&quot; }, { name: &quot;Genres&quot;, type: &quot;string_v&quot;, codebook: true } ], joins: [ { name: &quot;Actor&quot;, type: &quot;index&quot;, store: &quot;People&quot;, inverse: &quot;ActedIn&quot; }, { name: &quot;Director&quot;, type: &quot;index&quot;, store: &quot;People&quot;, inverse: &quot;Directed&quot; } ], keys: [ { field: &quot;Title&quot;, type: &quot;value&quot; }, { field: &quot;Plot&quot;, type: &quot;text&quot;, vocabulary: &quot;voc_01&quot; }, { field: &quot;Genres&quot;, type: &quot;value&quot; } ] }]); base.close();</code></pre> </div> <div> <p>Creating store with schema in base constructor</p> <pre class="prettyprint"><code>// import qm module var qm &#x3D; require(&#x27;qminer&#x27;); // using the base constructor var base &#x3D; new qm.Base({ mode: &quot;createClean&quot;, schema: [{ name: &quot;Class&quot;, fields: [ { name: &quot;Name&quot;, type: &quot;string&quot; }, { name: &quot;StudyGroup&quot;, type: &quot;string&quot; } ] }] }); base.close();</code></pre> </div> </section> <dl class="dl-compact"> </dl> </section> <section> <h2>Properties</h2> <section> <h3 id="allRecords"><span class="symbol-name">allRecords</span></h3> <p>Creates a record set containing all the records from the store. Type <a href="module-qm.RecordSet.html">module:qm.RecordSet</a>.</p> <dl class="dl-compact"> </dl> <h3 id="backwardIter"><span class="symbol-name">backwardIter</span></h3> <p>Returns an iterator for iterating over the store form end to start. Type <a href="module-qm.Iterator.html">module:qm.Iterator</a>.</p> <dl class="dl-compact"> </dl> <h3 id="base"><span class="symbol-name">base</span></h3> <p>Returns the base, in which the store is contained. Type <a href="module-qm.Base.html">module:qm.Base</a>.</p> <dl class="dl-compact"> </dl> <h3 id="empty"><span class="symbol-name">empty</span></h3> <p>Checks if the store is empty. Type <code>boolean</code>.</p> <dl class="dl-compact"> </dl> <h3 id="fields"><span class="symbol-name">fields</span></h3> <p>Gives an array of all field descriptor objects. Type <code>Array of objects</code>, where the objects contain the properties: <br>1. <code>id</code> - The ID of the field. Type B4numberB4. <br>2. <code>name</code> - The name of the field. Type <code>string</code>. <br>3. <code>type</code> - The type of the field. Type <code>string</code>. <br>4. <code>nullable</code> - If the field value can be null. Type <code>boolean</code>. <br>5. <code>internal</code> - If the field is internal. Type <code>boolean</code>. <br>6. <code>primary</code> - If the field is primary. Type <code>boolean</code>. </p> <dl class="dl-compact"> </dl> <h3 id="first"><span class="symbol-name">first</span></h3> <p>Returns the first record of the store. Type <a href="module-qm.Record.html">module:qm.Record</a>.</p> <dl class="dl-compact"> </dl> <h3 id="forwardIter"><span class="symbol-name">forwardIter</span></h3> <p>Returns an iterator for iterating over the store from start to end. Type <a href="module-qm.Iterator.html">module:qm.Iterator</a>.</p> <dl class="dl-compact"> </dl> <h3 id="joins"><span class="symbol-name">joins</span></h3> <p>Gives an array of all join descriptor objects. Type <code>Array of objects</code>, where the objects contain the properties: <br>1. <code>id</code> - The ID of the join. Type B4numberB4. <br>2. <code>name</code> - The name of the join. Type <code>string</code>. <br>2. <code>store</code> - The store the join was created in. Type <code>string</code>. <br>2. <code>inverse</code> - The inverse join. Type <code>string</code>. <br>3. <code>type</code> - The type of the field. Type <code>string</code>. <br>4. <code>key</code> - The index key. Type <a href="module-qm.html#~DetailKeyObject">module:qm~DetailKeyObject</a>. </p> <dl class="dl-compact"> </dl> <h3 id="keys"><span class="symbol-name">keys</span></h3> <p>Gives an array of all key descriptor objects. Type <code>Array of <a href="module-qm.html#~DetailKeyObject">module:qm~DetailKeyObject</a></code>.</p> <dl class="dl-compact"> </dl> <h3 id="last"><span class="symbol-name">last</span></h3> <p>Returns the last record of the store. Type <a href="module-qm.Record.html">module:qm.Record</a>.</p> <dl class="dl-compact"> </dl> <h3 id="length"><span class="symbol-name">length</span></h3> <p>Gives the number of records. Type <code>number</code>.</p> <dl class="dl-compact"> </dl> <h3 id="name"><span class="symbol-name">name</span></h3> <p>Gives the name of the store. Type <code>string</code>.</p> <dl class="dl-compact"> </dl> </section> <h2>Methods</h2> <section> <h3 id="addStreamAggr"><span class="symbol-name">addStreamAggr</span><span class="signature"><span class="signature-params">(arg)</span></span></h3> <p>Adds a stream aggregate to the store. For use example see <a href="module-qm.StreamAggr.html">module:qm.StreamAggr</a> constructor example.</p> <section> <h4>Parameter</h4> <table class="jsdoc-details-table"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Optional</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td> <p>arg</p> </td> <td> <p>(<a href="module-qm.html#~StreamAggregator">module:qm~StreamAggregator</a> or function())</p> </td> <td> <p>&nbsp;</p> </td> <td> <p>Constructor arguments. There are two argument types: <br>1. Using the <a href="module-qm.html#~StreamAggregator">module:qm~StreamAggregator</a> object, <br>2. using a function/JavaScript class. The function has defined The object containing the schema of the stream aggregate or the function object defining the operations of the stream aggregate. </p> </td> </tr> </tbody> </table> </section> <dl class="dl-compact"> </dl> <h3 id="addTrigger"><span class="symbol-name">addTrigger</span><span class="signature"><span class="signature-params">(trigger)</span></span></h3> <p>Adds a stream aggregate to a store.</p> <section> <h4>Parameter</h4> <table class="jsdoc-details-table"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Optional</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td> <p>trigger</p> </td> <td> <p>function()</p> </td> <td> <p>&nbsp;</p> </td> <td> <p>The trigger containing the method <a href="module-qm.StreamAggr.html#onAdd">module:qm.StreamAggr#onAdd</a> and optional <a href="module-qm.StreamAggr.html#onUpdate">module:qm.StreamAggr#onUpdate</a> and <a href="module-qm.StreamAggr.html#onDelete">module:qm.StreamAggr#onDelete</a>. </p> </td> </tr> </tbody> </table> </section> <dl class="dl-compact"> </dl> <h3 id="cell"><span class="symbol-name">cell</span><span class="signature"><span class="signature-params">(recId, fieldName)</span>&nbsp;&rarr; <span class="signature-returns"> (number, string, Array of number, or Array of string)</span></span></h3> <p>Gives the field value of a specific record.</p> <section> <h4> Example </h4> <div> <pre class="prettyprint"><code>//import qm module var qm &#x3D; require(&#x27;qminer&#x27;); // create a new base containing one store var base &#x3D; new qm.Base({ mode: &quot;createClean&quot;, schema: [{ name: &quot;Festivals&quot;, fields: [ { name: &quot;Name&quot;, type: &quot;string&quot; }, { name: &quot;Type&quot;, type: &quot;string&quot; }, { name: &quot;Location&quot;, type: &quot;string&quot; } ] }] }); // add some records in the store base.store(&quot;Festivals&quot;).push({ Name: &quot;Metaldays&quot;, Type: &quot;music&quot;, Location: &quot;Tolmin, Slovenia&quot; }); base.store(&quot;Festivals&quot;).push({ Name: &quot;Festival de Cannes&quot;, Type: &quot;movie&quot;, Location: &quot;Cannes, France&quot; }); base.store(&quot;Festivals&quot;).push({ Name: &quot;The Festival of Chocolate&quot;, Type: &quot;food&quot;, Location: &quot;Hillsborough, USA&quot; }); // get the field value of the second record for field &quot;Type&quot; var fieldValue &#x3D; base.store(&quot;Festivals&quot;).cell(1, &quot;Type&quot;); // returns &quot;movie&quot; base.close();</code></pre> </div> </section> <section> <h4>Parameters</h4> <table class="jsdoc-details-table"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Optional</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td> <p>recId</p> </td> <td> <p>number</p> </td> <td> <p>&nbsp;</p> </td> <td> <p>The record id.</p> </td> </tr> <tr> <td> <p>fieldName</p> </td> <td> <p>string</p> </td> <td> <p>&nbsp;</p> </td> <td> <p>The field name.</p> </td> </tr> </tbody> </table> </section> <dl class="dl-compact"> <dt>Returns</dt> <dd> <p><code>(number, string, Array of number, or Array of string)</code>B The <code>fieldName</code> value of the record with ID <code>recId</code>.</p> </dd> </dl> <h3 id="clear"><span class="symbol-name">clear</span><span class="signature"><span class="signature-params">([num])</span>&nbsp;&rarr; <span class="signature-returns"> number</span></span></h3> <p>Deletes the first records in the store.</p> <section> <h4> Example </h4> <div> <pre class="prettyprint"><code>// import qm module var qm &#x3D; require(&#x27;qminer&#x27;); // create a base containing one store var base &#x3D; new qm.Base({ mode: &quot;createClean&quot;, schema: [{ name: &quot;TVSeries&quot;, fields: [ { name: &quot;Title&quot;, type: &quot;string&quot;, primary: true }, { name: &quot;NumberOfEpisodes&quot;, type: &quot;int&quot; } ] }] }); // add some records in the store base.store(&quot;TVSeries&quot;).push({ Title: &quot;Archer&quot;, NumberOfEpisodes: 75 }); base.store(&quot;TVSeries&quot;).push({ Title: &quot;The Simpsons&quot;, NumberOfEpisodes: 574 }); base.store(&quot;TVSeries&quot;).push({ Title: &quot;New Girl&quot;, NumberOfEpisodes: 94 }); base.store(&quot;TVSeries&quot;).push({ Title: &quot;Rick and Morty&quot;, NumberOfEpisodes: 11 }); base.store(&quot;TVSeries&quot;).push({ Title: &quot;Game of Thrones&quot;, NumberOfEpisodes: 47 }); // deletes the first 2 records (Archer and The Simpsons) in TVSeries base.store(&quot;TVSeries&quot;).clear(2); // returns 3 // delete all remaining records in TVStore base.store(&quot;TVSeries&quot;).clear(); // returns 0 base.close();</code></pre> </div> </section> <section> <h4>Parameter</h4> <table class="jsdoc-details-table"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Optional</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td> <p>num</p> </td> <td> <p>number</p> </td> <td> <p>Yes</p> </td> <td> <p>The number of deleted records. If the number is given, the first <code>num</code> records will be deleted.</p> </td> </tr> </tbody> </table> </section> <dl class="dl-compact"> <dt>Returns</dt> <dd> <p><code>number</code>B The number of remaining records in the store.</p> </dd> </dl> <h3 id="each"><span class="symbol-name">each</span><span class="signature"><span class="signature-params">(callback)</span>&nbsp;&rarr; <span class="signature-returns"> <a href="module-qm.Store.html">module:qm.Store</a></span></span></h3> <p>Executes a function on each record in store.</p> <section> <h4> Example </h4> <div> <pre class="prettyprint"><code>// import qm module var qm &#x3D; require(&#x27;qminer&#x27;); // create a base containing the store Class var base &#x3D; new qm.Base({ mode: &quot;createClean&quot;, schema: [{ name: &quot;Class&quot;, fields: [ { name: &quot;Name&quot;, type: &quot;string&quot; }, { name: &quot;StudyGroup&quot;, type: &quot;string&quot; } ] }] }); // add some records to the store base.store(&quot;Class&quot;).push({ Name: &quot;Abed&quot;, StudyGroup: &quot;A&quot; }); base.store(&quot;Class&quot;).push({ Name: &quot;Annie&quot;, StudyGroup: &quot;B&quot; }); base.store(&quot;Class&quot;).push({ Name: &quot;Britta&quot;, StudyGroup: &quot;C&quot; }); base.store(&quot;Class&quot;).push({ Name: &quot;Jeff&quot;, StudyGroup: &quot;A&quot; }); // change the StudyGroup of all records of store Class to A base.store(&quot;Class&quot;).each(function (rec) { rec.StudyGroup &#x3D; &quot;A&quot;; }); // all records in Class are now in study group A base.close();</code></pre> </div> </section> <section> <h4>Parameter</h4> <table class="jsdoc-details-table"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Optional</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td> <p>callback</p> </td> <td> <p>function()</p> </td> <td> <p>&nbsp;</p> </td> <td> <p>Function to be executed. It takes two parameters: <br>1. <code>rec</code> - The current record. Type <a href="module-qm.Record.html">module:qm.Record</a>. <br>2. <code>idx</code> - The index of the current record (<i>optional</i>). Type <code>number</code>. </p> </td> </tr> </tbody> </table> </section> <dl class="dl-compact"> <dt>Returns</dt> <dd> <p><code><a href="module-qm.Store.html">module:qm.Store</a></code>B Self.</p> </dd> </dl> <h3 id="field"><span class="symbol-name">field</span><span class="signature"><span class="signature-params">(fieldName)</span>&nbsp;&rarr; <span class="signature-returns"> object</span></span></h3> <p>Gets the details of the selected field.</p> <section> <h4> Example </h4> <div> <pre class="prettyprint"><code>// import qm module var qm &#x3D; require(&quot;qminer&quot;); // create a new base containing one store var base &#x3D; new qm.Base({ mode: &quot;createClean&quot;, schema: [{ name: &quot;People&quot;, fields: [ { name: &quot;Name&quot;, type: &quot;string&quot;, primary: true }, { name: &quot;Gender&quot;, type: &quot;string&quot; }, { name: &quot;Age&quot;, type: &quot;int&quot; } ] }] }); // get the details of the field &quot;Name&quot; of store &quot;People&quot; // it returns a JSON object: // { id: 0, name: &quot;Name&quot;, type: &quot;string&quot;, primary: true, nullable: false, internal: false } var details &#x3D; base.store(&quot;People&quot;).field(&quot;Name&quot;); base.close();</code></pre> </div> </section> <section> <h4>Parameter</h4> <table class="jsdoc-details-table"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Optional</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td> <p>fieldName</p> </td> <td> <p>string</p> </td> <td> <p>&nbsp;</p> </td> <td> <p>The field name.</p> </td> </tr> </tbody> </table> </section> <dl class="dl-compact"> <dt>Returns</dt> <dd> <p><code>object</code>B The object containing the details of the field. The properties are: <br>1. <code>id</code> - The ID of the field. Type B4numberB4. <br>2. <code>name</code> - The name of the field. Type <code>string</code>. <br>3. <code>type</code> - The type of the field. Type <code>string</code>. <br>4. <code>nullable</code> - If the field value can be null. Type <code>boolean</code>. <br>5. <code>internal</code> - If the field is internal. Type <code>boolean</code>. <br>6. <code>primary</code> - If the field is primary. Type <code>boolean</code>. </p> </dd> </dl> <h3 id="getMatrix"><span class="symbol-name">getMatrix</span><span class="signature"><span class="signature-params">(fieldName)</span>&nbsp;&rarr; <span class="signature-returns"> (<a href="module-la.Matrix.html">module:la.Matrix</a> or <a href="module-la.SparseMatrix.html">module:la.SparseMatrix</a>)</span></span></h3> <p>Gives a matrix containing the field values of each record.</p> <section> <h4> Example </h4> <div> <pre class="prettyprint"><code>// import qm module var qm &#x3D; require(&#x27;qminer&#x27;); // create a new base containing one store var base &#x3D; new qm.Base({ mode: &quot;createClean&quot;, schema: [{ name: &quot;ArcheryChampionship&quot;, fields: [ { name: &quot;Name&quot;, type: &quot;string&quot; }, { name: &quot;ScorePerRound&quot;, type: &quot;float_v&quot; } ] }] }); // set new records in the store base.store(&quot;ArcheryChampionship&quot;).push({ Name: &quot;Robin Hood&quot;, ScorePerRound: [50, 48, 48] }); base.store(&quot;ArcheryChampionship&quot;).push({ Name: &quot;Oliver Queen&quot;, ScorePerRound: [44, 46, 44] }); base.store(&quot;ArcheryChampionship&quot;).push({ Name: &quot;Legolas&quot;, ScorePerRound: [50, 50, 48] }); // get the matrix containing the &quot;score per round&quot; values // The values of the i-th column are the values of the i-th record. // The function will give the matrix: // 50 44 50 // 48 46 50 // 48 44 48 var matrix &#x3D; base.store(&quot;ArcheryChampionship&quot;).getMatrix(&quot;ScorePerRound&quot;); base.close();</code></pre> </div> </section> <section> <h4>Parameter</h4> <table class="jsdoc-details-table"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Optional</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td> <p>fieldName</p> </td> <td> <p>string</p> </td> <td> <p>&nbsp;</p> </td> <td> <p>The field name. Field mustn't be of type <code>string</code>.</p> </td> </tr> </tbody> </table> </section> <dl class="dl-compact"> <dt>Returns</dt> <dd> <p><code>(<a href="module-la.Matrix.html">module:la.Matrix</a> or <a href="module-la.SparseMatrix.html">module:la.SparseMatrix</a>)</code>B The matrix containing the field values.</p> </dd> </dl> <h3 id="getStreamAggrNames"><span class="symbol-name">getStreamAggrNames</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> Array of string</span></span></h3> <p>Returns an array of the stream aggregates names connected to the store.</p> <section> <h4> Example </h4> <div> <pre class="prettyprint"><code>// import qm module var qm &#x3D; require(&#x27;qminer&#x27;); // create a simple base containing one store var base &#x3D; new qm.Base({ mode: &quot;createClean&quot;, schema: [{ name: &quot;Laser&quot;, fields: [ { name: &quot;Time&quot;, type: &quot;datetime&quot; }, { name: &quot;WaveLength&quot;, type: &quot;float&quot; } ] }] }); // create a new time series window buffer stream aggregator for &#x27;Laser&#x27; store (with the JSON object) var wavelength &#x3D; { name: &quot;WaveLengthLaser&quot;, type: &quot;timeSeriesWinBuf&quot;, store: &quot;Laser&quot;, timestamp: &quot;Time&quot;, value: &quot;WaveLength&quot;, winsize: 10000 } var sa &#x3D; base.store(&quot;Laser&quot;).addStreamAggr(wavelength); // get the stream aggregates on store &quot;Laser&quot; base.store(&quot;Laser&quot;).getStreamAggrNames(); base.close();</code></pre> </div> </section> <dl class="dl-compact"> <dt>Returns</dt> <dd> <p><code>Array of string</code>B An array of stream aggregates names.</p> </dd> </dl> <h3 id="getVector"><span class="symbol-name">getVector</span><span class="signature"><span class="signature-params">(fieldName)</span>&nbsp;&rarr; <span class="signature-returns"> <a href="module-la.Vector.html">module:la.Vector</a></span></span></h3> <p>Gives a vector containing the field value of each record.</p> <section> <h4> Example </h4> <div> <pre class="prettyprint"><code>// import qm module var qm &#x3D; require(&#x27;qminer&#x27;); // create a base containing one store var base &#x3D; new qm.Base({ mode: &quot;createClean&quot;, schema: [{ name: &quot;Companies&quot;, fields: [ { name: &quot;Name&quot;, type: &quot;string&quot;, primary: true }, { name: &quot;Location&quot;, type: &quot;string&quot; } ] }] }); // add some records to the store base.store(&quot;Companies&quot;).push({ Name: &quot;DC Comics&quot;, Location: &quot;Burbank, California&quot; }); base.store(&quot;Companies&quot;).push({ Name: &quot;DC Shoes&quot;, Location: &quot;Huntington Beach, California&quot; }); base.store(&quot;Companies&quot;).push({ Name: &quot;21st Century Fox&quot;, Location: &quot;New York City, New York&quot; }); // get the vector of company names var companyNames &#x3D; base.store(&quot;Companies&quot;).getVector(&quot;Name&quot;); // returns a vector [&quot;DC Comics&quot;, &quot;DC Shoes&quot;, &quot;21st Century Fox&quot;] base.close();</code></pre> </div> </section> <section> <h4>Parameter</h4> <table class="jsdoc-details-table"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Optional</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td> <p>fieldName</p> </td> <td> <p>string</p> </td> <td> <p>&nbsp;</p> </td> <td> <p>The field name. Field must be of one-dimensional type, e.g. <code>int</code>, <code>float</code>, <code>string</code>...</p> </td> </tr> </tbody> </table> </section> <dl class="dl-compact"> <dt>Returns</dt> <dd> <p><code><a href="module-la.Vector.html">module:la.Vector</a></code>B The vector containing the field values of each record.</p> </dd> </dl> <h3 id="inspect"><span class="symbol-name">inspect</span><span class="signature"><span class="signature-params">(depth)</span>&nbsp;&rarr; <span class="signature-returns"> string</span></span></h3> <p>Inspects the stores.</p> <section> <h4>Parameter</h4> <table class="jsdoc-details-table"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Optional</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td> <p>depth</p> </td> <td> <p>number</p> </td> <td> <p>&nbsp;</p> </td> <td> <p>The depth of inspection. How many times to recurse while formatting the store object.</p> </td> </tr> </tbody> </table> </section> <dl class="dl-compact"> <dt>Returns</dt> <dd> <p><code>string</code>B String representation of the store.</p> </dd> </dl> <h3 id="isDate"><span class="symbol-name">isDate</span><span class="signature"><span class="signature-params">(fieldName)</span>&nbsp;&rarr; <span class="signature-returns"> boolean</span></span></h3> <p>Checks if the field is of type Date.</p> <section> <h4> Example </h4> <div> <pre class="prettyprint"><code>// import qm module var qm &#x3D; require(&#x27;qminer&#x27;); // create a new base containing one store var base &#x3D; new qm.Base({ mode: &quot;createClean&quot;, schema: [{ name: &quot;BasketballPlayers&quot;, fields: [ { name: &quot;Name&quot;, type: &quot;string&quot; }, { name: &quot;SeasonScore&quot;, type: &quot;int_v&quot; }, { name: &quot;DateOfBirth&quot;, type: &quot;datetime&quot; } ] }] }); // check if the SeasonScore field is of type Date var isSeasonScoreDate &#x3D; base.store(&quot;BasketballPlayers&quot;).isDate(&quot;SeasonScore&quot;); // returns false // check if the FirstPlayed field is of type Date var isFirstPlayedDate &#x3D; base.store(&quot;BasketballPlayers&quot;).isDate(&quot;DateOfBirth&quot;); // returns true base.close();</code></pre> </div> </section> <section> <h4>Parameter</h4> <table class="jsdoc-details-table"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Optional</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td> <p>fieldName</p> </td> <td> <p>string</p> </td> <td> <p>&nbsp;</p> </td> <td> <p>The field name.</p> </td> </tr> </tbody> </table> </section> <dl class="dl-compact"> <dt>Returns</dt> <dd> <p><code>boolean</code>B True, if the field is of type Date. Otherwise, false.</p> </dd> </dl> <h3 id="isNumeric"><span class="symbol-name">isNumeric</span><span class="signature"><span class="signature-params">(fieldName)</span>&nbsp;&rarr; <span class="signature-returns"> boolean</span></span></h3> <p>Checks if the field is of numeric type.</p> <section> <h4> Example </h4> <div> <pre class="prettyprint"><code>// import qm module var qm &#x3D; require(&#x27;qminer&#x27;); // create a base containing one store var base &#x3D; new qm.Base({ mode: &quot;createClean&quot;, schema: [{ name: &quot;TVSeries&quot;, fields: [ { name: &quot;Title&quot;, type: &quot;string&quot;, primary: true }, { name: &quot;NumberOfEpisodes&quot;, type: &quot;int&quot; } ] }] }); // check if the field &quot;Title&quot; is of numeric type var isTitleNumeric &#x3D; base.store(&quot;TVSeries&quot;).isNumeric(&quot;Title&quot;); // returns false // check if the field &quot;NumberOfEpisodes&quot; is of numeric type var isNumberOfEpisodesNumeric &#x3D; base.store(&quot;TVSeries&quot;).isNumeric(&quot;NumberOfEpisodes&quot;); // returns true base.close();</code></pre> </div> </section> <section> <h4>Parameter</h4> <table class="jsdoc-details-table"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Optional</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td> <p>fieldName</p> </td> <td> <p>string</p> </td> <td> <p>&nbsp;</p> </td> <td> <p>The field name.</p> </td> </tr> </tbody> </table> </section> <dl class="dl-compact"> <dt>Returns</dt> <dd> <p><code>boolean</code>B True, if the field is of numeric type. Otherwise, false.</p> </dd> </dl> <h3 id="isString"><span class="symbol-name">isString</span><span class="signature"><span class="signature-params">(fieldName)</span>&nbsp;&rarr; <span class="signature-returns"> boolean</span></span></h3> <p>Checks if the field is of string type.</p> <section> <h4> Example </h4> <div> <pre class="prettyprint"><code>// import qm module var qm &#x3D; require(&quot;qminer&quot;); // create a new base containing one store var base &#x3D; new qm.Base({ mode: &quot;createClean&quot;, schema: [{ name: &quot;People&quot;, fields: [ { name: &quot;Name&quot;, type: &quot;string&quot;, primary: true }, { name: &quot;Gender&quot;, type: &quot;string&quot; }, { name: &quot;Age&quot;, type: &quot;int&quot; } ] }] }); // check if the field &quot;Name&quot; is of string type var isNameString &#x3D; base.store(&quot;People&quot;).isString(&quot;Name&quot;); // returns true // check if the field &quot;Age&quot; is of string type var isAgeString &#x3D; base.store(&quot;People&quot;).isString(&quot;Age&quot;); // returns false base.close();</code></pre> </div> </section> <section> <h4>Parameter</h4> <table class="jsdoc-details-table"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Optional</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td> <p>fieldName</p> </td> <td> <p>string</p> </td> <td> <p>&nbsp;</p> </td> <td> <p>The field name.</p> </td> </tr> </tbody> </table> </section> <dl class="dl-compact"> <dt>Returns</dt> <dd> <p><code>boolean</code>B True, if the field is of string type. Otherwise, false.</p> </dd> </dl> <h3 id="key"><span class="symbol-name">key</span><span class="signature"><span class="signature-params">(keyName)</span>&nbsp;&rarr; <span class="signature-returns"> <a href="module-qm.html#~DetailKeyObject">module:qm~DetailKeyObject</a></span></span></h3> <p>Returns the details of the selected key as a object.</p> <section> <h4> Example </h4> <div> <pre class="prettyprint"><code>// import qm module var qm &#x3D; require(&#x27;qminer&#x27;); // create a new base containing one store var base &#x3D; new qm.Base({ mode: &quot;createClean&quot;, schema: [{ name: &quot;Countries&quot;, fields: [ { name: &quot;Name&quot;, type: &quot;string&quot;, primary: true }, { name: &quot;Population&quot;, type: &quot;int&quot; }, { name: &quot;Continent&quot;, type: &quot;string&quot; } ], keys: [ { field: &quot;Name&quot;, type: &quot;text&quot; }, { field: &quot;Continent&quot;, type: &quot;value&quot; } ] }] }); // get the details of the key of the field &quot;Continent&quot; // returns a JSON object containing the details of the key: // { fq: { length: 0 }, vocabulary: { length: 0 }, name: &#x27;Continent&#x27;, store: { name: &#x27;Countries&#x27;, ... }} var details &#x3D; base.store(&quot;Countries&quot;).key(&quot;Continent&quot;); base.close();</code></pre> </div> </section> <section> <h4>Parameter</h4> <table class="jsdoc-details-table"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Optional</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td> <p>keyName</p> </td> <td> <p>string</p> </td> <td> <p>&nbsp;</p> </td> <td> <p>The key name.</p> </td> </tr> </tbody> </table> </section> <dl class="dl-compact"> <dt>Returns</dt> <dd> <p><code><a href="module-qm.html#~DetailKeyObject">module:qm~D