Difference between revisions of "DAP4: DDX Grammar"

From OPeNDAP Documentation
Line 16: Line 16:
 
</dimensions>
 
</dimensions>
 
</pre>
 
</pre>
 +
 +
3. Where should attributes be legal; currently I have them allowed almost everywhere.
  
 
=== Testing the Grammar ===
 
=== Testing the Grammar ===

Revision as of 19:26, 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>

3. Where should attributes be legal; currently I have them allowed almost everywhere.

Testing the Grammar

You will need to copy three files:

  1. 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
  2. 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
  3. 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