Personally, I am still not sure how you would create an XML file for an AW without using Analytic Workspace Manager, however, based on recent posts on the OLAP forum and from questions posted to our internal help mail list, it is obvious there are people actually designing and building AWs without ever using AWM. So I going to make the assumption that you have somehow managed to created your XML file that describes a dimension or a cube, or any other supported object, and question now is how do you load that file into the AW?
The first thing you need to do is to find this extremely useful jar file, called ImportXML.jar file. For the moment you will have to email me (firstname.lastname@example.org) to get a copy of this file, but hopefully the product management team will get it hosted on the OLAP OTN home page very shortly. Once you have this jar file you can create a script file as follows:
java.exe -classpath .\ImportXML.jar samples.awxml.ImportXML %1 %2 %3 %4 %5 %6 %7 %8 %9
The script takes the following arguments
- id/pwd ID and Password
- -con [host:port:sid] Connect string (e.g. localhost:1521:orcl)
- -aw [TargetAW] AW that is the target for the XML input (required when XML does not include a complete AW)
- - file [file] Name of XML file
1. Importing an object (e.g. a calculation) into the GLOBAL analytic workspace:
- import scott/tiger -con localhost:1521:orcl -aw global -file my_model.xml
2. Importing an entire analytic workspace:
- import scott/tiger -con localhost:1521:orcl -file global_aw.xml
The above script can be used with the XML template files generated by Analytic Workspace Manager as well. Alternatively you can manually create your own (as some of you are quite clearly doing!). If you are manually creating these files, or just want to modify an existing file to make some changes hopefully the following overviews will help:
Structure of an XML File: Each XML file is broken down into four basic blocks, which relate to the type of work being performed.
- Step 1 is to attach the required AW via an “Attach Id” tag.
- Step 2 is to process the object identified within the file
- Step 3 is to commit all changes
- Step 4 is detach the AW
Delete Alter ActiveObject Id
Attaching an AW
The process for attaching is very simple. There are two ways to do this, you either:
- pass a parameter into your script file via the command line using -AW aw_name
- code the AW and schema name into the XML file
(I am hoping you can read this code!). The process is quite straightforward. The first four lines are the normal XML header information, after that comes the following:
- Attach tag with an Id tag that contains an the word Action with a number, like this "Action1" . This controls the order of processing and in an normal XML file you will see this repeated with numbers increasing sequentially through the file
- ActiveObject tag starts the block to identify what the file is going to process which is determined by the next line
- In this case the attach needs to process an AW so an AW tag is used to identify the specific AW to be attached
- The last three rows contain the termination tags for rows 1,2 and 3.
Committing Changes within an AW
The process for committing is the same as the attach process except the tag Commit is used. Because during a session we could in theory have mulitple AWs attached the commit block still requires an ActiveObject block to identify the AW to be updated. This allows to not update other AWs as required.
Detaching an AW
The process for detaching is also the same as the attach process except the tag Detach is used. Because during a session we could in theory have mulitple AWs attached the detach block still requires an ActiveObject block to identify the AW to detach.
Building a CREATE Script
Create scripts are the output from Analytic Workspace Manager. After the main header block you will find a Create tag with an associated Id that defines the action reference for the create statement. If you are using the Attach tag as well, then the number associated with "Action" for the Create block must be greater than that used in the Attach block. It all sounds very complicated but when you see the code it is very simple.
The Create block identifies the create process in full. For a dimension that full process is:
- Dimension name
- Dimension labels
- Dimension attributes
- Dimension levels
- Dimension hierarchies
- Dimension mappings
Building a DELETE Script
Performing a Delete operation in Analytic Workspace Manager is very simple - highlight the object and hit the delete key. Assuming there are no supporting objects that prevent the delete process from running the object will be deleted - for example you cannot delete a dimension while it is still associated with a cube. However, outside of Analytic Workspace Manager the XML file does provide a Delete tag to allow for command line deletion of objects. The amount of information you need to supply to delete an object is minimal. For a dimension it is simply the lines containing the Dimension tag and the end-Dimension tag. The delete process will remove all the objects with dimension automatically.
Building an ALTER Script
It is possible to update certain parts of an AW using this method. To be honest, I have not tried everything. According to the Java documentation this method allows you to update any of the text attributes, such as:
- Long descriptive label
- Short descriptive label
- Plural descriptive label