XMLDSSFromRDB
Keywords: uk.ac.bbk.dcs.automed.xml.relational.XMLDSSFromRDB class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## uk.ac.bbk.dcs.automed.xml.relational
Class XMLDSSFromRDB

    java.lang.Object
      uk.ac.bbk.dcs.automed.xml.relational.XMLDSSFromRDB

    public class XMLDSSFromRDB

extends java.lang.Object

1. Create graph

   A DirectedGraph object contains a set of pointers to DirectedGraphNode objects and a set of pointers to other Graph objects A DirectedGraphNode object contains a name, a set of incoming edges and a set of outgoing edges, both pointing to other objects of the same type.

   Create a DirectedGraph object G. Create a two-dimensional structure S which will hold information on which attributes each relation has.

   For every construct C in the database schema

   - If C is a relation
     - Create a DirectedGraphNode object N
     - Add N to G
   - If C is a foreign key
     - Get the referencing node R1 and the referenced node R2
     - Update the incoming and outgoing edges sets of R2 and R1 respectively
   - If C is an attribute, update S with the necessary information
2. Transform graph to forest

   Divide a given graph into subgraphs:

   For every DirectedGraphNode N in the set of nodes of Graph G that was not visited before:

   - Create a new SubGraph object SG (mark1)
   - Mark the node as visited
   - Consider the sets of incoming and outgoing edges.
   - Treat each node G' in the two sets just as N in (mark1)
   - Add SG to the set of SubGraphs of G

   Then convert each one to a tree and add it to the Forest object:

   - Select as the entry point the first DirectedGraphNode which has no incoming edges. If no such DirectedGraphNode exists, select the one with the least outgoingEdges.
   - Set the entry point to be node N
   - For every DirectedGraphNode N: (mark2)
     - Create a new TreeNode object T
     - Set the name of T to be the same as N's
     - If N is not the chosen root, set the parent of T
     - For every node N' in the set of outgoing edges of N, treat N' as N in (mark2)
3. Transform forest to tree by inserting generic root node.
4. Traverse generic tree and insert XMLDSS constructs, creating mixed schema.

   For every TreeNode T in the tree:

   - If T is the root: add the PCDATA construct, then add T in the schema
   - Else:
     - Add T to the schema
     - Add a nestList from T to its parent
     - For every attribute A belonging to T (consulting structure S from step 1)
       - Add to the schema
       - Add a nestList from A to T
       - Add a nestList from PCDATA construct to A
5. Traverse mixed schema and delete relational constructs.

Author:
  Lucas Zamboulis

Field Summary
`static java.lang.String` | `oracle`
`static java.lang.String` | `postgres`

Constructor Summary
`XMLDSSFromRDB(java.lang.String dbType, java.lang.String username, java.lang.String password, java.lang.String driver, java.lang.String url, java.lang.String sName)`

Method Summary
`void` | `getAMXMLDSS()` This method first creates a network of tables, based on their foreign key dependencies.
`Schema` | `getRDBDSSchema()`
`Schema` | `getXMLDSSSchema()`
`void` | `setXMLDSSSchema(Schema s)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### oracle

    public static final java.lang.String oracle

See Also:
  Constant Field Values

### postgres

    public static final java.lang.String postgres

See Also:
  Constant Field Values

Constructor Detail

### XMLDSSFromRDB

    public XMLDSSFromRDB(java.lang.String dbType,
                         java.lang.String username,
                         java.lang.String password,
                         java.lang.String driver,
                         java.lang.String url,
                         java.lang.String sName)

Parameters:
  `dbType` - the database type, e.g. Oracle
  `username` - the database username
  `password` - the database password
  `driver` - the database driver
  `url` - the URL where the database resides
  `sName` - the schema name

Method Detail

### getAMXMLDSS

    public void getAMXMLDSS()
                     throws java.lang.Exception

  This method first creates a network of tables, based on their foreign key dependencies. Then it converts this network into a forest. Then it traverses the forest and inserts XMLDSS constructs in the original relational AutoMed schema. Then it removes all relational constructs from the original relational AutoMed schema.

  It therefore effectively converts a relational AutoMed schema into an XMLDSS AutoMed schema.

  Throws:
    `java.lang.Exception`

### getXMLDSSSchema

    public Schema getXMLDSSSchema()

### getRDBDSSchema

    public Schema getRDBDSSchema()

### setXMLDSSSchema

    public void setXMLDSSSchema(Schema s)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD