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

From Testiwiki
Jump to: navigation, search
(uploaded a new version of "Image:Opasnet base connection.ANA": SQL updates but only half way through. The Opasnet base structure is still changing.)
(technical edits)
 
(76 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
[[Category:Opasnet]]
 +
[[Category:Opasnet Base]]
 
[[Category:Analytica tool]]
 
[[Category:Analytica tool]]
 
[[Category:SQL tool]]
 
[[Category:SQL tool]]
 
[[Category:Open assessment]]
 
[[Category:Open assessment]]
{{tool}}
+
{{tool|moderator=Jouni}}
This model is a compilation of [[:image:RDB connection.ANA]] and [[:image:RDB reader.ANA]]. It reads and writes [[variable]] [[result]]s from and to [[Opasnet base]].  
+
''This page relates to old versions of [[Opasnet Base (2008-2011)]] and its connections. For the current database version, see [[Opasnet Base]].
  
'''Reading
+
This model is an interface for uploading data to and downloading it from the [[Opasnet Base]]. For using the file, you need [[Analytica]] Enterprise.
  
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.
+
[[Uploading to Opasnet Base]] helps you understand what data could and should be updated to [[Opasnet Base]] and what the recommended data structures and formats are. For technical instructions how to use the current upload software, see [[Opasnet Base connection]]. For a general description about the database, see [[Opasnet Base]] and for technical details about the database, see [[Opasnet Base structure]]. For details about downloading data, see [[Opasnet Base UI]].
  
 +
'''Some key parts of OBC explained
  
'''Writing
+
; Findid: This function gets an id from a table. It has the following parameters: '''in''': the property for which the id is needed. In MUST be unique in cond and it must contain index i. '''table''': the table from where the id is brought. The table MUST have .j as the column index, .i as the row index, and a column named 'id'. '''cond''': the name of the field that is compared with in. Cond must be text.
  
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.
+
;Textify: Changes a number to a text value with up to 15 significant numbers. This bypasses the number formatting problem that tends to convert e.g. 93341 to '93.34K'. If the input is null, the result is ''.
  
==To do: improvement needs==
+
==See also==
  
*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.
+
* [[Opasnet Base Connection for R]]
* Loc_of_result.Ind_id must be updated in the RDB. Now it is empty. Does the model contain formula to fill it?
+
* [[Opasnet Base]]
* 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.
+
* [[Opasnet Base structure]]
* The correct IP should be used so that the model works in the Internet as well. The correct IP is 193.167.179.97.
+
* [[Uploading to Opasnet Base]]
 
+
* [[Opasnet Base UI]]
===Functions===
+
* Previous version [[:image:RDB connection.ANA]] and [[:image:RDB reader.ANA]] were only for either reading or writing data.
 
+
[[Category:Opasnet Base]]
'''RDB_to_var:
+
* [http://cs.stanford.edu/people/thathoo/rmysql.pdf Guidance document for RMySQL] (the MySQL database connection for [[R]] software.
 
 
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>
 

Latest revision as of 19:01, 10 April 2015


This page relates to old versions of Opasnet Base (2008-2011) and its connections. For the current database version, see Opasnet Base.

This model is an interface for uploading data to and downloading it from the Opasnet Base. For using the file, you need Analytica Enterprise.

Uploading to Opasnet Base helps you understand what data could and should be updated to Opasnet Base and what the recommended data structures and formats are. For technical instructions how to use the current upload software, see Opasnet Base connection. For a general description about the database, see Opasnet Base and for technical details about the database, see Opasnet Base structure. For details about downloading data, see Opasnet Base UI.

Some key parts of OBC explained

Findid
This function gets an id from a table. It has the following parameters: in: the property for which the id is needed. In MUST be unique in cond and it must contain index i. table: the table from where the id is brought. The table MUST have .j as the column index, .i as the row index, and a column named 'id'. cond: the name of the field that is compared with in. Cond must be text.
Textify
Changes a number to a text value with up to 15 significant numbers. This bypasses the number formatting problem that tends to convert e.g. 93341 to '93.34K'. If the input is null, the result is .

See also

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: