uk.ac.bbk.dcs.automed.xml
Class XMLRestructurer

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

public class XMLRestructurer
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

    Field Summary
    protected  java.util.logging.Logger logger
               
     
    Constructor Summary
    XMLRestructurer(Schema sourceSchema, org.w3c.dom.Document sourceUIDXMLDSS, Schema targetSchema, org.w3c.dom.Document targetUIDXMLDSS, org.w3c.dom.Document mappingsFile)
               
     
    Method Summary
     long getIOTime()
               
     int getNumberOfRepositoryInteractions()
               
     int getNumberOfTransformations()
               
     long getOverallTime()
               
     long getPhase1Time()
               
     long getPhase2Time()
               
     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 setClassSubClassSwitch(boolean value)
               
     void setElement2AttributeSwitch(boolean value)
               
     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
     

    Field Detail

    logger

    protected java.util.logging.Logger logger
    Constructor Detail

    XMLRestructurer

    public XMLRestructurer(Schema sourceSchema,
                           org.w3c.dom.Document sourceUIDXMLDSS,
                           Schema targetSchema,
                           org.w3c.dom.Document targetUIDXMLDSS,
                           org.w3c.dom.Document mappingsFile)
    Method Detail

    restructure

    public void restructure()
                     throws XMLRestructuringException
    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:
    XMLRestructuringException
    XMLException

    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

    setClassSubClassSwitch

    public void setClassSubClassSwitch(boolean value)

    getOverallTime

    public long getOverallTime()

    getIOTime

    public long getIOTime()

    getPhase1Time

    public long getPhase1Time()

    getPhase2Time

    public long getPhase2Time()

    getNumberOfRepositoryInteractions

    public int getNumberOfRepositoryInteractions()

    getNumberOfTransformations

    public int getNumberOfTransformations()