This tutorial describes how to run one of the more complicated test cases that comes with the standard distribution.
Scenario: We have created some documents that keep track of our company. We keep track of suppliers and products. Over time, we make refinements to our list of suppliers and products. In total, we have changed our database (i.e., XML file) 10 times, and thus have 10 versions of the same file.
Getting our ducks in a row
Let's navigate to the test directory in question.
$ cd $TXSCHEMA/src/test_cases/squash/testcase3
$ ls
CVS/ company2.xml company7.xml company_temp_anno.xml
company.xml company3.xml company8.xml config.xml
company.xsd company4.xml company9.xml
company0.xml company5.xml company_bundle.xml
company1.xml company6.xml company_phy_anno.xml
Note: don't worry if you don't have the CVS directory, as listed above.
As the ls
shows us, a set of input files has already been created. These are the files that the user creates; they are:
- The Snapshot Schema document that describes the company*.xml files (company.xsd)
- The Temporal Annotation document that describes how the data changes (company_temp_anno.xml)
- The Physical Annotation document that describes where the timestamps will be placed (company_phy_anno.xml)
- The Non-Temporal Data files that hold the actual versioned data (company*.xml)
- The Temporary Bundle document that simply lists the Snapshot Schema, Temporal Annotation, and Physical Annotation documents (company_bundle.xml)
- The Configuration File document that is the actual input into squash; it references the Temporal Bundle and the Non-Temporal Data documents (config.xml)
We can now perform some sanity checks to make sure everything is working correctly. (Note: the following is not required for squash to run; it is simply included here for completeness.)
- Verify that the Temporal Bundle is formatted properly (i.e., validates against the Temporal Bundle Schema):
$ xmllint --schema ../../../../etc/TBSchema.xsd company_bundle.xml
After xmllint completes, the last line printed to standard output should read:
company_bundle.xml validates
- Verify that the Temporal Annotation is formatted properly:
$ xmllint --schema ../../../../etc/TXSchema.xsd company_temp_anno.xml
- Verify that the Physical Annotation is formatted properly:
$ xmllint --schema ../../../../etc/PXSchema.xsd company_phy_anno.xml
- Verify that the Configuration file is formatted properly:
$ xmllint --schema ../../../../etc/ConfigSchema.xsd config.xml
At this point, if all has gone according to plan, everything is setup correctly and we are ready to run.
Running Squash
To run squash:
$ squash config.xml
The result will be a few new files in the current directory.
Viewing output
The output TempData_1.xml is the output of squash; it is known as the Temporal Data document. This is the document that later gets passed to the TemporalValidator tool. Opening this document will reveal over 300 lines data formatted with time varying (tv) and rep (rep) tags..
You will also notice a couple of other new files with the prefix "TempData"; these are mostly debugging output and are not as important as the file mentioned above. Future versions of tXSchema may no longer output these files.
Back to the Tutorials index.