Difference between revisions of "File:Opasnet base connection.ANA"

From Testiwiki
Jump to: navigation, search
m (categorised)
(uploaded a new version of "Image:Opasnet base connection.ANA": Small edits)
(No difference)

Revision as of 05:38, 1 December 2008


This model is a compilation of image:RDB connection.ANA and image:RDB reader.ANA. It reads and writes variable results from and to Opasnet base.

Reading

Reading is allowed for everyone. The function Rdb_to_var reads the result of a variable from Opasnet base and transforms the information into the form of an Analytica node. Note that all indices required must be created before the function works properly. To learn about the indices, run the function Do_first.


Writing

You can freely open and use the module, but you cannot actually write information into the Result database unless you have a password. Note that the necessary variable, index, dimension, and run information will be asked. You must fill in all tables before the process is completed. You can insert several variables at the same time. Each variable MUST have at least one index.

To do: improvement needs

  • Run_list table needs the field Var_id. This will help identification of variables in each run without the need to go through result_id. The model should contain formula to fill it.
  • Loc_of_result.Ind_id must be updated in the RDB. Now it is empty. Does the model contain formula to fill it?
  • There should be a button for converting nodes into edit tables. This is because some models are using external data that cannot be accessed with other versions than Analytica Enterprise. The button would simply do (Va1:= Va1) for each variable in the variable list.
  • The correct IP should be used so that the model works in the Internet as well. The correct IP is 193.167.179.97.

Functions

RDB_to_var:

Brings the results from the Opasnet base and transforms it into variables of the correct form. NOTE! All necessary indices must be created before running this function. The necessary indices can be viewed by calling the function Do_first with the same two parameters as this function.

PARAMETERS:

  • Var_name: the name of the variable in the result database.
  • Run_id: the identifier of the run from which the results will be brought. If omitted, the newest result will be brought.
  • Textornot: Tells whether the result is numerical or text. If parameter is omitted or false, numerical is assumed, otherwise text.


Do_first:

This function brings the variable from the Result database and analyses its structure. Each index used will be shown as a column along '.Ind_name', and each location of that index will be shown along '.K'. The last row of '.K' shows the samplesize of the variable. Use this information to create the necessary indices for your model and to adjust the samplesize of the model. If the samplesize of the model is smaller than in the result database, the remaining samples are omitted; if larger, the cells with no results in the database are replaced with null. NOTE! The indices created should be lists of labels (not lists of numbers).

PARAMETERS (see also above):

  • Var_name
  • Run_id

SQL code in the model

SQL for Dimension table:

<sql-query display="1"> SELECT Dim_id, Dim_name FROM `Dimension` </sql-query>

SQL for Indices table:

<sql-query display="1"> SELECT Ind_id, Ind_name, Dimension.Dim_id, Dim_name FROM `Index`, Dimension WHERE `Index`.Dim_id=Dimension.Dim_id </sql-query>

SQL for Locations table:

<sql-query display="1"> SELECT Loc_id, Location, Dimension.Dim_id, Dim_name FROM `Location`, `Dimension` WHERE Location.Dim_id = Dimension.Dim_id </sql-query>

SQL for Variables table:

<sql-query display="1"> SELECT Var_id, Var_name FROM `Variable` </sql-query>

Readdata: SQL query:

<sql-query display="1"> SELECT Variable.var_name, var_unit, Loc_of_result.result_id, result, sample, dim_name, ind_name, location, Run.run_id, run_method FROM Variable, Result, Loc_of_result, Location, Dimension, `Index`, Run_list, Run WHERE Variable.var_name = "'&Var_name&'" AND Run.run_id = '&Run_id&' AND Variable.var_id = Loc_of_result.var_id AND Loc_of_result.result_id = Result.result_id AND Loc_of_result.loc_id = Location.loc_id AND Loc_of_result.ind_id = `Index`.ind_id AND Location.dim_id = Dimension.dim_id AND Loc_of_result.result_id = Run_list.result_id AND Run_list.run_id = Run.run_id </sql-query>

Newestrun SQL query:

<sql-query display="1"> SELECT Run_id FROM Variable , Loc_of_result, Run_list WHERE Variable.var_name = "'&Var_name&'" AND Variable.var_id = Loc_of_result.var_id AND Loc_of_result.result_id = Run_list.result_id </sql-query>

File history

Click on a date/time to view the file as it appeared at that time.

(newest | oldest) View (newer 10 | ) (10 | 20 | 50 | 100 | 250 | 500)
Date/TimeDimensionsUserComment
current10:26, 21 August 2010 (80 KB)Jouni (talk | contribs)Major simplifying revisions: lot of memory-saving improvements. Two input formats rejected. Intermediate nodes merged to save memory. Bugs corrected.
19:30, 12 July 2010 (92 KB)Jouni (talk | contribs)Now it is quick also with probabilistic data, as I changed while-do loop to for x[]:= b loop. In addition, the obs in a deterministic table is the row number, while before it was just zero.
13:42, 12 July 2010 (92 KB)Jouni (talk | contribs)As expected, Cellrow node was too heavy with large data. This part was streamlined. Now it is quick and simple with deterministic data, but takes a long time with large probabilistic data (little memory need, though).
22:22, 11 July 2010 (92 KB)Jouni (talk | contribs)Still some bugs found but it seems to work now.
05:05, 10 July 2010 (107 KB)Jouni (talk | contribs)Model tested with several options and now it always works! This is now version 2.0. All descriptions were moved to file:Opasnet base connection.ANA (technical) and Uploading to Opasnet Base (method) and updated.
14:56, 9 July 2010 (121 KB)Jouni (talk | contribs)Tested and now it works except bugs were found from W_Actobj and Cell, because they depend on uploaded tables and the update too fast. Maybe a static node in between solves this problem.
23:05, 8 July 2010 (136 KB)Jouni (talk | contribs)Update finalised and first tests are successful. The code has become much simpler, it can even been understood by outsiders.
14:11, 8 July 2010 (126 KB)Jouni (talk | contribs)Code streamlined. All different upload types seem to work to Data_table phase but not further. Added observise function to work with table-based prob data.
22:50, 7 July 2010 (108 KB)Jouni (talk | contribs)Index info was rejected because it caused trouble with updating, was complex, and didn't bring anything essential. Some bugs removed. Should work now but haven't tested yet. Code starts to be simple and beautiful. Stuff moved to Old parts.
15:13, 7 July 2010 (105 KB)Jouni (talk | contribs)Uploading part streamlined and corrected. Not all upload methods worked properly. There is still some problem.
(newest | oldest) View (newer 10 | ) (10 | 20 | 50 | 100 | 250 | 500)
  • You cannot overwrite this file.

The following 3 pages link to this file: