« Back to Karlsruhe Institute of Technology (KIT)

Storing attribute values in DB and retrieving them

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Storing attribute values in DB and retrieving them
community external coupling documentation transformation adoscript
Answer
3/27/14 11:35 AM
Hey together,
we have a class Object Store with the attribute XML documents: ObjStoreClass.jpg
The attribute XML Documents is a Table Record attribute and currently stores directory paths to XML files located on the VM. Instances of Object Store can contain different numbers of XML Documents entries: ObjStoreInstanceNotebook.jpg

Our script searches through these lists of RECORD TABLE entries and retrieves the XML files several times which slows down the script (we assume). What we  would like to do is store the XML files directly in an database table and access them directly, e.g. a database table provided by ADOxx. So when the user would set up an Object Store he would select and XML file from the file system which would be stored somehow in the database. When the script runs he accesses the database and gets teh XML file directly from there.
Is this somehow possible to realize.
Attachment

Attachment

Attachments: ObjStoreClass.JPG (110.4k), ObjStoreInstanceNotebook.JPG (63.7k)

Thread moved to KIT category
Answer
3/18/14 10:00 AM as a reply to Gleb Gawriljuk.
Thread moved to KIT category

RE: Storing attribute values in DB and retrieving them
Answer
3/18/14 10:12 AM as a reply to Gleb Gawriljuk.
We did have a look at the case with the aim to understand the performance issues you face. In order to test and validate the scenario, I did setup a dummy modeltype with a single class and and the table as described in your message. In addition, I also added an event log to that implementation to trace the time from trigger of the script to finalization. Please find a short analysis below with a model containing 24 instances, each with 8 different XML documents setup in the table and pointing to an about 100KB XML file:

For the analysis, we make use of a self-developed EVENT Debugging Panel to capture the times it takes to perform the script and compare start and end times. To add this to your library, copy the following lines into the "AppInitialized" EVENT of the "External coupling" library attribute:
 1# create the dockable window for the output stream
 2CC "AdoScript" CREATE_OUTPUT_WIN winid:"EVENTLOG" title:"Event Logging"
 3
 4# establish a global procedure as a helper implementation for timestamped logging
 5PROCEDURE global EVENT_LOG msgType:string message:string {
 6  CC "Application" GET_DATE_TIME
 7  date-format:"dd/mm/yyyy" time-format:"hh:mm:ss"
 8  SET currentDateTime: ((date) + " " + (time))
 9  CC "AdoScript" OUT winid:"EVENTLOG" text: ("[" + (msgType) + "@" + currentDateTime + "]: " + (message) + "\n")
10}

To add a statement in the new window, use:
1# Initial event log message for the "AppInitialized" event
2EVENT_LOG msgType:"EVENT_LOG"  message: ("AppInitialized")



The implementation of all cases is packaged in the attached ZIP file, the library can be accessed through the ABL file. Make sure to correct the script paths in the "External coupling" library attribute. As XML files, any XML file can be used.


1) ONLY parsing pointers and reading content into ADOxx as String
-> less than 1 second, see console output below
[EVENT_LOG@19/12/2013 16:22:02]: Start parse and read of model content
[EVENT_LOG@19/12/2013 16:22:02]: End parse and read of model content

2) Parsing pointers and reading content into ADOxx as String, write back to a temporary file on the local machine
-> about 1 second, see console output below
[EVENT_LOG@19/12/2013 16:23:32]: Start parse and read of model content
[EVENT_LOG@19/12/2013 16:23:33]: End parse and read of model content

3) Parsing pointers and reading content into ADOxx as String, write back to a temporary file, perform an XSL transformation
-> 1min and 20secs, see console output below
[EVENT_LOG@19/12/2013 16:24:10]: Start parse and read of model content
[EVENT_LOG@19/12/2013 16:25:30]: End parse and read of model content

4) Parsing pointers and reading content into ADOxx as String, write back to a temporary file, perform an XSL transformation, store transformation results in ADOxx
-> 1min and 21secs, see console output below
[EVENT_LOG@19/12/2013 16:26:26]: Start parse and read of model content
[EVENT_LOG@19/12/2013 16:27:47]: End parse and read of model content

From the analysis above, we do assume that the transformation step is problematic, meaning the external call to the XML parser/transformer.
Attachments: XMLContentReader - Demonstration Library.abl (13.8k), XMLReaderAdoScripts.zip (4.3k)