Difference between revisions of "DAP4: DDX Grammar"
Line 1: | Line 1: | ||
'''Version: 1.0''' | '''Version: 1.0''' | ||
− | + | At the end of this document are instructions for accessing and testing a formal grammar for the DAP4 DDX. I constructed it without any reference to any other explicit or implicit grammars so I could record my proposal. I have since modified it based examining the implied grammar in page [[DAP4: Data Model]] | |
− | I constructed it without any reference to any other | + | and from comments from others. |
− | explicit or implicit grammars so I could record my | ||
− | |||
− | + | A number of minor issues need to be resolved. | |
− | |||
− | + | 1. Should all element names (e.g. <structure>) be capitalized? | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | 2. When should we use nested element names versus an attribute whose value is a list of names. For example, the current grammar stores dimension references for variables as a list in an attribute named "dimensions": e.g. dimensions="dr d1".<br/> | ||
+ | Previously I used this: | ||
<pre> | <pre> | ||
− | < | + | <dimensions> |
− | + | <dimension name="dr"/> | |
− | + | <dimension name="d1"/> | |
− | + | </dimensions> | |
− | + | </pre> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | </ | ||
− | + | === Testing the Grammar === | |
− | + | You will need to copy three files: | |
− | + | # dap4.rng - this is the grammar file; it uses the Relax-NG schema language (http://relaxng.org/).<br/>This can be obtained from http://dl.dropbox.com/u/53929684/dap4.rng | |
− | + | # test.xml - this is a test file, that I am growing to cover the whole grammar.<br/>This can be obtained from http://dl.dropbox.com/u/53929684/test.xml | |
− | + | # jing.jar - Jing is a validator that takes the grammar and a test file and checks that the test file conforms to the grammar.<br/>This can be obtained from http://dl.dropbox.com/u/53929684/jing.jar | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | To use it, do the command: | |
− | + | java -jar jing.jar dap4.rng test.xml | |
− | + | No output is produced if the validation succeeds, otherwise, error messages are produced. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | ''-Dennis Heimbigner'' | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 18:30, 22 February 2012
Version: 1.0
At the end of this document are instructions for accessing and testing a formal grammar for the DAP4 DDX. I constructed it without any reference to any other explicit or implicit grammars so I could record my proposal. I have since modified it based examining the implied grammar in page DAP4: Data Model and from comments from others.
A number of minor issues need to be resolved.
1. Should all element names (e.g. <structure>) be capitalized?
2. When should we use nested element names versus an attribute whose value is a list of names. For example, the current grammar stores dimension references for variables as a list in an attribute named "dimensions": e.g. dimensions="dr d1".
Previously I used this:
<dimensions> <dimension name="dr"/> <dimension name="d1"/> </dimensions>
Testing the Grammar
You will need to copy three files:
- dap4.rng - this is the grammar file; it uses the Relax-NG schema language (http://relaxng.org/).
This can be obtained from http://dl.dropbox.com/u/53929684/dap4.rng - test.xml - this is a test file, that I am growing to cover the whole grammar.
This can be obtained from http://dl.dropbox.com/u/53929684/test.xml - jing.jar - Jing is a validator that takes the grammar and a test file and checks that the test file conforms to the grammar.
This can be obtained from http://dl.dropbox.com/u/53929684/jing.jar
To use it, do the command:
java -jar jing.jar dap4.rng test.xml
No output is produced if the validation succeeds, otherwise, error messages are produced.
-Dennis Heimbigner