Visual Explain XML Specification


Introduction

XML file is used by Visual Explain to transfer information between database engine side and client side. Java api collects information and generates XML file , this XML file will be used as information input to Visual Explain.

The basic construct in the specification remains very flexible while includes specific enough structures that will enable us to explain and describe the relationship among the tables and descriptors that are part of the entire knowledge base for Visual Explain. We have currently adopted the theology to employ a list-based structure to flexibly represent any possible combination of number of children or sibling nodes in the structure, and flexible enough for us to add more relationships later without too much change to our fundamentals.


DTD for Visual Explain

Following is the complete DTD for XML format used by Visual Explain. The detailed explanation of this DTD file will be found in the following section.

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE osc[
<!ELEMENT osc (info)+>
<!ATTLIST osc  appversion  CDATA  #REQUIRED
         db2version CDATA #REQUIRED
         db2platform CDATA "Z/OS"
         timestamp CDATA #REQUIRED>

<!ELEMENT info ( source,attrview*,diagram*, descriptor*, overview*)>
<!ATTLIST info type (service|management)  #REQUIRED
        usage  CDATA       #REQUIRED
        mode  (standard| compatible) #IMPLIED>

<!ELEMENT source ( query+)>
<!ATTLIST    source  type ( singlequery | scriptfile )   #REQUIRED
         name  CDATA       #IMPLIED>
<!ELEMENT   query  (#PCDATA)>
<!ELEMENT  diagram ( node+ )>
<!ATTLIST   diagram    structure (tree|table) "tree"
         id      ID     #REQUIRED
         name    CDATA #REQUIRED
         seqno    CDATA #IMPLIED>
<!ELEMENT  node (label+, descriptorlink?,node*)>
<!ATTLIST  node   id  CDATA #REQUIRED
         type CDATA #REQUIRED
         alignment ( hleft | hmid | hright | vabove | vmid | vbelow )  #REQUIRED
         seqno  CDATA  #IMPLIED>
<!ELEMENT label  EMPTY>
<!ATTLIST label  type  CDATA  #REQUIRED
         text    CDATA #REQUIRED>
<!ELEMENT descriptorlink  EMPTY>
<!ATTLIST   descriptorlink descriptorid  IDREF  #REQUIRED
        type   CDATA   #IMPLIED>
<!ELEMENT descriptor (attrTitle,attr*,attrviewId* , descriptorlinklist*)>
<!ATTLIST   descriptor   id      ID #REQUIRED
          name CDATA #IMPLIED
          type CDATA #REQUIRED>
<!ELEMENT attrTitle EMPTY>
<!ATTLIST attrTitle  nameTitle CDATA "Name"
            valueTitle CDATA "Value"
                        otherTitle1 CDATA  #IMPLIED
                        otherTitle2 CDATA  #IMPLIED>
<!ELEMENT attr (descriptorlink?)>
<!ATTLIST  attr  id CDATA #REQUIRED
          name CDATA #REQUIRED
          value  CDATA #REQUIRED
                otherValue1 CDATA #IMPLIED
                otherValue2 CDATA #IMPLIED
          type CDATA #REQUIRED
                level   CDATA   #IMPLIED>
<!ELEMENT attrview (attrseq+)>
<!ATTLIST attrview id ID #REQUIRED
          type  CDATA #REQUIRED>
<!ELEMENT  attrviewId EMPTY>
<!ATTLIST  attrviewId id IDREF #REQUIRED>
<!ELEMENT   attrseq  EMPTY>
<!ATTLIST attrseq  attrid CDATA #REQUIRED
          order CDATA #REQUIRED>
<!ELEMENT descriptorlinklist (descriptorlink*)>
<!ATTLIST descriptorlinklist name CDATA #REQUIRED>
<!ELEMENT overview (overviewnode*)>
<!ATTLIST overview diagramid  IDREF #REQUIRED
      name CDATA #REQUIRED
      type  CDATA #REQUIRED>
<!ELEMENT overviewnode (overviewnode*)>
<!ATTLIST overviewnode diagramid IDREF #REQUIRED
             nodeid  CDATA #REQUIRED
             alignment ( hleft | hmid | hright | vabove | vmid | vbelow ) #REQUIRED
                            seqno       CDATA   #IMPLIED>
]>
 
 

Detailed Explanation

Note : In this section , XML DTD is in blue color , corresponding
explanation is in black color , key words are in bold and italic format .

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE osc[
<!ELEMENT osc (info)+>
<!ATTLIST osc  appversion  CDATA  #REQUIRED
         db2version CDATA #REQUIRED
         db2platform CDATA "Z/OS"
         timestamp CDATA #REQUIRED>


<!ELEMENT info ( source,attrview*,diagram*, descriptor*, overview*)>
<!ATTLIST info type (service|management)  #REQUIRED
        usage  CDATA       #REQUIRED
        mode  (standard| compatible) #IMPLIED>

<!ELEMENT source ( query+)>
<!ATTLIST    source  type ( singlequery | scriptfile )   #REQUIRED
         name  CDATA       #IMPLIED> <!ELEMENT   query  (#PCDATA)> <!ELEMENT  diagram ( node+ )>
<!ATTLIST   diagram    structure (tree|table) "tree"
         id      ID     #REQUIRED
         name    CDATA #REQUIRED
         seqno    CDATA #IMPLIED> <!ELEMENT  node (label+, descriptorlink?,node*)>
<!ATTLIST  node   id  CDATA #REQUIRED
         type CDATA #REQUIRED
         alignment ( hleft | hmid | hright | vabove | vmid | vbelow )  #REQUIRED
         seqno  CDATA  #IMPLIED>
  <!ELEMENT label  EMPTY>
<!ATTLIST label  type  CDATA  #REQUIRED
         text    CDATA #REQUIRED> <!ELEMENT descriptorlink  EMPTY>
<!ATTLIST   descriptorlink descriptorid  IDREF  #REQUIRED
        type   CDATA   #IMPLIED>
  <!ELEMENT descriptor (attrTitle,attr*,attrviewId* , descriptorlinklist*)>
<!ATTLIST   descriptor   id      ID #REQUIRED
          name CDATA #IMPLIED
          type CDATA #REQUIRED>
  <!ELEMENT attrTitle EMPTY>
<!ATTLIST attrTitle  nameTitle CDATA "Name"
            valueTitle CDATA "Value"
                        otherTitle1 CDATA  #IMPLIED
                        otherTitle2 CDATA  #IMPLIED> <!ELEMENT attr (descriptorlink?)>
<!ATTLIST  attr  id CDATA #REQUIRED
          name CDATA #REQUIRED
          value  CDATA #REQUIRED
                otherValue1 CDATA #IMPLIED
                otherValue2 CDATA #IMPLIED
          type CDATA #REQUIRED
                level   CDATA   #IMPLIED>
  <!ELEMENT attrview (attrseq+)>
<!ATTLIST attrview id ID #REQUIRED
          type  CDATA #REQUIRED>
  <!ELEMENT  attrviewId EMPTY>
<!ATTLIST  attrviewId id IDREF #REQUIRED> <!ELEMENT   attrseq  EMPTY>
<!ATTLIST attrseq  attrid CDATA #REQUIRED
          order CDATA #REQUIRED> <!ELEMENT descriptorlinklist (descriptorlink*)>
<!ATTLIST descriptorlinklist name CDATA #REQUIRED> <!ELEMENT overview (overviewnode*)>
<!ATTLIST overview diagramid  IDREF #REQUIRED
      name CDATA #REQUIRED
      type  CDATA #REQUIRED>
<!ELEMENT overviewnode (overviewnode*)>
<!ATTLIST overviewnode diagramid IDREF #REQUIRED
             nodeid  CDATA #REQUIRED
             alignment ( hleft | hmid | hright | vabove | vmid | vbelow ) #REQUIRED
                            seqno       CDATA   #IMPLIED>
]> 

XML Example

This XML example shows the information needed by Visual Explain . The structure is in a tree mode.
This XML example is based on the following query " SELECT SUM(N_NATIONKEY), SUM(N_NATIONKEY), SUM(N_NATIONKEY), SUM(N_NATIONKEY), SUM(N_NATIONKEY), AVG(N_NATIONKEY), AVG(N_NATIONKEY), AVG(N_NATIONKEY), AVG(N_NATIONKEY), AVG(N_NATIONKEY), COUNT(*) FROM NATION_NP"
This XML is in the format of DB2 Version 8 , standard mode , so there is only one diagram for the whole query .

The content of this example is as follows: