About Users Other Info (External) |
Main /
TutorialsThe following tutorials assume that you have already obtained and installed the tXSchema. We have provided several test cases within the source code distribution package. These test cases can be found at $ /home/johndoe/tXSchema/test_suites assuming the source code directory is $ /home/johndoe/tXSchema We will be using the provided test cases throughout the tutorials. SquashTo run squash, please first go to the executable directory $ /home/johndoe/tXSchema/executable We will use the cardinality test case. Let's first take a look at what are the contents in the cardinality test. $ ls /home/johndoe/tXSchema/test_suites/cardinality Annotations.xml company.xsd data1.xml data2.xml data3.xml data4.xml data5.xml data6.xml temporalDocument.xml tempschema.xml The temporalDocument.xml is the original temporal document file containing the slice information. The data1.xml through data6.xml files are the actual slice data files each representing a time period. To squash this temporal document and the slices, please execute $ ./squash /home/johndoe/tXSchema/test_suites/cardinality/temporalDocument.xml Now to see the output of running squash, please do $ ls /home/johndoe/tXSchema/test_suites/cardinality Annotations.xml company.xsd data1.xml data2.xml data3.xml data4.xml data5.xml data6.xml temporalDocument_squashed.xml temporalDocument.xml tempschema.xml Note that the new file named temporalDocument_squashed.xml has been created. This is the result of squashing.
UnsquashThe unsquash tool takes the newly created squashed file as input and produces the sliced XML files identical to the data1.xml through data6.xml files. To run unsquash, please execute the following. $ ./unsquash /home/johndoe/tXSchema/test_suites/cardinality/temporalDocument_squashed.xml To see the results, please execute $ ls /home/johndoe/tXSchema/test_suites/cardinality Annotations.xml company.xsd data1.xml data2.xml data3.xml data4.xml data5.xml data6.xml slice_20080101_20090317.xml slice_20090317_20091001.xml slice_20091001_20100128.xml slice_20100128_20100227.xml slice_20100227_20110101.xml temporalDocument_squashed.xml temporalDocument.xml tempschema.xml The XML files prefixed with "slice_" are the slices extracted from the squashed file. Each slice file is suffixed with its time period. The content of each file can be identically matched to its peer from data1.xml to data6.xml in the above example.
Temporal ValidatorWith the temporalDocument_squashed.xml file generated by the squash tool, we now can run the temporal constraint validator to check against the squashed temporal document. Note that we have provided the cardinality type constraints in the Annotation.xml file. The test case was purposely designed to violate the specified constraints. So running the validator against the temporal document will produce error messages indicating the document fails to validate. This is the expected and proper outcome. To run the validator, please execute $ ./txmllint /home/johndoe/tXSchema/test_suites/cardinality/temporalDocument_squashed.xml In period [2009-01-01 - 2009-12-31] [suppliersSeq] seq cardinality violation: max is 3 actual is 5[[ipad, joystick, keyboard, mouse, xbox]] /home/johndoe/tXSchema/test_suites/cardinality/temporalDocument_squashed.xml fails to validate |