Standards /

WCPS-Manual / Grammar

Overview

The WCPS expression syntax is described below in the EBNF grammar syntax of IETF. Meta symbols used are as follows:

  • brackets ("[...]") denote optional elements which may occur or be left out;
  • an asterisk ("*") denotes that an arbitrary number of repetitions of the following element can be chosen, including none at all;
  • a vertical bar ("|") denotes alternatives from which exactly one must be chosen;
  • Double slashes ("//") begin comments which continue until the end of the line.

WCPS syntax

wcpsRequest:
              forClause [ whereClause ] returnClause
forClause:
              for coverageVariable
              in ( coverageList )
              ( , coverageVariable
              in ( coverageList ) )*
whereClause:
              where booleanScalarExpr
returnClause:
              return processingExpr
coverageList:
              coverageName ( , coverageName )*
processingExpr:
              encodedCoverageExpr
            | storeExpr
            | scalarExpr
encodedCoverageExpr:
	      encode ( coverageExpr, stringConstant [ , stringConstant ] )
storeExpr:
	      store ( encodedCoverageExpr )
scalarExpr:
	      metaDataExpr
	    | condenseExpr
	    | booleanScalarExpr
            | numericScalarExpr
            | stringScalarExpr
	    | ( scalarExpr )
metaDataExpr:
	      identifier ( coverageExpr )
	    | imageCrs ( coverageExpr )
	    | imageCrsDomain ( coverageExpr [ , axisName ] )
	    | crsSet ( coverageExpr )
	    | domainExpr
	    | nullSet( coverageExpr )
	    | interpolationDefault ( coverageExpr , fieldName )
	    | interpolationSet ( coverageExpr , fieldName )
booleanScalarExpr:
              booleanScalarTerm
              ( or booleanScalarTerm
		| xor booleanScalarTerm )*
booleanScalarTerm:
              booleanScalarNegation
              ( and booleanScalarNegation )*
booleanScalarNegation:
	      booleanScalarAtom
	    | not booleanScalarAtom
booleanScalarAtom:
              ( booleanScalarExpr )
            | stringScalarExpr compOp stringScalarExpr
            | numericScalarExpr compOp numericScalarExpr
            | booleanConstant
numericScalarExpr:
              numericScalarTerm
              ( + numericScalarTerm
		| - numericScalarTerm )*
numericScalarTerm:
 	      numericScalarFactor
              ( * numericScalarFactor
 		| / numericScalarFactor )*
numericScalarFactor:
 	      ( numericScalarExpr )
 	    | - numericScalarFactor
 	    | round ( numericScalarExpr )
 	    | integerConstant
            | floatConstant
            | complexConstant
            | condenseExpr
            | variableName
compOp:
	      =
	    | !=
 	    | <
 	    | >
 	    | <=
 	    | >=
coverageExpr:
	      coverageLogicTerm
              ( or coverageLogicTerm
		| xor coverageLogicTerm )*
coverageLogicTerm:
	      coverageLogicFactor ( and coverageLogicTerm )*
coverageLogicFactor:
	      coverageArithmeticExpr [ compOp coverageArithmeticExpr ]
coverageArithmeticExpr:
	      coverageArithmeticTerm
              ( + coverageArithmeticTerm
                | - coverageArithmeticTerm )*
coverageArithmeticTerm:
	      coverageArithmeticFactor
              ( * coverageArithmeticFactor
                | / coverageArithmeticFactor )*
coverageArithmeticFactor:
	      coverageValue ( overlay coverageValue )*
coverageValue:
              subsetExpr
            | unaryInducedExpr
            | scaleExpr
            | crsTransformExpr
            | coverageAtom
coverageAtom:
              scalarExpr
            | coverageVariable
            | ( coverageExpr )
            | coverageConstantExpr
            | coverageConstructorExpr
            | setMetaDataExpr
            | rangeConstructorExpr
setMetaDataExpr:
	      setIdentifier ( stringConstant , coverageExpr )
            | setCrsSet ( coverageExpr , crsList )
	    | setNullSet ( coverageExpr , rangeExprList )
	    | setInterpolationDefault ( coverageExpr , fieldName , interpolationMethod )
	    | setInterpolationSet ( coverageExpr , fieldName , interpolationMethodList )
unaryInducedExpr:
	      fieldExpr
            | unaryArithmeticExpr
	    | exponentialExpr
	    | trigonometricExpr
	    | booleanExpr
	    | castExpr
            | rangeConstructorExpr
unaryArithmeticExpr:
	      - coverageAtom
	    | + coverageAtom
	    | sqrt ( coverageExpr )
	    | abs ( coverageExpr )
	    | re ( coverageExpr )
	    | im ( coverageExpr )
exponentialExpr:
	      exp ( coverageExpr )
	    | log ( coverageExpr )
	    | ln ( coverageExpr )
trigonometricExpr:
	      sin ( coverageExpr )
	    | cos ( coverageExpr )
	    | tan ( coverageExpr )
	    | sinh ( coverageExpr )
	    | cosh ( coverageExpr )
	    | tanh ( coverageExpr )
	    | arcsin ( coverageExpr )
	    | arccos ( coverageExpr )
	    | arctan ( coverageExpr )
booleanExpr:
	      not coverageExpr
	    | bit ( coverageExpr , indexExpr )
