uk.ac.bbk.dcs.automed.xml.xmldssGraph
Class XMLDSSRestructurer

java.lang.Object
  extended by uk.ac.bbk.dcs.automed.xml.xmldssGraph.XMLDSSRestructurer

public class XMLDSSRestructurer
extends java.lang.Object

Class that automatically integrates two fully conformed AutoMed XML DataSource Schemas S1 and S2.

Main Pseudocode:

  • Apply the growing phase on S1 (with NestList reordering)
  • Apply the growing phase on S2 (without NestList reordering)
  • Apply ident transformation on S1 and S2

  • Growing Phase Pseudocode:

    Traverse target schema in a depth-first way. For each element e in T, do:

    1. If e does not exist in S:
      1. If parent(e,S) has an attribute a with the same tag as e in T: attribute-to-element transformation
      2. Else, insert e in S with an extend transformation. Populate e by generating one instance of e for every instance of parent(e,S).
    2. Treat NestList to e:
      1. If parent(e,S)==parent(e,T), make sure ordering is correct (NestList may have already existed, or inserted from an attribute-to-element transformation).
      2. Else, insert a NestList from parent(e,T) in S to e. Populate it by using the existing path from parent(e,T) in S to e.
    3. For each attribute a of e in T, if e in S does not contain a:
      1. If e in S has a child element with the same tag as a and has PCData/CData: element to attribute transformation.
      2. Else, insert a with an extend transformation. Do not populate it, i.e. treat it as an optional attribute
    4. If e in T is connected to the PCData/CData construct with m NestLists, while e in S is connected to the PCData/CData construct with n NestLists, where n<m, insert (m-n) NestLists from e in S to the PCData/CData construct using extend transformations and the constants Void and Any.

    NOTE Synthetic structure is inserted with add transformations - if this is not wanted, the user has to switch it off.

    NOTE The only case where synthetic structure is inserted with extend transformations is when TODO

    Author:
    Lucas Zamboulis

    Constructor Summary
    XMLDSSRestructurer(Schema sourceSchema, org.w3c.dom.Document sourceUIDXMLDSS, Schema targetSchema, org.w3c.dom.Document targetUIDXMLDSS)
               
     
    Method Summary
     void listPathway()
               
     void restructure()
              After instantiating the class, this method restructures the source XMLDSS to match the target, by transforming both source and target schemas.
     void setAttribute2ElementSwitch(boolean value)
               
     void setDebug(boolean value)
               
     void setElement2AttributeSwitch(boolean value)
               
     void setPrintStream(java.io.PrintStream ps)
               
     void setSkolemOn(boolean value)
               
     void setSyntheticSwitch(boolean value)
               
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    XMLDSSRestructurer

    public XMLDSSRestructurer(Schema sourceSchema,
                              org.w3c.dom.Document sourceUIDXMLDSS,
                              Schema targetSchema,
                              org.w3c.dom.Document targetUIDXMLDSS)
                       throws XMLException
    Throws:
    XMLException
    Method Detail

    restructure

    public void restructure()
                     throws XMLException
    After instantiating the class, this method restructures the source XMLDSS to match the target, by transforming both source and target schemas. This means that a growing phase is applied to both schemas and an ident transformation is applied on the transformed schemas.

    Throws:
    XMLException
    XMLException

    listPathway

    public void listPathway()

    setDebug

    public void setDebug(boolean value)
    Parameters:
    value - determines whether debugging is on or off

    setSyntheticSwitch

    public void setSyntheticSwitch(boolean value)
    Parameters:
    value - determines whether synthetic structure is created or not during restructuring; controls all other switches simulataneously

    setElement2AttributeSwitch

    public void setElement2AttributeSwitch(boolean value)
    Parameters:
    value - determines whether element-to-attribute transformations occur or not during restructuring

    setAttribute2ElementSwitch

    public void setAttribute2ElementSwitch(boolean value)
    Parameters:
    value - determines whether attribute-to-element transformations occur or not during restructuring

    setSkolemOn

    public void setSkolemOn(boolean value)
    Parameters:
    value - determines whether synthetic structure based on skolemisation is created or not during restructuring

    setPrintStream

    public void setPrintStream(java.io.PrintStream ps)
    Parameters:
    value - determines whether synthetic structure based on skolemisation is created or not during restructuring