Home
RELAXML User Manual
Contents
1. gt 17 lt xs union gt lt xs simpleType gt lt xs restriction base xs string gt lt xs restriction gt lt xs simpleType gt lt xs simpleType gt lt xs restriction base xs string gt lt xs enumeration value n a gt lt xs restriction gt lt xs simpleType gt lt xs union gt lt xs simpleType gt lt Data type for CLASSES CLASSES NAME gt lt xs simpleType name dataType2 gt lt xs union gt lt xs simpleType gt lt xs restriction base xs string gt lt xs restriction gt lt xs simpleType gt lt xs simpleType gt lt xs restriction base xs string gt lt xs enumeration value n a gt lt xs restriction gt lt xs simpleType gt lt xs union gt lt xs simpleType gt lt Data type for CLASSES CLASSES CID gt lt xs simpleType name dataType3 gt lt xs restriction base xs integer gt lt xs restriction gt lt xs simpleType gt s Data type for CLASSES TEACHERS NAME gt lt xs simpleType name dataType4 gt lt xs union gt lt xs simpleType gt lt xs restriction base xs string gt lt xs restriction gt lt xs simpleType gt lt xs simpleType gt lt xs restriction base xs string gt lt xs enumeration value n a gt lt xs restriction gt lt xs simpleType gt lt xs union gt lt xs simpleType gt lt Data type for CLASSES TEACHERSSTID gt
2. gt lt xs complexType gt lt xs element gt lt CLASS gt lt xs sequences lt xs sequences lt xs attribute name concept gt lt xs simpleType gt lt xs restriction base xs normalizedString 5 lt xs simpleType gt lt xs attribute gt lt xs attribute name structure gt lt xs simpleType gt lt xs restriction base xs normalizedString gt lt xs simpleType gt lt xs attribute gt lt xs complexType gt lt xs element gt lt xs schema gt Listing 2 5 The Schema file generated in the example This file can be difficult for humans to read However the helping comments shown in the file are automatically added by RELAXML Notice that in the generated XML file Classes xml the values for CLASSID TEACHERID and ID for a STUDENT should never be changed since their values originate from primary keys Therefore a checksum should be used for these values To keep the example relatively simple we did not use that But checksums could have been added with the following transformation import com relaxml transformations x public class PKChecksums extends ChecksumTransformation public PKChecksums registerChecksum Classes STUDENTSSSID CS SID registerChecksum Classes CLASSES CID CS CID registerChecksum Classes TEACHERSSTID CS TID initialize Listing 2 6 A transformation that adds checksums The structure definition would then have to be
3. lt xs simpleType name dataType5 gt lt xs restriction base xs integer gt lt xs restriction gt lt xs simpleType gt lt Element declarations gt lt xs element name Classes 5 lt xs complexType gt lt xs sequence maxOccurs unbounded gt lt xs sequence maxOccurs unbounded gt lt xs element name CLASS gt lt xs complexType gt lt xs sequence maxOccurs unbounded gt lt xs element name TEACHER gt lt xs complexType gt lt xs simpleContent gt lt xs extension base dataType4 gt lt xs attribute name TEACHERID type dataType5 gt lt xs extension gt lt xs simpleContent gt lt xs complexType gt lt xs element gt lt TEACHER gt 18 lt xs sequence maxOccurs unbounded gt lt xs element name STUDENTS gt lt xs complexType gt lt xs sequence maxOccurs unbounded gt lt xs element name STUDENT gt lt xs complexType gt lt xs simpleContent gt lt xs extension base dataTypel gt lt xs attribute name ID type dataType0 gt lt xs extension gt lt xs simpleContent gt lt xs complexType gt lt xs element gt lt STUDENT gt lt xs sequences lt xs complexType gt lt xs element gt lt STUDENTS gt lt xs sequence gt lt xs sequence gt lt xs attribute name NAME type dataType2 gt lt xs attribute name CLASSID type dataType3
4. ray m BHNNR RN AH BNN H DUB ERNABAOA C1 ib H 1 1 1 1 2 2 3 4 4 4 BNNPPNANN OA UA NHS AGA RE RONNB RE To remove the redundancy we create the class ClassesRedundancyRemover which is an extension of RedundancyRemover All we have to do is to specify the pairs of redundant columns The first column in each pair will be kept while the second will be deleted when exporting and recreated when importing import com relaxml transformations RedundancyRemover public class ClassesRedundancyRemover extends RedundancyRemover public ClassesRedundancyRemover registerRedundancy TEACHERSSTID CLASSESSTID registerRedundancy CLASSES CID ENROLLMENTSSCID registerRedundancy STUDENTSSSID ENROLLMENTS SID initialize Listing 2 1 The transformation used in the example The concept file Classes rxc is shown below lt xml version 1 0 encoding ISO 8859 1 gt lt Concept xmins http relaxml com ns 0 2 xmlns xsi http www w3 org 2001 XMLSchema instance xsi schemaLocation http relaxml com ns 0 2 ConceptSchema xsd gt lt Caption gt Classes lt Caption gt lt Parents gt lt Parents gt lt Data gt lt Relation gt lt Join Type theta Column1 Classes CLASSESSTID Operator EQ Column2 Classes TEACHERSSTID 5 lt Relation gt lt Join Type theta Column1 Classes STUDENTS SID Operator EQ Column2 Classes ENROLLMENTS8SID 5 lt Relation gt
5. 1 maxOccurs 1 gt lt xs sequences lt xs complexType gt lt xs element gt lt xs simpleType name EncodingType gt lt xs restriction base xs string gt lt Enumerations may be added gt lt xs restriction gt lt xs simpleType gt lt xs complexType name SchemaType gt lt xs sequence gt lt xs choice minOccurs 0 maxOccurs unbounded gt lt xs element name Container type ContainerTagType gt lt xs element name Element type ElementTagType gt lt xs choice gt lt xs sequence gt lt xs complexType gt lt xs complexType name ContainerTagType gt lt xs sequence gt lt xs choice minOccurs 0 maxOccurs unbounded gt lt xs element name Attribute type AttributeTagType gt lt xs element name Element type ElementTagType gt lt xs element name Container type ContainerTagType gt lt xs choice gt lt xs sequence gt lt xs attribute name TagName type xs string use optional gt 23 lt xs attribute name GroupBy lt xs complexType gt type YesNoType default No gt lt xs complexType name ElementTagType gt lt xs sequence gt lt xs element name Attribute type AttributeTagType minOccurs 0 maxOccurs unbounded gt lt xs sequence gt lt xs attribute name Name type xs string use required gt lt xs attribute name TagName type xs string use optional gt lt xs attribute name GroupBy ty
6. It thus holds informations about the database to use An options file is required both when importing and exporting An example of an options file is shown below lt xml version 1 0 gt lt Options xmins http relaxml com ns 0 2 xmlns xsi http www w3 org 2001 XMLSchema instance xsi schemaLocation http relaxml com ns 0 2 OptionsSchema xsd gt lt Driver gt org postgresql Driver lt Driver gt lt Url gt jdbc postgresql 1ocalhost username lt Url gt lt User gt username lt User gt lt Password gt password lt Password gt lt Catalog gt null lt Catalog gt lt Schema gt null lt Schema gt lt Separator1 gt lt Separator1 gt lt Separator2 gt lt Separator2 gt lt TouchedTable Create Yes gt RELAXML TOUCHED TouchedTables lt TouchedPKSeparator gt lt TouchedPKSeparator gt lt SortTable gt RELAXML SORE SortTable gt lt MaxVarcharLength gt 4000 lt MaxVarcharLength5 lt TypeMapper gt com relaxml xml TypeMapping lt TypeMapper gt lt SystemCase gt lower lt SystemCase gt lt MaxRunsResolveDeadLinks gt 10 lt MaxRunsResolveDeadLinks gt lt CommitInterval gt 0 lt CommitInterval gt lt Options gt Listing 1 1 An options file Inside the Driver element the JDBC driver to use is specified The Url element is used for specifying which database to connect to The format of this string is dependent of the used DBMS and JDBC driver The user name and password to the DBMS are
7. Schema gt lt xs schema xmins http relaxml com ns 0 2 xmlns xs http www w3 org 2001 XMLSchema xmlns rx http www relaxml com ns 0 2 targetNamespace http relaxml com ns 0 2 elementFormDefault qualified gt lt xs element name Concept gt lt xs complexType gt lt xs all gt lt xs element name Caption type xs string gt lt xs element name Parents gt lt xs complexType gt lt xs Sequence gt lt xs element name Parent type xs string minOccurs 0 maxOccurs unbounded gt lt xs sequences lt xs complexType gt lt xs element gt lt xs element name Data gt lt xs complexType gt lt xs sequence gt lt xs element name Relation type RelationType gt lt xs sequences lt xs complexType gt lt xs element gt lt xs element name Columns gt 21 lt xs complexType gt lt xs sequence gt lt xs element name Column minOccurs 0 maxOccurs unbounded gt lt xs complexType gt lt xs simpleContent gt lt xs extension base xs string gt lt xs attribute name Updateable type YesNoType default Yes gt lt xs extension gt lt xs simpleContent gt lt xs complexType gt lt xs element gt lt xs sequence gt lt xs complexType gt lt xs element gt lt xs element name RowFilter type xs string minOccurs 0 gt lt xs element name Transformations gt lt xs complexType gt lt xs s
8. do not list the options file Options rxo since it depends on the used DBMS To create the XML file Classes xml we type java com relaxml RelaXML export concept Classes rxc structure Classes rxs options Options rxo file Classes xml After this Classes xml is as shown below 16 lt xml version 1 0 encoding ISO 8859 1 gt lt XML generated by RelaXML Fri Apr 08 10 09 50 MEST 2005 gt lt This is an example 5 lt The shown data is fictive gt lt Classes concept Classes rxc structure Classes rxs xmlns xsz http www w3 org 2001 XMLSchema instance xmlns http relaxml com ns 0 2 xs schemaLocation http relaxml com ns 0 2 ClassesSchema xsd 5 lt CLASS NAME Databases CLASSID 6 gt lt TEACHER TEACHERID 4 5 Ann Smith lt TEACHER gt lt STUDENTS gt lt STUDENT ID 1 gt Angelina Prodi lt STUDENT gt lt STUDENT ID 4 gt Sandra Nicholson lt STUDENI gt lt STUDENTS gt lt CLASS gt lt CLASS NAME Internet Programming CLASSID 5 gt TEACHER TEACHERID 2 gt John Holmes lt TEACHER gt lt STUDENTS gt lt STUDENT ID 1 gt Angelina Prodi lt STUDENI gt lt STUDENT ID 4 gt Sandra Nicholson lt STUDENI gt lt STUDENTS gt lt CLASS gt lt CLASS NAME Java CLASSID 4 gt lt TEACHER TEACHERID 2 gt John Holmes lt TEACHER gt lt STUDENTS gt lt STUDENT ID 1 gt Angelina Prodi lt STUDENI gt lt S
9. given which is placed in the XML instead of NULL Notice that when importing any value identical to this string will be treated as NULL In the Indention element either Yes or No can be specified If Yes is spec ified the XML will be pretty printed such that nested elements have white spaces in front of them This will make the XML easier to read for humans but make the size of the document grow The GenerateSchema element decides whether a Schema file should be gener ated for the XML document to create The legal values are Yes and No In the SchemaFile element the name of the Schema file which the generated XML document should link is specified In the Schema element the actual structure of the XML to generate is specified Inside the Schema element it is possible to specify different kinds of elements to place in the XML A Container element will create elements that hold other elements and or attributes For a Container element a TagName attribute must be specified This dictates the name that the elements will be given Further a GroupBy attribute that may have the value Yes or No can be given This dictates if the generated XML should be grouped by this element type If a GroupBy attribute is not given it will default to No Elements that hold data and some numbers of attributes perhaps 0 are de clared by the Element tag An Element tag must be given a Name attribute that deci
10. lt Join Type theta Column1 ClassesfENROLLMENTS CID Operator EQ Column2 Classes CLASSES CID gt lt Relation gt lt BaseRel gt ENROLLMENIS lt BaseRel gt lt Relation gt lt Relation gt lt BaseRel gt CLASSES lt BaseRel gt lt Relation gt lt Join gt lt Relation gt lt Relation gt lt BaseRel gt STUDENTS lt BaseRel gt lt Relation gt lt Join gt lt Relation gt lt Relation gt lt BaseRel gt TEACHERS lt BaseRel gt lt Relation gt lt Join gt lt Relation gt lt Data gt lt Columns gt lt Column gt STUDENTS SID lt Column gt zColumn5STUDENTS NAME Column gt lt Column gt CLASSES NAMK Column gt lt Column gt CLASSES CID lt Column gt lt Column gt CLASSES TID lt Column gt lt Column gt TEACHERS TID lt Column gt lt Column gt TEACHERS NAMEK Column gt lt Column gt ENROLLMENTS CID lt Column gt 15 lt Column gt ENROLLMENIS SIDz Columns lt Columns gt lt Transformations gt lt Transformation gt ClassesRedundancyRemover lt Transformation gt lt Transformations gt lt Concept gt Listing 2 2 The concept used in the example Now we have to give the structure definition for the XML The structure defi nition file Classes rxs is shown below lt xml version 1 0 encoding ISO 8859 1 gt c Example of an structure definition XML file 5 lt StructureDefinition xmins http relaxml com ns 0 2 xmins xsi http w
11. specified inside the User and Password elements It is also necessary to define which catalog and schema to use These informations are given inside the Catalog and Schema elements Notice that the string null is converted to the value null Inside the Separatorl element a single character must be given This charac ter is used between the concept name and table name when a long name in the three part naming schema is constructed Similarly the separator charac ter that is used between the table name and the column name is given inside the Separator2 element The character given in the Separator1 element must be different from the character given in the Separator2 element When importing RELAXML needs access to the table specified in the element TouchedTable By default this table is created by RELAXML when required and dropped when it is not needed anymore However the user should ensure that the given name is always valid i e that another table with the same name does not exist Therefore on a multiuser site every user should have an options file with a unique name given in the TouchedTable element To ensure compatibility with DBMSs that do not support temporary tables RELAXML does not create this table as a temporary table If the used DBMS supports temporary tables and the user wants to exploit this it is possible to turn the automatic creation of this table off If RELAXML should not create the table the attribute Create No mus
12. AXML Thus the root element must contain concept and structure attributes referencing a concept file and a structure definition file respectively Also when deleting validation of the XML document against its Schema is performed unless the novalidation parameter is given 1 7 Using the Transformation Framework All transformations must in some way extend the Java class Transformation If concepts that use a transformation should allow import operations the class TransformationWithInverse which itself is an extension of Transfor mat ion must be extended Both of these classes are in the package com rela xml transformations A class extending Tranformation should at least define the method trans form DataRow In addtion to this method a class extending Transfor mationWithInverse must also define the method inverseTransform DataRow These methods will be invoked for each row being exported im ported by RELAXML Transformations cannot directly add or delete cells from a given DataRow ob ject Instead the constructor of the transformation must register which cells to add and delete RELAXML will then automatically add the cells to add before transform DataRow is invoked and delete the cells to delete after the in vocation of transform DataRow That is even though a specific cell will be deleted by a transformation it is possible to read the value of the cell from the transformation When inverseTransform Dat aRow is in
13. N lt Column gt lt Columns gt lt RowFilter gt SQL condition lt RowFilter gt lt Transformations gt lt Transformation gt transformation1 lt Transformation gt lt Transformation gt transformationN lt Transformation gt lt Transformations gt lt DeletionOrder gt lt Run gt lt DeleteFrom gt relation1 lt DeleteFrom gt lt DeleteFrom gt relationN lt DeleteFrom gt lt Run gt lt Run gt lt Run gt lt DeletionOrder gt lt Concept gt Listing 1 2 A concept file Inside the Caption element the name of the root element in the generated XML is specified After this follows the Parents element in which concepts to inherit from can be given Inside the Data element a Relation element is given In this Relation element the data to extract is defined A Relation either consists of a Join element that is given two Relation elements representing relations to join by means of a join specified by the user or a BaseRel element that holds the name of a relation in the database Since a Join element holds two Relation elements it is possible to nest Joins as in the following example lt Relation gt lt Join Type theta Columnl Classes CLASSES TID Operator EQ Column2 Classes TEACHERSSTID 5 lt Relation gt lt Join Type theta Columni Classes STUDENTSSSID Operator EQ Column2 Classes ENROLLMENTSSSID gt lt Relation gt lt Join Type theta Column1 Classes ENROLLMENTS CID Op
14. RELAXML User Manual Steffen Uls Knudsen Christian Thomsen May 2005 Contents 1 User Manual 2 1 1 Options XML Files 2 1 2 Concept XML Files ss 44 be eee NAG NG KGG ae 5 1 3 Structure Definition XML Files 6 1 4 Performing an Export 8 15 Performing an Import 9 1 6 Performing a Deletion 9 1 7 Using the Transformation Framework 9 2 Example 12 A XML Schemas for Setup Files 20 A 1 Options XML Schema 20 A2 Concept XML Schema 21 A 3 Structure Definition XML Schema 23 B License 25 Chapter 1 User Manual In this manual we briefly describe how to use RELAXML First we consider the XML files used for defining options concepts and structure definitions The Schemas for these files are given in Appendix A Then we consider how to perform an export how to perform an import and finally how to perform a deletion A complete example will not be given here since the following chap ter is devoted to a longer example Notice that to run RELAXML a JRE version 1 4 2 or higher and Xerces2 avail able from http xml apache org xerces2 j download cgi will be needed Fur ther a JDBC driver used to connect to the DBMS is required 11 Options XML Files An options XML file is used for specifying user and site specific settings
15. TUDENT ID 2 gt Arthur Smith lt STUDENT gt lt STUDENT ID 4 gt Sandra Nicholson lt STUDENI gt lt STUDENTS gt lt CLASS gt lt CLASS NAME Math1 CLASSID 1 gt lt TEACHER TEACHERID 1 5 Donald Johnson lt TEACHER gt lt STUDENTS gt lt STUDENT ID 1 gt Angelina Prodi lt STUDENT gt lt STUDENT ID 3 gt Peter Chang lt STUDENT gt lt STUDENTS gt lt CLASS gt lt CLASS NAMF Simulation CLASSID 7 gt lt TEACHER TEACHERID 1 5 Donald Johnson lt TEACHER gt lt STUDENTS gt lt STUDENT ID 2 gt Arthur Smith lt STUDENT gt lt STUDENTS gt lt CLASS gt lt Classes gt Listing 2 4 The XML file generated in the example The generated Schema ClassesSchema xsd is as shown below lt xml version 1 0 encoding ISO 8859 1 7 gt lt XML Schema for RelaXML Data File gt lt Schema generated by RelaXML Fri Apr 08 10 09 50 MEST 2005 gt lt xs schema xmlns http relaxml com ns 0 2 xmins xs http www w3 org 2001 XMLSchema xmilns rxz http www relaxml com ns 0 2 targetNamespace http relaxml com ns 0 2 elementFormDefault qualified 5 lt Data type for CLASSES STUDENTS SID gt lt xs simpleType name dataType0 gt lt xs restriction base xs integer gt lt xs restriction gt lt xs simpleType gt lt Data type for CLASSESHSTUDENISSNAME gt lt xs simpleType name dataTypel
16. ase xs string gt lt xs enumeration value Yes gt lt xs enumeration value No gt lt xs restriction gt lt xs simpleType gt 22 lt xs schema gt Listing A 2 Concept XML Schema A 3 Structure Definition XML Schema lt xml version 1 0 encoding ISO 8859 1 gt lt RelaXML Structure Definition Schema gt lt Copyright C 2004 gt lt Steffen Uls Knudsen and Christian Thomsen 5 lt steffen chr relaxml com gt lt Structure Definition XML Schema 5 lt xs schema xmins http relaxml com ns 0 2 xmlns xs http www w3 org 2001 XMLSchema xmins rx http wmw relaxml com ns 0 2 targetNamespace http relaxml com ns 0 2 elementFormDefault qualified 5 lt xs element name StructureDefinition gt lt xs complexType gt lt xs sequence gt lt xs element name Encoding type EncodingType minOccurs 0 Y y maxOccurs 1 gt lt xs element name Comment type xs string minOccurs 0 y maxOccurs unbounded gt lt xs element name NullSubstitute type xs string minOccurs 0 maxOccurs 1 gt lt xs element name Indention type YesNoType minOccurs 0 maxOccurs 1 gt lt xs element name GenerateSchema type YesNoType minOccurs 0 maxOccurs 1 gt lt xs element name SchemaFile type xs string minOccurs 0 maxOccurs 1 gt lt xs element name Schema type SchemaType minOccurs
17. but not limited to damages for loss of goodwill work stoppage computer failure or malfunction or any and all other commercial damages or losses even if such Contributor has been advised of the possibility of such damages Accepting Warranty or Additional Liability While redistributing the Work or Derivative Works thereof You may choose to offer and charge a fee for acceptance of support warranty indemnity or other liability obligations and or rights consistent with this License However in accepting such obligations You may act only on Your own behalf and on Your sole responsibility not on behalf of any other Contributor and only if You agree to indemify defend and hold each Contributor harmless for any liability incurred by or claims asserted against such Contributor by reason of your accepting any such warranty or additional liability END OF TERMS AND CONDITIONS 27
18. changed to also decide the lo cation of CS SID CS CID and CS TID 19 Appendix A XML Schemas for Setup Files A1 Options XML Schema lt xml version 1 0 encoding ISO 8859 1 gt lt RelaXML gt lt Copyright C 2004 gt lt Steffen Uls Knudsen and Christian Thomsen gt lt steffen chr relaxml com gt lt Concept XML Schema gt lt xs schema xmlns xs http www w3 org 2001 XMLSchema xmlns rx http relaxml com ns 0 2 targetNamespace http relaxml com ns 0 2 elementFormDefault qualified 5 lt xs element name Options gt lt xs complexType gt lt xs all gt lt xs element name Driver type xs string gt lt xs element name Url type xs string gt lt xs element name User type xs string gt lt xs element name Password type xs string gt lt xs element name Catalog type xs string gt lt xs element name Schema type xs string gt lt xs element name Separatorl type rx SeparatorType gt lt xs element name Separator2 type rx SeparatorType gt lt xs element name TouchedTable gt lt xs complexType gt lt xs simpleContent gt lt xs extension base xs string gt lt xs attribute name Create type rx YesNoType default Yes gt lt xs extension gt lt xs simpleContent gt lt xs complexType gt lt xs element gt lt xs element name TouchedPKSeparator
19. d be print ed to the standard error stream as the export goes on v could be specified to make RELAXML verbose or vv to make RELAXML very verbose By default RELAXML will detect if the data to export contains dead links If dead links are present the user will be asked if the export should be per formed anyway or cancelled If the argument resolvedeadlinks is given RELAXML will attempt to resolve the dead links Since this in principle might take very many iterations the number of iterations is limited by the MaxRuns ResolveDeadLinks in the options file If the argument ignoredeadlinks is given dead links will neither be detected nor resolved 1 5 Performing an Import The insertion of an XML file to the database can be performed by the following command java com relaml RelaXML insert options Options rxo file data xml Here insert could have been replaced by update or merge Also when importing it is possible to specify v or vv to make RELAXML verbose or very verbose By default the read XML file is validated against its Schema The validation can however be turned off by giving the argument novalidation 1 6 Performing a Deletion To delete the data in the file data xml from the database if possible the follow ing command should be given java com relaml RelaXML delete options Options rxo file data xml The given data file should be an XML file in the same format as those generated by REL
20. des which column in the transformed derived table the data should be read from Further it can be given a TagName attribute to decide the name of the element in the XML If a TagName is not given a default value will be found from the Name attribute As for Container elements a GroupBy attribute can also be specified Attributes for elements declared by Element or Container elements are de clared by the Attribute element As for the Element elements a Name attribute must be given and a TagName can be given However a GroupBy attribute cannot be given since this is decided by means of the element that should hold the attribute being declared Notice that the content of the Schema element does not have to describe a tree but may also describe a forest The generated XML will under all circumstances be a tree since every element declared in the structure definition will be in serted with the root element as an ancestor 1 4 Performing an Export When an options file a concept file and a structure definition file are present we are ready to perform an export The export can be started with the following command java com relaxml RelaXML export options Options rxo concept Concept rxc structure StructureDefinition rxs This will print the generated XML to the standard output stream If the XML instead should be printed to the file data xml the argument file data xml should also be given If informations about what is happening shoul
21. e T PRIMKEYVALUE T ATTRIBUTE T TABLE When performing an export where grouping is used RELAXML will create a table used for sorting The name of this table is specified inside the ele ment SortTable This name should be unique to every running instance of RE LAXML The table will hold columns of type varchar for which the length is set in the MaxVarcharLength element The type mapper between values declared in java sql Types and Schema types is defined in the TypeMapper element com relaxml xml TypeMap ping is shipped with RELAXML but this might be extended by the user to ad just to specific needs The class has three methods get TypeName int which given a value from java sql Types must return a String holding the name to use in the generated Schema get TypeMax int and getTypeMin int that given a type must return a String holding the minimum maximum value allowed for this type If no such values exist null should be returned Inside the element SystemCase lower upper or mixed can be entered This decides how identifiers entered by the user are treated If lower or upper is specified all identifiers are converted to upper case or lower case respectively If mixed is specified no identifiers will be converted Inside the element MaxResolveDeadLinks a number deciding the maximum attempts of recursive applications of the method to remove dead links can be given If this number is 0 there is n
22. e from used base relations can be given Multiple Run elements can be given here and each Run element can hold multiple DeleteFrom elements in each of which a name of a base relation must be given When deleting RELAXML will parse the XML once for each Run element For each base relation listed in the Run element being considered in the current parse RELAXML will try to delete the read data from that rela tion If no DeletionOrder element is present RELAXML attempts to find one automatically Notice that deletion orders are not inherited from parents 1 3 Structure Definition XML Files A structure definition file defines how the structure of the generated XML will be A structure definition should define a position in the XML for each column in the transformed derived table which the used concept gives rise to To see which columns are available from a given concept the following command can be used java com relaxml RelaXML info options Options rxo concept Concept rxc An example of a structure definition file is shown below lt xml versionz 1 0 encoding ISO 8859 1 gt c Example of an structure definition XML file 5 lt StructureDefinition xmins http relaxml com ns 0 2 xmlns xsi http www w3 org 2001 XMLSchema instance xsi schemaLocation http relaxml com ns 0 2 StructureDefinitionSchema xsd gt lt Encoding gt ISO 8859 1 lt Encoding gt lt Comment gt This is a comment lt Comm
23. ean an individual or Legal Entity exercising permissions granted by this License Source form shall mean the preferred form for making modifications including but not limited to software source code documentation source and configuration files Object form shall mean any form resulting from mechanical transformation or translation of a Source form including but not limited to compiled object code generated documentation and conversions to other media types Work shall mean the work of authorship whether in Source or Object form made available under the License as indicated by a copyright notice that is included in or attached to the work an example is provided in the Appendix below Derivative Works shall mean any work whether in Source or Object form that is based on or derived from the Work and for which the editorial revisions annotations elaborations or other modifications represent as a whole an original work of authorship For the purposes of this License Derivative Works shall not include works that remain separable from or merely link or bind by name to the interfaces of the Work and Derivative Works thereof Contribution shall mean any work of authorship including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner 25 or by an individual or L
24. egal Entity authorized to submit on behalf of the copyright owner For the purposes of this definition submitted means any form of electronic verbal or written communication sent to the Licensor or its representatives including but not limited to communication on electronic mailing lists source code control systems and issue tracking systems that are managed by or on behalf of the Licensor for the purpose of discussing and improving the Work but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as Not a Contribution Contributor shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work Grant of Copyright License Subject to the terms and conditions of this License each Contributor hereby grants to You a perpetual worldwide non exclusive no charge royalty free irrevocable copyright license to reproduce prepare Derivative Works of publicly display publicly perform sublicense and distribute the Work and such Derivative Works in Source or Object form Grant of Patent License Subject to the terms and conditions of this License each Contributor hereby grants to You a perpetual worldwide non exclusive no charge royalty free irrevocable except as stated in this section patent license to make have made use offer to sell sell import and otherwise trans
25. ent gt lt Comment This is another comment lt Comment gt lt NullSubstitute gt n a lt NullSubstitute gt lt Indention gt Yes lt Indention gt lt GenerateSchema gt Yes lt GenerateSchema gt lt SchemaFile gt ClassesSchema xsd lt SchemaFile gt lt Schema gt Container TagName CLASS GroupBy Yes gt lt Attribute Name Classes CLASSES NAME gt lt Attribute Name Classes CLASSES CID TagName CLASSID gt lt Element Name Classes TEACHERS NAME TagName TEACHER GroupBy Yes gt lt Attribute Name Classes TEACHERS TID TagName TEACHERID gt lt Element gt lt Container TagName STUDENIS GroupBy Yes gt lt Element Name Classes STUDENIS NAME TagName STUDENT GroupBy No gt lt Attribute Name Classes STUDENTS SID TagName ID gt lt Element gt lt Container gt lt Container gt lt Schema gt lt StructureDefinition gt Listing 1 4 A structure definition file In the Encoding element a string that defines the encoding of the generated XML is given This encoding must be one supported by the local Java installa tion Typical values are ISO 8859 1 UTF 8 and UTF 16 After the Encoding element any number of Comment elements can follow A string inside a Comment element is inserted in the generated XML as a com ment by means of lt gt In the data to export there might be NULL values These cannot be written directly to the XML So in the NullSubstitute element a string is
26. equence gt lt xs element name Transformation type xs string minOccurs 0 maxOccurs unbounded gt lt xs sequence gt lt xs complexType gt lt xs element gt lt xs element name DeletionOrder minOccurs 0 gt lt xs complexType gt lt xs sequence gt lt xs element name Run minOccurs 1 maxOccurs unbounded gt lt xs complexType gt lt xs sequence gt lt xs element name DeleteFrom type xs string minOccurs 1 maxOccurs unbounded gt lt xs sequence gt lt xs complexType gt lt xs element gt lt xs Sequence gt lt xs complexType gt lt xs element gt lt xs all gt lt xs complexType gt lt xs element gt lt xs complexType name RelationType gt lt xs choice gt lt xs element name BaseRel type xs string gt lt xs element name ConceptRel type xs string gt lt xs element name Join type JoinRelType gt lt xs choice gt lt xs complexType gt lt xs complexType name JoinRelType gt lt xs sequence gt lt xs element name Relation type RelationType gt lt xs element name Relation type RelationType gt lt xs sequence gt lt xs attribute name Type type xs string gt lt xs attribute name Columnl type xs string gt lt xs attribute name Operator type xs string gt lt xs attribute name Column2 type xs string gt lt xs complexType gt lt xs simpleType name YesNoType gt lt xs restriction b
27. erator EQ Column2 Classes CLASSES CID gt lt Relation gt lt BaseRel gt ENROLLMENIS lt BaseRel gt lt Relation gt lt Relation gt lt BaseRel gt CLASSES lt BaseRel gt lt Relation gt lt Join gt lt Relation gt lt Relation gt lt BaseRel gt STUDENTS lt BaseRel gt lt Relation gt lt Join gt lt Relation gt lt Relation gt lt BaseRel gt TEACHERS lt BaseRel gt lt Relation gt lt Join gt lt Relation gt Listing 1 3 A Relation element For further details the reader is referred to Appendix A Inside the Columns element a number of Column elements can be given Each of these holds the SOL name of a column to include from the relation found in the Data element If the attribute Updatable No is given RELAXML will not change the column from the XML when importing It is also possible to give the attribute Updatable Yes This is the default The Columns element is optionally followed by the RowFilter element In the Row Filter element an SQL condition restricting the set of exported rows can be given After the RowFilter element comes the Transformations element in which a number of transformations to apply to the relation found in the Data element can be specified Note that the order of these transformations reflects the order in which they are applied After the Transformations a DeletionOrder element can optionally follow In side this element an order for how to delet
28. fer the Work where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution s alone or by combination of their Contribution s with the Work to which such Contribution s was submitted If You institute patent litigation against any entity including a cross claim or counterclaim in a lawsuit alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed Redistribution You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium with or without modifications and in Source or Object form provided that You meet the following conditions a You must give any other recipients of the Work or Derivative Works a copy of this License and b You must cause any modified files to carry prominent notices stating that You changed the files and c You must retain in the Source form of any Derivative Works that You distribute all copyright patent trademark and attribution notices from the Source form of the Work excluding those notices that do not pertain to any part of the Derivative Works and d If the Work includes a NOTICE text file as part of its distribution then any Derivative Works that You distribute must include a readable cop
29. in shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions Trademarks This License does not grant permission to use the trade names trademarks service marks or product names of the Licensor except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file Disclaimer of Warranty Unless required by applicable law or agreed to in writing Licensor provides the Work and each Contributor provides its Contributions on an AS IS BASIS WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied including without limitation any warranties or conditions of TITLE NON INFRINGEMENT MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License Limitation of Liability In no event and under no legal theory whether in tort including negligence contract or otherwise unless required by applicable law such as deliberate and grossly negligent acts or agreed to in writing shall any Contributor be liable to You for damages including any direct indirect special incidental or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work including
30. o limit for the number of attempts Inside the element CommitInterval it is specified how often RELAXML should commit when importing When this value is set to 0 RELAXML will only com mit when all data in the XML document to import has been imported If the value is set to some positive value x RELAXML will commit whenever x data rows have been read from the XML and imported to the database Notice that if the used DBMS supports deferrable foreign key constraints these will only be utilized by RELAXML if the commit interval is set to 0 When the options file has been created it is possible to get various informations on the JDBC driver and test if a connection can be established by using the command java com relaxml RelaXML options Options rxo jdbcdriverprofile 12 Concept XML Files A concept is also specified in an XML file Such a file should have the extension rxc Its structure is as shown below lt xml version 1 0 gt lt Concept xmins http relaxml com ns 0 2 xmlns xsi http www w3 org 2001 XMLSchema instance xsi schemaLocation http relaxml com ns 0 2 ConceptSchema xsd gt lt Caption gt MyConcept lt Caption gt lt Parents gt lt Parent gt parent1 lt Parent gt lt Parent gt parentN lt Parent gt lt Parents gt lt Data gt lt Relation gt lt Relation gt lt Data gt lt Columns gt lt Column gt column1 lt Column gt lt Column Updatable No gt column
31. pe YesNoType default No gt lt xs complexType gt lt xs complexType name AttributeTagType gt lt xs attribute name Name type xs string use required gt lt xs attribute name TagName type xs string use optional gt lt xs complexType gt lt xs simpleType name YesNoType gt lt xs restriction base xs string gt lt xs enumeration value Yes gt lt xs enumeration value No gt lt xs restriction gt lt xs simpleType gt lt xs schema gt Listing A 3 Structure Definition XML Schema 24 Appendix B License Apache License Version 2 0 January 2004 http www apache org licenses TERMS AND CONDITIONS FOR USE REPRODUCTION AND DISTRIBUTION de Definitions License shall mean the terms and conditions for use reproduction and distribution as defined by Sections 1 through 9 of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control means i the power direct or indirect to cause the direction or management of such entity whether by contract or otherwise or ii ownership of fifty percent 50 or more of the outstanding shares or iii beneficial ownership of such entity You or Your shall m
32. s 12 Math1 Multimedia Networked Multimedia Java Internet Programming Databases Simulation Classes mia J 4 6 5 4 7 1 4 5 6 1 Enrollments The concept that we consider extracts informations about each class the teacher giving it and the students enrolled into it Thus the attributes shown below are included e SID and Name from the Students relation e TID and Name from the Teachers relation e CID Name and TID from the Classes relation e SID and CID from the Enrollments relation To extract meaningful data we use the following join conditions e Enrollments SID Students SID e Enrollments CID Classes CID e Teachers TID Classes TID The still not transformed derived table is shown on the next page Notice that to save space only the last parts of the column names are shown Because of the join conditions it of course holds that there are three pairs of redundant columns 13 Students5SID Students5Name Teachers TID Classes TID Teachers Name Classes CID Classes Name Enrollments SID Enrollments CID Angelina Prodi Donald Johnson Math1 Angelina Prodi John Holmes Java Angelina Prodi John Holmes Internet Programming Angelina Prodi Ann Smith Databases Arthur Smith John Holmes Java Arthur Smith Donald Johnson Simulation Peter Chang Donald Johnson Math1 Sandra Nicholson John Holmes Java Sandra Nicholson John Holmes Internet Programming Sandra Nicholson Ann Smith Databases
33. t Int method since in the given DataRow the Cell with name A holds an integer However when a set method is used the setFloat float should be used RELAXML automatically checks that all cell types in a Dat aRow are all right after each invocation of the transform and inverseTransform methods 11 Chapter 2 Example In this chapter we demonstrate how RELAXML can be used for generating XML files with data from a relational database We consider a small database with fictive data for a university The database has the following schema Students SID Integer Name Varchar 30 Address Varchar 30 Teachers TID Integer Name Varchar 30 Address Varchar 30 Classes CID Integer Name Varchar 30 TID Integer Enrollments SID Integer CID Integer where Classes TID is a foreign key referencing Teachers TID Enrollments SID is a foreign key referencing Students SID and Enrollments CID is a foreign key referencing Classes CID As seen the database holds information on names and addresses of students and teachers names of classes and which teachers are giving them and which classes students are enrolled into The tables hold the data shown below SD Angelina Prodi Maribyrnong Arthur Smith Maribyrnong Peter Chang Maribyrnong Sandra Nicholson Collingwood Students TD Donald Johnson Williamstown John Holmes Footscray Anand Ghandi Heidelberg Ann Smith Carlton Teacher
34. t be given with the TouchedTable element The user will then have to create the table before RELAXML is used The table should have the columns T TABLE T ATTRIBUTE and T PRIMKEYVALUE that all should be of type varchar or similar It is recommended that the table is created as a temporary table as shown below since RELAXML does not attempt to empty the table when not used anymore CREATE GLOBAL Til T TABLE VARC ATTRIBUTE VARCHAR 255 T PRIMKEYVALUE VARCHAR 255 ON COMMIT PRESERVE ROWS MPORARY TABLE tablename AR 255 Gl G Gin Further if the table is declared as a temporary table multiple users can use the temporary table at a time but such that each of them only uses his own data Notice that the length of the varchars should be long enough to hold any of the used table names any of the used column names or any of the used composite primary keys respectively When composite primary keys are present in an import their values will be concatenated and temporarily stored in this table When the values are concatenated the character specified inside the Touched PKSeparator is used This character should not be present in any of the values for composite primary keys Notice that the performance of RELAXML is significantly better when an in dex is created for the table descirbed above An index can be created by the command CREATE INDEX indexname ON tablenam
35. type rx SeparatorType gt lt xs element name SortTable type xs string gt lt xs element name MaxVarcharLength type xs integer gt lt xs element name TypeMapper type xs string gt lt xs element name SystemCase type rx SystemCaseType gt lt xs element name MaxRunsResolveDeadLinks type xs nonNegativelnteger gt lt xs element name CommitInterval type xs nonNegativelnteger minOccurs 0 maxOccurs 1 gt lt xs all gt 20 lt xs complexType gt lt xs element gt lt xs simpleType name YesNoType gt lt xs restriction base xs string gt lt xs enumeration value Yes gt lt xs enumeration value No gt lt xs restriction gt lt xs simpleType gt lt xs simpleType name SeparatorType gt lt xs restriction base xs string gt lt xs length value 1 fixed true gt lt xs restriction gt lt xs simpleType gt lt xs simpleType name SystemCaseType 5 lt xs restriction base xs string gt lt xs enumeration value upper gt lt xs enumeration value lower gt lt xs enumeration value mixed gt lt xs restriction gt lt xs simpleType gt lt xs schema gt Listing A 1 Options XML Schema A 2 Concept XML Schema lt xml version 1 0 encoding ISO 8859 1 gt lt RelaXML gt lt Copyright C 2004 s lt Steffen Uls Knudsen and Christian Thomsen 5 lt steffen chr relaxml com gt lt Concept XML
36. voked i e when importing the opposite happens Thus cells that were registered to be deleted are recreated before inverseTransformis invoked but without any values and cells that were registered to be created are deleted after the invocation of inverseTransform To register addition and deletion of cells the methods registerCellAddit ion String name int type and registerCellDeletion String name should be applied The type parameter given to registerCellAdd ition should be taken from java sql Types where symbolic names are available for SQL types or from com relaxml Transformation JavaTo SQLTypes where symbolic names for Java types are available A transformation should only register the addition deletion of a specific cell name once Therefore this should be done from the constructor of the trans formation After these registrations the constructor should invoke the method initialize Theinitialize method must always be invoked exactly once by a transformation An example of a typical transformation with an in verse is shown below import com relaxml transformations TransformationWithInverse public class MyTransformation extends TransformationWithInverse public MyTransformation registerCellAddition SomeCell java sql Types INTEGER registerCellDeletion AntoherCell initialize public void transform DataRow row Perform the transformation here public void inverseTransform DataRo
37. w row Perform the inverse transformation here Listing 1 5 The constructor of a transformation Inside the transform and inverseTransform methods the real work of the transformation goes on To get access to a specific cell from a Dat aRow ob ject the method getCe11 String name is used This method will return a Cell object which can be modified When Ce11 objects are used it is im portant to know the type of the value held by the cell The type will influence which get and set methods to use For example if the Ce11 object holds a string value the methods get String and setString String should be used The type of a cell can be obtained by means of the get Type method which 10 returns a value from java sql Types No matter which type is used the value can be set to null by means of the setNull method It might be required for a transformation to change the type held by a cell To do this the constructor of the transformation must invoke the method register CellConversion String name int newType After this the transfor mation can still use the get method for the old type but only the set method for the new type Assume for example that the cell with name A should have its type converted from integer to float Then the method registerCell Conversion A java sql Types FLOAT must be invoked from the constructor of the transformation Inside the transform DataRow method it is then possible to use the ge
38. ww w3 org 2001 XMLSchema instance xsi schemaLocation http relaxml com ns 0 2 StructureDefinitionSchema xsd gt lt Encoding gt ISO 8859 1 lt Encoding gt lt Comment gt This is an example lt Comment gt lt Comment gt The shown data is fictive lt Comment gt lt NullSubstitute gt n a lt NullSubstitute gt lt Indention gt Yes lt Indention gt lt GenerateSchema gt Yes lt GenerateSchema gt lt SchemaFile gt ClassesSchema xsd lt SchemaFile gt lt Schema gt Container TagName CLASS GroupBy Yes gt lt Attribute Name Classes CLASSES NAME gt lt Attribute Name Classes CLASSES CID TagName CLASSID gt lt Element Name Classes TEACHERS NAME TagName TEACHER GroupBy Yes gt lt Attribute Name Classes TEACHERS TID TagName TEACHERID gt lt Element gt lt Container TagName STUDENIS GroupBy Yes gt lt Element Name Classes STUDENIS NAME TagName STUDENT gt lt Attribute Name Classes STUDENTS SID TagName ID gt lt Element gt lt Container gt lt Container gt lt Schema gt lt StructureDefinition gt Listing 2 3 The structure definition used in the example Notice that we group by the container CLASS such that each class is only listed once and TEACHER such that the teacher who gives a class is only listed once under the class and the container STUDENTS such that under a specific class all its enrolled students are listed inside one STUDENTS element We
39. y of the attribution notices contained within such NOTICE file excluding those notices that do not pertain to any part of the Derivative Works in at least one of the following places within a NOTICE text file distributed as part of the Derivative Works within the Source form or documentation if provided along with the Derivative Works or within a display generated by the Derivative Works if and wherever such third party notices normally appear The contents of the NOTICE file are for informational purposes only and do not modify the License You may add Your own attribution notices within Derivative Works that You distribute alongside or as an addendum to the NOTICE text from the Work provided that such additional attribution notices cannot be construed as modifying the License You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use reproduction or distribution of Your modifications or 26 for any such Derivative Works as a whole provided Your use reproduction and distribution of the Work otherwise complies with the conditions stated in this License Submission of Contributions Unless You explicitly state otherwise any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License without any additional terms or conditions Notwithstanding the above nothing here
Download Pdf Manuals
Related Search
Related Contents
Bestiarium BENDIX TCH-008-011 User's Manual ARFELⅢ SVW909 Sip Wifi phone User Manual - stephen Philips WV-NM100 User's Manual Simpli Home 3AXCARLBEN-MB Instructions / Assembly clicca qui per scaricare il catalogo Copyright © All rights reserved.
Failed to retrieve file