indexExpr:
              indexTerm
              ( + indexTerm
                | - indexTerm )*
indexTerm:
              indexFactor
              ( * indexFactor
                | / indexFactor )*
indexFactor:
              integerConstant
            | round ( numericScalarExpr
            | ( indexExpr )
stringScalarExpr:
              identifier ( coverageExpr )
            | string
castExpr:
	      ( rangeType ) coverageExpr
rangeType:
	      boolean
	    | char
	    | short
            | long
	    | float
	    | double
   	    | complex
	    | complex2
	    | unsigned char
	    | unsigned short
	    | unsigned long
fieldExpr:
	      coverageAtom . fieldName
subsetExpr:
	      trimExpr
	    | sliceExpr
	    | extendExpr
trimExpr:
	      coverageAtom [ dimensionIntervalList ]
	    | trim ( coverageExpr , { dimensionIntervalList } )
sliceExpr:
	      coverageAtom [ dimensionPointList ]
	    | slice ( coverageExpr , { dimensionPointList } )
extendExpr:
	      extend ( coverageExpr , dimensionIntervalList )
scaleExpr:
	      scale ( coverageExpr , dimensionIntervalList , fieldInterpolationList )
crsTransformExpr:
	      crsTransform ( coverageExpr , dimensionIntervalList , fieldInterpolationList )
dimensionIntervalList:
              dimensionIntervalElement ( , dimensionIntervalElement )*
dimensionIntervalElement:
	      axisName [ : crsName ] ( dimensionIntervalExpr )
dimensionIntervalExpr:
              scalarExpr : scalarExpr
            | domain ( coverageName : axisName : crsName )
dimensionPointList:
	      dimensionPointElement ( , dimensionPointElement )*
dimensionPointElement:
	      axisName ( dimensionPoint )
            | axisName : crsName  ( dimensionPoint )
dimensionPoint:
	      scalarExpr
crsList:
	      { [ crsName ( , crsName )* ] }
fieldInterpolationList:
	      { fieldInterpolationElement ( , fieldInterpolationElement )* }
fieldInterpolationElement:
	      fieldName interpolationMethod
interpolationMethod:			// taken from WCS [OGC 07-067r5]
	      ( interpolationType : nullResistence )
interpolationType:
	      nearest
	    | linear
	    | quadratic
	    | cubic
nullResistence:
	      full
	    | none
	    | half
	    | other
coverageConstantExpr:
	      coverage coverageName
 	      over axisIteratorList
	      value list < scalarExpr >
coverageConstructorExpr:
	      coverage coverageName
 	      over axisIteratorList
	      values scalarExpr
axisIteratorList:
 	      variableName axisName ( intervalExpr ) ( , variableName axisName ( intervalExpr ) )*
generalCondenseExpr:
	      condense condenseOpType
              over axisIteratorList
              [ where booleanScalarExpr ]
              using coverageExpr
reduceExpr:
	      all ( coverageExpr )
	    | some ( coverageExpr )
	    | count ( coverageExpr )
	    | add ( coverageExpr )
	    | avg ( coverageExpr )
	    | min ( coverageExpr )
	    | max ( coverageExpr )
condenseExpr:
	      reduceExpr
            | generalCondenseExpr
condenseOpType:
	      +
	    | *
	    | max
	    | min
	    | and
	    | or
coverageName:
	      name
variableName:
	      $
crsName:
	      stringConstant
axisName:
	      name
fieldName:
	      name					// as defined in WCS [OGC 07-067r5] Table 19
rangeExprList:
 	      { [ rangeExpr ( , rangeExpr )* ] }
rangeExpr:
 	      struct { [ fieldName : scalarExpr ( : fieldName : scalarExpr )* ] }
rangeConstructorExpr:
 	      [ struct ] { fieldName : coverageExpr ( ; fieldName : coverageExpr )* }
domainExpr:
 	      domain ( coverageVariable , axisName , crsName )
intervalExpr:
              indexExpr : indexExpr
            | imageCrsDomain ( coverageName , axisName )
constantList:
              constant ( ; constant )*
interpolationMethodList:
              { [ interpolationMethod ( , interpolationMethod )* ] }
constant:
              string
            | booleanConstant
            | integerConstant
            | floatConstant
            | complexConstant
complexConstant:
              ( floatConstant , floatConstant )
stringConstant:
              string
name:
              name
            | string
            | integerConstant
coverageVariable:
              name

A identifier shall be a consecutive sequence consisting of decimal digits, upper case alphabetical characters, lower case alphabetical characters, underscore ("_"), and nothing else. The length of an identifier shall be at least 1, and the first character shall not be a decimal digit.

Note: WCS allows more freedom in the choice of identifiers; for the sake of simplicity this is tightened for now, but may be adapted to the WCS identifier definition in a future version of this standard.

A booleanLiteral shall represent a logical truth value expressed as one of the literals "true" and "false" resp., whereby upper and lower case characters shall not be distinguished.

An integerLiteral shall represent an integer number expressed in either decimal, octal (with a “0” prefix), or hexadecimal notation (with a "0x" or "0X" prefix).

A floatLiteral shall represent a floating point number following the syntax of the Java programming language.

A stringLiteral shall represent a character sequence expressed by enclosing it into double quotes (""").