You initialize the dataMineLib for use in your application by specifying one or more repository extents that will contain the datamine. Each repository extent is a Analytic Information Server object repository object. Object repository objects manage the storage and retrieval of Analytic Information Server objects to and from a disk file. To initialize dataMineLib for use, you call the dataMineLib with a Structure argument as shown in the following example:
;;Initilize a dataMineLib for use (setq myExtents #{reference: "reference.db" blackboard: "blackboard.db"}) (datMineLambda myExtents)
The structure myExtents contains the list of object repository extents that constitute the "datamine" the dataMineLib will manage. In this example there are two extents specified. The first is named reference: and the file containing the repository extent is "reference.db". The second is named blackboard: and the file containing the repository extent is "blackboard.db".
Once initialized, you can call functions on the dataMineLib and its child Lambdas and dataMineLib.miner. The functions in dataMineLib allow the creation, update and deletion of tables in the repository extents managed by dataMineLib. In addition, the dataMineLib.open function returns a table cursors object that provides a rich interface for the manipulation of tables in the dataMineLib repository extents. These table cursors come in three flavors; memory:, static: and disk:. Memory cursors load the content of an entire table into memory, static cursors provide buffered read access to a table and a disk cursor provides buffered read / unbuffered write access to a table. See the section Table Cursors for a detailed review of the table cursor object. In reading the detailed reference of dataMineLib functions provided in this section it will prove useful to have reviewed the section on Table Cursors. Many of the dataMineLib functions are simple wrappers for a sequence of functions executed on a Table Cursor.
The dataMineLib datamine is comprised of one or repository extents and each repository extent contains one or more tables. Repository extents are mobile in the sense that they can be used in different datamines at different times. Consider the example below:
;; Use the same extent in two different datamines ;; Define and initilize dataMineLib on the first datamine (setq datamine #{yearly: "yearly.db" blackboard: "blackboard.db"}) (dataMineLib datamine); Initialize the dataMineLib ;.. do some work on the open datamine ;; Define and initilize dataMineLib on the second datamine (setq datamine #{monthly: "monthly.db" blackboard: "blackboard.db" }) (dataMineLib datamine); Initialize the dataMineLib ;.. do some work on the open datamine
In the preceding example the dataMineLib was initialized against a datamine consisting of two repository extents; yearly: and blackboard:. Later the dataMineLib was initialized again against a datamine consisting of two repository extents: montly: and blackboard:. The blackboard: extent was included in both datamines. This is an example of a mobile extent.
Mobile extents are very useful because they allow you to construct datamine's from a reusable collection of extents as required by your data analysis needs. However there are some issues that you need to keep in mind when using mobile extents:
The dataMineLib provides transaction support for each repository extent. Each repository extent in the datamine maintains a transaction count. Various dataMineLib functions and Table Cursor functions increment/decrement the transaction the count. When the transaction count is incremented from a value of 0 to 1 a transaction is begun on the repository extent. When the transaction count is decremented from 1 to 0 a commit is performed on the repository extent, making all of the writes into the repository extent that have occurred since the transaction began permanent. Some dataMineLib functions are atomic. An atomic operation means that they increment the transaction count, perform their operation on the repository extent, and then decrement the transaction count before they return. Other dataMineLib functions increment the transaction count and expect some other subsequent dataMineLib functions to be called that will decrement the transaction count. The best example of these kinds of functions are the dataMineLib.open and dataMineLib.close functions that create and close table cursors.
Transaction support is most important to understand in reference to the use of table cursors. Table cursors come in three flavors; memory, disk or static. Updates to table cursor rows are possible only for memory and disk cursors. Changes made to a memory cursor are not automatically saved to the object repository and for this reason opening a memory cursor does not increment the transaction count. A static cursor is essentially read only and it also does not increment the transaction count. Disk cursors allow writes to the object repository and thus increment the transaction count when they are created. Calling close on the disk cursor decrements the open transaction count. Many dataMineLib functions may be called between the creation of the table cursor, with open, and its eventual close.
This makes it important to remember that the scope of transactions in
dataMineLib is at the object repository level. In fact, you rollback an open
transaction on a repository by calling (dataMineLib.rollback extentNum). All
writes to the object repository since the first currently opened disk cursor
will be rolled back. Consider this situation:
A disk cursor is opened on TABLE1. >>open transactions=1
A disk cursor is opened on TABLE2. >>open tranasctions=2
Rows in TABLE2 are modified and written to the object repository.
The disk cursor on TABLE2 is closed. >>open transactions=1
dataMineLib.rollback is called.
The changes made to TABLE2 are reversed. In the example above, the object repository transaction started with the opening of the disk cursor on TABLE1. This meant that the writes performed on the TABLE2 disk cursor became part of that transaction.
Invoke the dataMineLib Lambda to initialize the datamine for use. An argument is passed specifying the object repository extents that will constitute the datamine. After this initial call, the dataMineLib is ready for use.
The dataMineLib manages one or more repository extents. Each repository extent contains zero or more tables. Tables have a defined schema of columns. Each table may have zero or more rows of data. Row objects are object vectors of variable length.
The initialization call to dataMineLib must contain an argument specifying
the datamine repository extents that comprise the datamine. Up to 100
repository extents can be allocated.
Type: Function
Syntax: (dataMineLib extentStructure compress: )
Transaction: NA
extentStructure | A structure of repository extent file and path names. |
compress: | An optional argument. The symbol compress: specifies all repository extents are to use compression. |
Returns | true |
Syntax: (dataMineLib filterSource)
Transaction: NA
FilterSource | The javaScript source which is to be parsed into a Analytic Information Server parse tree. |
Returns | true |
Syntax: (dataMineLib)
Transaction: NA
Uses the global variable _dataMineExtents as the structure of repository extent file and path names. _dataMineExtents is created by dataMineLib. | |
Returns | true |
The (dataMineLib extentStructure) call is required before any other dataMineLib functions can be called.
This example initializes a datamine with three extents. Each extent must specify the complete path and file name. Extents may be placed on different physical devices as database management strategy requires. Each extent supports up to 2 gigabytes of storage space.
(define dm #{reference: "reference.db"
blackboard1: "blackboard1.db"
blackboard2: "blackboard2.db"
}) ;; end dm
(dataMineLib dm) ;;Returns true
The start up script should contain code to this effect, or the client application should issue code like this at startup.
This example parses a datamine javaScript source string into a Analytic Information Server universal parse tree. In this mode, the dataMineLib is a substitute for the Lisp parser. After parsing the parse tree may be sent to morph and compile to produce a javaScript Lambda.
(setq filterLambda (compile (morph (dataMineLib "filter sort Name"))))
This example creates a filter Lambda from the specified javaScript source string.
The addTableColumn function adds a new column to the table with the
specified name. The column is added to the end of the table columns already
defined. The addTableColumn function is not available on meta tables or member
tables (member tables belong to meta tables and must share the same column
definitions). The addTableColumn function will fail with an error if a disk or
static cursor is open on the table.
Type: Function
Syntax: (dataMineLib.addTableColumn tableName colName1…colNameN)
Transaction: Atomic.
tableName | A symbol or string containing the name of the table to which a column is to be added. If the specified table name must already exist in the datamine. |
colName1…colNameN | One or more arguments specifying column names. At least one column name must be supplied. Each argument is a symbol or string containing a column name. |
Returns | true. |
The clearCursors function closes all table cursors.
Type: Function
Syntax: (dataMineLib.clearCursors)
Transaction: Transaction count reduced to zero and commit called as necessary.
The clearDataMine function clears the datamine. All tables in all
repository extents are deleted.
Type: Function
Syntax: (dataMineLib.clearDataMine)
Transaction: Forced Commit, Transaction count is zeroed
The clearMemoPad function calls clearCursors. Use clearCursors in
new applications.
Type: Function
Syntax: (dataMineLib.clearMemoPad)
The closefunction closes a table cursor.
Type: Function
Syntax: (dataMineLib.close cursor save: )
Transaction: Decrements transaction count only on disk cursor
cursor | The transaction cursor object returned from an open function. |
save: | An optional argument available only for disk cursor. The symbol save: causes the cursors view directory to be saved. Without this option, the view directories will only be saved if updates to the table have occurred. |
Returns | true |
The compileLambda function returns a new datamine Lambda from the
specified source string. The new Lambda is compiled using the javaScript
language, and may be a scoring Lambda, or a filter Lambda.
Type: Function
Syntax: (dataMineLib.compileLambda javaString)
Transaction: NA
javaString | The javaScript source to be compiled into a data mine Lambda. |
Returns | The compiled datamine Lambda. |
The createMetaTable function creates a new meta table with the
specified name that will reference the rows of the specified member tables. The
meta table is created in the repository extent, and associated with the logical
database name, previously specified in the last usingForCreate function.
The createMetaTable function will fail if there are any open disk or static
cursors on the meta table's member tables. Meta tables create a star join index
that provides a unique index to all records referenced by the meta table. The
first component of the star join index is a key that identifies the underlying
member table the record resides in and the second component of the key is a
unique column value found in member table rows.
Type: Function
Syntax: (dataMineLib.createMetaTable tableName memberTables rowKeyColumn
maxRowKeys )
Transaction: Atomic
tableName | A symbol or string containing the name of the meta table to create. If the specified table name already exists in the datamine it will be replaced. |
memberTables | A directory of table names keyed by the TableKey. A table key can be of any type. Table keys do not have to be present in the underlying table. |
rowKeyColumn | A symbol or string containing the name of the column in the member tables that contains a uniuqe row identifier within the member table. This rowKeyColumn does not have to be unique across all member tables. |
maxRowKeys | A numeric argument specifying the maximum number of unique keys that will appear in all member tables. Do not set this value unnecessarily large as excessive memory usage will result. |
Returns | True. |
The createMetaTable Lambda marks each table specified in the memberTables directory as a member table belonging to the new meta table. Member tables may reside in different extents. Member tables may belong to only one meta table. Once created, a meta table may only be opened with a disk cursor. You may not open a disk or static cursor on a member table while a cursor is open on the owning meta table. You may not open a cursor on a meta table while a disk or static cursor is open on one of its member tables. Updates performed on a member table are reflected in it's owning meta table. Updates performed on a meta table are reflected on its member tables. You may open a memory cursor on a member table at any time but the memory cursor save function is disabled.
The last member table added to a meta table is treated differently than previously added member tables. Member tables other than the last added member table are restricted to updates that do not change the length of the member table and that do not add or remove existing unique row IDs. For example, disk cursors opened on member tables (except the last member table) do not allow inserts, appends (writing past current record count) or deletions. Memory cursors opened on member tables do not support the save function. A full range of operations are allowed on the last member table added to a meta table.
Note: Because disk and static cursors on member and meta tables can not be open at the same time, meta tables do not share the buffering of their member tables. However, buffering is available on meta tables.
;;Create a meta table on two existing tables
(setq td (new Directory:))
(setq td[#Aug,28,1986] Summary860828:)
(setq td[#Feb,28,1986] Summary860228:)
(dataMineLib.createMetaTable allSummaryTables: td ID: 3000); Create the meta table
The createTable function creates a new table with the specified name and columns. The table is created in the repository extent, and associated with the logical database name, previously specified in the last usingForCreate function.
Type: Function
Syntax: (dataMineLib.createTable tableName colName1…colNameN
)
Transaction: Atomic
tableName | A symbol or string containing the name of the table to create. If the specified table name already exists in the datamine, a "tableExists" error is raised. |
colName1…colNameN | Optional arguments. Zero or more symbols or strings naming the new table's columns. |
Returns | true. |
Syntax: (dataMineLib.createTable tableName colNameVector )
Transaction: Atomic
tableName | A symbol or string containing the name of the table to create. If the specified table name already exists in the datamine, a "tableExists" error is raised. |
colNameVector | Optional argument. A vector containing symbols or strings naming the new table's columns. |
Returns | true. |
Use createTable without any column names when you need to create a new table into which you are about to do a importTab.
The currentTable property contains a reference to a cursor object
being filtered or scored. If no table is being currently filtered or scored,
the currentTable property will contain #void. The currentTable property is used
frequently in the built in javaScript compiler.
Type: Variable
Syntax: dataMineLib.currentTable
Transaction: NA
The deleteRecord function deletes a row from the specified table in
the datamine. The delete function will fail with an error if there is an open
disk cursor on the same table. deleteRecord is not available on meta tables.
Type: Function
Syntax: (dataMineLib.deleteRecord tableName rowIndex)
Transaction: Atomic
Side Effect: If any static cursors are open on the same table they are each
reset.
tableName | A symbol or string containing the name of the table from which the record is to be deleted. |
rowIndex | The row index of the row to be deleted. |
Returns | true. |
Note: deleteRecord opens an unbuffered disk cursor, deletes the specified row and then closes the disk cursor.
The dropTable function deletes one or more specified tables from the
datamine. The dropTable function will fail with an error if there are any open
cursors on a table being dropped..
Type: Function
Syntax: (dataMineLib.dropTable tableName1 … tableNameN)
Transaction: Atomic
tableName1..tableNameN | One or more symbols or strings containing the names of tables to be deleted. |
Returns | true |
The exportTab function exports the contents of the specified table
into a ASCII tab delimited file. The column names of the table will be placed
in the first row of the exported file.
Type: Function
Syntax: (dataMineLib.exportTab tableName asciiFile)
Transaction: NA
tableName | A symbol or string containing the name of the table. |
asciiFile | A string containing the path and file name of the export file. (The first row will contain the column names). |
Returns | true |
The filterTable function runs the specified javaScript Lambda against
the specified datamine table. If a source string is provided, the new Lambda is
compiled using the javaScript language, and may be a scoring Lambda, or a filter
Lambda. The filterTable function will fail with an error if there is an open
disk cursor on the table. filterTable is not available on meta tables.
Type: Function
Syntax: (dataMineLib.filterTable tableName javaLambda)
Transaction: Atomic
Side Effect: If any static cursors are open on the same table they are each
reset.
tableName | A symbol or string containing the name of the table to be filtered. |
javaLambda | The javaScript Lambda to be run against the table specified. |
Returns | true |
Syntax: (dataMineLib.filterTable tableName javaString)
Transaction: NA
tableName | A symbol or string containing the name of the table to be filtered. |
javaString | The javaScript source string to be compiled and run against the table specified. |
Returns | true |
The filter passed to filterTable is responsible for issuing a command to make the filtering permanent in the table's bckVector.
Note: filterTable opens an unbuffered disk cursor, runs the specified javaScript commands, and the closes the disk cursor.
The getExtentNames function returns a vector containing the names of
all physical database extents allocated in the datamine.
Type: Function
Syntax: (dataMineLib.getExtentNames)
Transaction: NA
Returns | A Vector of the datamine's repository extent names is returned. |
The getTableDatabaseName function returns the database name
associated with the specified table.
Type: Function
Syntax: (dataMineLib.getTableDatabaseName tableName)
Transaction: NA
tableName | A symbol or string containing the table name. |
Returns | The database name associated with the specified table. |
The getTableNames function returns a vector containing the names of
all of the tables currently present in the datamine or the names of the tables
associated with a specified database.
Type: Function
Syntax: (dataMineLib.getTableNames databaseName)
Transaction: NA
databaseName | An optional argument. A symbol or string containing a database name. |
Returns | A Vector of datamine table names. |
The importTab function imports a specified ASCII tab delimited file
into a table. The column names must be the first row in the ASCII data file.
The importTab function will fail with an error if there is an open disk cursor
on the table. importTab is not available on meta tables.
Type: Function
Syntax: (dataMineLib.importTab tableName option asciiFile)
Transaction: Atomic
Side Effect: If any static cursors are open on the same table they are each
reset
tableName | A symbol or string containing the name of the table into which the ASCII tab delimited rows are to be imported. |
option | If overwrite: the table is cleared before import. If append: the ASCII tab delimited rows are appended to the table. |
asciiFile | A string containing the path and file name of the ASCII tab delimited import data (the first row must contain the column names). |
Returns | true |
The isTable function returns true if the specified table exists in
the datamine.
Type: Function
Syntax: (dataMineLib.isTable tableName)
Transaction: NA
tableName | A symbol or string containing the name of a table. |
Returns | Returns true if the specified table exits. |
The mergeTables function allows two tables to be updated by logically
combining information from both tables. The result of mergeTables is the
specified pair of tables are logically combined according to the merge Lambda
supplied by the caller. The caller specifies two table names, a merge field
name and a merge Lambda. Prior to calling mergeTables, both tables should
already be sorted in ascending order on the specified merge field. Rows are
read from both tables in sequential order. When two rows have matching merge
fields (the merge field name is specified by the caller), both rows are passed
to the specified merge Lambda (also specified by the caller). The merge Lambda
expects two row arguments, and logically combines information from both rows.
The matching, altered rows are written back to the tables. The mergeTables
function will fail with an error if a disk cursor is open on either table.
mergeTables is not available on meta tables.
Type: Function
Syntax: (dataMineLib.mergeTables tableName1 tableName2 mergeField mergeLambda)
Transaction: Atomic
Side Effect: If any static cursors are open on the tables they are each reset
tableName1 | A symbol or string containing the name of the table, in the datamine, which is to be logically combined (based upon a matching merge field). |
tableName2 | A symbol or string containing the name of the table, in the datamine, which is to be logically combined (based upon a matching merge field). |
mergeField | A symbol or string containing the name of the merge field. Any two rows, which have matching values in this field, will be logically combined. |
mergeLambda | An Lambda expecting two row arguments which logically merges information between two rows. |
Returns | true |
Note: mergeTables opens both tables as unbuffered disk cursors to perform the merge. The cursors are closed after the merge is complete.
Use mergeThreeTables to logically combine information from two input tables into an output table based on a specified merge field and merge Lambda. Prior to calling mergeThreeTables, both input tables should be sorted in ascending order on the specified merge field. When input rows from the two input tables have matching content, both input rows, together with a template for the output row, are passed to the specified merge Lambda. The output row returned from the merge Lambda is written to the output table. The mergeThreeTables function will fail with an error if there is an open disk cursor on the output table. The output table can not be a meta table.
Type: Function
Syntax: (dataMineLib.mergeThreeTables tableName1 tableName2 tableName3
mergeField mergeLambda)
Transaction: Atomic
Side Effect: If any static cursors are open on the output table they are each
reset
tableName1 | A symbol or string contain the name of the first input table, in the datamine, which is to be logically combined (based upon a matching merge field). |
tableName2 | A symbol or string containing the name of the second input table, in the datamine, which is to be logically combined (based upon a matching merge field). |
tableName3 | A symbol or string containing the name of the output table, in the datamine, which is to be updated (based upon logically combined information from the two matching input rows). |
mergeField | A symbol or string containing the name of the merge field. Any two input rows, which have matching values in this field, will be logically combined into an output row. |
mergeLambda | An Lambda expecting three row arguments which logically merges information from two rows into the third. |
Returns | true |
Note: Table1 and Table2 are opened as unbuffered static cursors. Table3 is opened as an unbuffered disk cursor. All cursors are closed after the merge is complete.
The open function returns a cursor for the specified table. Cursors
come in three flavors; memory, static and disk. Multiple cursors may be opened
concurrently on the same table with the restriction that only one disk cursor
per table may be opened. Memory cursors read the entire table into memory.
Static cursors provide buffered read only access to the table. Disk cursors
provide buffered read, unbuffered write access to the table.
Type: Function
Syntax: (dataMineLib.open tableName cursorType columns
bufSize)
Transaction: Increments transaction count on disk cursors only.
tableName | A symbol or string containing the name of the table to open a cursor on. |
cursorType | An optional symbol that is one of disk: static: or memory: The default is disk: |
columns | An optional vector of columns names to read. Memory cursors only! The default is all columns. |
bufSize | An optional number of rows to buffer. Static and
disk cursors only! -1 for no buffering. 0 to use previously specified buffer size. The default is -1 . |
Returns | A cursor for the specified table |
Disk and static cursors opened on the same table share a read buffer. This buffer can improve random access read performance of these cursors. If you intend to open a file and read it sequentually you should open the cursor with a bufSize of -1. This way the the contents of the existing buffer, if any, on that table will not be flushed and the overhead of managing the buffer during the read will be avoided. Memory cursors read the entire table content into memory on open. This can be very expensive and memory requirements should be considered by the application programmer to ensure that available memory is not exceeded.
;;This example opens a memory cursor on the specified columns:
(dataMineLib.open tableName memory: #(Name: Salary:))
;;This example opens a disk cursor with a 1000 row buffer:
(dataMineLib.open tableName disk: 1000)
;;This example opens a disk cursor with a 1000 row buffer:
(dataMineLib.open tableName disk: 1000)
;;This example attempts to open a memory cursor
;;with a buffer and will return an error:
(dataMineLib.open tableName memory: 1000)
;;This example attempts to open a disk cursor with a
;;columns argument and will return an error:
(dataMineLib.open tableName disk: #(Name: Salary:))
The read Record function reads a row from the
specified table in the datamine.
Type: Function
Syntax: (dataMineLib.readRecord tableName rowIndex)
Transaction: NA
tableName | A symbol or string containing the name of the table. |
rowIndex | The index of the row read. |
Returns | A copy of the row object. |
Note: readRecord opens a buffered static cursor, reads the specified row and then closes the cursor.
The recordDetails function converts a row from a table into an HTML
page. The resulting HTML page displays the details of the specified row.
Type: Function
Syntax: (dataMineLib.recordDetails tableCursor rowIndex)
Tranaction: NA
tableCursor | The table cursor. |
rowIndex | The index of the row. |
Returns | The HTML page showing the details of the specified row. |
The renameTable function renames a table with the specified new name.
The renameTable function will fail with an error if there are any open cursors
on the table.
Type: Function
Syntax: (dataMineLib.renameTable oldTableName newTableName)
Transaction: Atomic
oldTableName | A symbol or string containing the current name of the table. If the specified table name does not exist, a "tableDoesNotExist" error is raised. |
newTableName | A symbol or string containing the new table name. If the new table name already exists in the datamine, a "tableExists" error is raised. |
Returns | true. |
The setTableDatabaseName function changes the database name
associated with the specified table. If the database name does not yet exist
then it will be created. The setTableDatabaseName function will fail if there
are any open cursors on the table.
Type: Function
Syntax: (dataMineLib.setTableDatabaseName tableName databaseName)
Transaction: Atomic
tableName | A symbol or string containing the name of the table. |
databaseName | A symbol or string containing the database name. |
Returns | true. |
The sortTable function is primarily used to sort a table and update
the table's bckVector in the object repository. Unlike most other dataMineLib
functions it does not use the cursor interface. The sortTable function has a
number of other useful options as defined below. The sortTable function will
fail with an error if there are any open disk or static cursors on the table.
Type: Function
Syntax: (dataMineLib.sortTable tableName sortSpec noSave:
noSort: returnVector: returnVectorAndKeys:)
Transaction: Atomic
tableName | A symbol or string containing the name of the table. |
sortSpec | A structure containing a sort specification for the bckVector of the table. Each element of the structure contains a column name and a Ascending or Descending specifier. See examples below. |
noSave: | A symbol argument specifying that the result of the sort operation is not to be saved to the object repository. |
noSort: | A symbol argument specifying that no sort should be performed. This option is provided so that the sortTable function may be used polymorphically by the createMetaTable function. |
returnOption | An optional symbol argument of returnVector: or returnVectorAndKeys:. The returnVector: option causes sortTable to return a copy of the bckVector to the caller. bckVector is a vector of numbers containing the frame ids of each row record object in the table. The returnVectorAndKeys: option causes sortTable to return the sort vector. The sort vector contains row structures with the sort column contents and one additional column containing the frame id of the row record object. |
Returns | See returnOption. |
The sortTable function is the fastest way of creating a persistent sort on a table. It uses much less memory than performing the sort function on a memory cursor. In general, the sortTable function uses more memory than performing the sort function on a disk cursor opened with no buffering but less memory than a disk cursor opened with even a modest level of buffering.
The systemCheck function performs a systems check on the datamine. An
error is returned if any abnormalities are found.
Type: Function
Syntax: (dataMineLib.systemCheck)
The updateTable function runs the specified update Lambda against the
table causing a permanent change to the table. The update Lambda must be a
javaScript Lambda expecting one argument (the table row to be updated). Each row
in the specified table is read and passed to the update Lambda. The update Lambda
updates the row as specified and the updated row is written back to the table.
The updateTable function with fail with an error if there are any open disk
cursors on the table. updateTable is not available on meta tables.
Type: Function
Syntax: (dataMineLib.updateTable tableName updateSource)
Transaction: Atomic
Side Effect: The view directory of the table is cleared. If any static cursors
are open on the same table they are each reset.
tableName | A symbol or string containing the current name of the table. |
updateSource | The source code for the update Lambda to be run. |
Returns | true |
Syntax: (dataMineLib.updateTable tableName updateLambda)
Transaction: Atomic
tableName | A symbol or string containing the current name of the table. |
updateLambda | The update Lambda to be run against the table. |
Returns | true |
Note: updateTable opens an unbuffered disk cursor, updates each record in the cursor's bckVector, then closes the disk cursor.
The usingForCreate function sets the repository extent and database
name for subsequently created tables. Use the createTable function to create
new tables.
Type: Function
Syntax: (dataMineLib.usingForCreate extentName databaseName)
Transaction: NA
extentName | A symbol or name containing the name of the repository extent. |
databaseName | A symbol or name containing the name of the database. |
Returns | True |
This example initializes the dataMineLib, calls usingForCreate and then calls createTable.
;; Initialize the datamine.
(setq _dataMineExtents #{reference: "reference.db" blackboard: "blackboard.db"})
(dataMineLib _dataMineExtents)
;; Set the physical area and logical database name for all new tables.
(dataMineLib.usingForCreate reference: "Sales Data")
;; Create a new table
(dataMineLib.createTable salesSummary: #(Date: Amount:))
In the example above the repository extent reference: contains a table named salesSummary: that belongs to the database "Sales Data".
The writeRecord function writes a row to the specified table in the
datamine. The writeRecord function will fail with an error if there is an open
disk cursor on the table. writeRecord is not available on meta tables.
Type: Function
Syntax: (dataMineLib.writeRecord tableName rowIndex record)
Transaction: Atomic
Side Effect: The view directory of the table is cleared. If any static cursors
are open on the same table they are each reset
tableName | A symbol or string containing the table name of the table. |
rowIndex | The index of the row to be written. |
Returns | true. |
Note: writeRecord opens an unbuffered disk cursor, writes the record and then closes the disk cursor.