DRMS Names

See the [http://hmi.stanford.edu/doc/JSOC/DRMS_dataset_names.pdf DRMS Dataset Names] document for more a more detailed discussion of the semantics (the Word document from which this file is generated is at /web/hmi/htdocs/development/JSOC_Documents/Drafts/DRMS_dataset_names.doc).

In the extended BNF expression below white space is explicitly denoted <WS>. Literals are quoted as in 'literal', while \' indicates apostrophe character.

Basic non-terminals used:

 <Name> ::= <Letter> { <NameEnd> }
 <NameEnd> ::= ( <Letter> | <Digit> | '_' ) { <NameEnd> }
 <Letter> ::= 'a' | 'b' | ... | 'z' | 'A' | 'B' | ... | 'Z'
 <Digit> ::= '0' | '1' | ... | '9'
 <Value> ::= <Integer> | <Real> | <Time> | \'<String>\'
 <Time> ::= See SOI TN 94-116*
 <Value_Increment> ::= <Integer> | <Real> | <Time_Increment>
 <Time_Increment> ::= <Real><Time_Increment_Specifier>
 <Time_Increment_Specifier> ::= 's' | 'm' | 'h' | 'd'

* SOI TN 94-116: [http://soi.stanford.edu/technotes/94.116.html];

Main rules:

 <RecordSet>  ::= <SeriesName> <RecordSet_Filter> 
 <SeriesName> ::= <Name>

 <RecordSet_Filter> ::= '[' ( <RecordQuery> | <RecordList> ) ']' 
                         { <RecordSet_Filter> }

 <RecordQuery> ::= '?' <SQL where clause> '?'

 <RecordList> ::= ( ':'<RecnumRangeSet> | 
                    {<Primekey_Name>'='}<PrimekeyRangeSet> )
 <RecnumRangeSet> ::= <IndexRangeSet>
 <Primekey_Name> :: <Name>

 <PrimekeyRangeSet> ::= ( <IndexRangeSet> | <ValueRangeSet> )

 <IndexRangeSet> ::= ( '#' '^' |
                       '#' '$' |
                       '#' <Integer> |
                       '#' <Integer> '-' '#' { '@' <Integer> } |
                       '#' '-' '#' <Integer> { '@' <Integer> } |
                       '#' <Integer> '-' '#' <Integer> { '@' <Integer> } |
                       '#' <Integer> '/' <Integer> { '@' <Integer> } 
                      ) { ',' <IndexRangeSet> }

 <ValueRangeSet> ::= ( <Value> |
                       <Value> '-' <Value> { '@' <Value_Increment> } |
                       <Value> '/' <Value_Increment> { '@' <Value_Increment> } 
                      ) { ',' <ValueRangeSet> }

Some notes on usage:

seriesname[][2006.01.04/4d]

[? MagnetidType = 'Alpha' ?]

works, but using ".." or no quotes fails. This is because anything between the question marks are treated without modification as part of the SQL WHERE clause. For valid SQL syntax, please refer to http://www.postgresql.org/docs/8.2/static/sql-syntax.html