odata-abnf-construction-rules Grammar

odataUri

odataUri := serviceRoot [ odataRelativeUri ]
serviceRootodataRelativeUri

serviceRoot

serviceRoot := ( "https" / "http" )                    ; Note: case-insensitive
              "://" host [ ":" port ]
              "/" *( segment-nz "/" )
"https""http""://"host":"port"/"segment-nz"/"

odataRelativeUri

odataRelativeUri := %s"$batch"  [ "?" batchOptions ]
                 / %s"$entity" "?" entityOptions
                 / %s"$entity" "/" optionallyQualifiedEntityTypeName "?" entityCastOptions
                 / %s"$metadata" [ "?" metadataOptions ] [ context ]
                 / resourcePath [ "?" [ queryOptions ] ]
%s"$batch""?"batchOptions%s"$entity""?"entityOptions%s"$entity""/"optionallyQualifiedEntityTypeName"?"entityCastOptions%s"$metadata""?"metadataOptionscontextresourcePath"?"queryOptions

resourcePath

resourcePath := entitySetName                  [ collectionNavigation ]
             / singletonEntity                [ singleNavigation ]
             / actionImportCall
             / entityColFunctionImportCall    [ collectionNavigation ]
             / entityFunctionImportCall       [ singleNavigation ]
             / complexColFunctionImportCall   [ complexColPath ]
             / complexFunctionImportCall      [ complexPath ]
             / primitiveColFunctionImportCall [ collectionPath ]
             / primitiveFunctionImportCall    [ primitivePath ]
             / functionImportCallNoParens     [ querySegment ]
             / crossjoin                      [ querySegment ]
             / %s"$all"                         [ "/" optionallyQualifiedEntityTypeName ]
entitySetNamecollectionNavigationsingletonEntitysingleNavigationactionImportCallentityColFunctionImportCallcollectionNavigationentityFunctionImportCallsingleNavigationcomplexColFunctionImportCallcomplexColPathcomplexFunctionImportCallcomplexPathprimitiveColFunctionImportCallcollectionPathprimitiveFunctionImportCallprimitivePathfunctionImportCallNoParensquerySegmentcrossjoinquerySegment%s"$all""/"optionallyQualifiedEntityTypeName

collectionNavigation

collectionNavigation := collectionNavPath
                     / "/" optionallyQualifiedEntityTypeName [ collectionNavPath ]
collectionNavPath"/"optionallyQualifiedEntityTypeNamecollectionNavPath

collectionNavPath

collectionNavPath := keyPredicate [ singleNavigation ]
                     / filterInPath [ collectionNavigation ]
                     / each [ boundOperation ]
                     / boundOperation
                     / count
                     / ref
                     / querySegment
keyPredicatesingleNavigationfilterInPathcollectionNavigationeachboundOperationboundOperationcountrefquerySegment

keyPredicate

keyPredicate := simpleKey / compoundKey / keyPathSegments
simpleKeycompoundKeykeyPathSegments

simpleKey

simpleKey := OPEN ( parameterAlias / keyPropertyValue ) CLOSE
OPENparameterAliaskeyPropertyValueCLOSE

compoundKey

compoundKey := OPEN keyValuePair *( COMMA keyValuePair ) CLOSE
OPENkeyValuePairCOMMAkeyValuePairCLOSE

keyValuePair

keyValuePair := ( primitiveKeyProperty / keyPropertyAlias  ) EQ ( parameterAlias / keyPropertyValue )
primitiveKeyPropertykeyPropertyAliasEQparameterAliaskeyPropertyValue

keyPropertyAlias

keyPropertyAlias := odataIdentifier
odataIdentifier

keyPathSegments

keyPathSegments := 1*( "/" keyPathLiteral )
"/"keyPathLiteral

keyPathLiteral

keyPathLiteral := *pchar
pchar

keyPropertyValue

keyPropertyValue := boolean
                 / guid
                 / dateTimeOffsetLiteral
                 / date
                 / timeOfDayLiteral
                 / decimalLiteral
                 / sbyteLiteral
                 / byte
                 / int16Literal
                 / int32Literal
                 / int64Literal
                 / stringLiteral
                 / durationLiteral
                 / enumLiteral
booleanguiddateTimeOffsetLiteraldatetimeOfDayLiteraldecimalLiteralsbyteLiteralbyteint16Literalint32Literalint64LiteralstringLiteraldurationLiteralenumLiteral

singleNavigation

singleNavigation := singleNavPath
                 / "/" optionallyQualifiedEntityTypeName [ singleNavPath ]
singleNavPath"/"optionallyQualifiedEntityTypeNamesingleNavPath

singleNavPath

singleNavPath := "/" propertyPath
              / boundOperation
              / ref
              / value  ; request the media resource of a media entity
              / querySegment
"/"propertyPathboundOperationrefvaluequerySegment

propertyPath

propertyPath := entityColNavigationProperty [ collectionNavigation ]
             / entityNavigationProperty    [ singleNavigation ]
             / complexColProperty          [ complexColPath ]
             / complexProperty             [ complexPath ]
             / primitiveColProperty        [ collectionPath ]
             / primitiveProperty           [ primitivePath ]
             / streamProperty              [ boundOperation ]
entityColNavigationPropertycollectionNavigationentityNavigationPropertysingleNavigationcomplexColPropertycomplexColPathcomplexPropertycomplexPathprimitiveColPropertycollectionPathprimitivePropertyprimitivePathstreamPropertyboundOperation

collectionPath

collectionPath := count / boundOperation / ordinalIndex / querySegment
countboundOperationordinalIndexquerySegment

primitivePath

primitivePath := value / boundOperation / querySegment
valueboundOperationquerySegment

complexColPath

complexColPath := collectionPath
               / "/" optionallyQualifiedComplexTypeName [ collectionPath ]
collectionPath"/"optionallyQualifiedComplexTypeNamecollectionPath

complexPath

complexPath := complexNavPath
            / "/" optionallyQualifiedComplexTypeName [ complexNavPath ]
complexNavPath"/"optionallyQualifiedComplexTypeNamecomplexNavPath

complexNavPath

complexNavPath := "/" propertyPath
               / boundOperation
               / querySegment
"/"propertyPathboundOperationquerySegment

filterInPath

filterInPath := %s"/$filter" OPEN boolCommonExpr CLOSE
%s"/$filter"OPENboolCommonExprCLOSE

each

each := %s"/$each"
%s"/$each"

count

count := %s"/$count"
%s"/$count"

ref

ref := %s"/$ref"
%s"/$ref"

value

value := %s"/$value"
%s"/$value"

querySegment

querySegment := %s"/$query"
%s"/$query"

ordinalIndex

ordinalIndex := "/" [ "-" ] 1*DIGIT
"/""-"DIGIT

boundOperation

boundOperation := "/" ( boundActionCall
                     / boundEntityColFunctionCall    [ collectionNavigation ]
                     / boundEntityFunctionCall       [ singleNavigation ]
                     / boundComplexColFunctionCall   [ complexColPath ]
                     / boundComplexFunctionCall      [ complexPath ]
                     / boundPrimitiveColFunctionCall [ collectionPath ]
                     / boundPrimitiveFunctionCall    [ primitivePath ]
                     / boundFunctionCallNoParens     [ querySegment ]
                     )
"/"boundActionCallboundEntityColFunctionCallcollectionNavigationboundEntityFunctionCallsingleNavigationboundComplexColFunctionCallcomplexColPathboundComplexFunctionCallcomplexPathboundPrimitiveColFunctionCallcollectionPathboundPrimitiveFunctionCallprimitivePathboundFunctionCallNoParensquerySegment

actionImportCall

actionImportCall := actionImport
actionImport

boundActionCall

boundActionCall := [ namespace "." ] action
namespace"."action

boundEntityFunctionCall

boundEntityFunctionCall := [ namespace "." ] entityFunction       functionParameters
namespace"."entityFunctionfunctionParameters

boundEntityColFunctionCall

boundEntityColFunctionCall := [ namespace "." ] entityColFunction    functionParameters
namespace"."entityColFunctionfunctionParameters

boundComplexFunctionCall

boundComplexFunctionCall := [ namespace "." ] complexFunction      functionParameters
namespace"."complexFunctionfunctionParameters

boundComplexColFunctionCall

boundComplexColFunctionCall := [ namespace "." ] complexColFunction   functionParameters
namespace"."complexColFunctionfunctionParameters

boundPrimitiveFunctionCall

boundPrimitiveFunctionCall := [ namespace "." ] primitiveFunction    functionParameters
namespace"."primitiveFunctionfunctionParameters

boundPrimitiveColFunctionCall

boundPrimitiveColFunctionCall := [ namespace "." ] primitiveColFunction functionParameters
namespace"."primitiveColFunctionfunctionParameters

boundFunctionCallNoParens

boundFunctionCallNoParens := [ namespace "." ] entityFunction
                              / [ namespace "." ] entityColFunction
                              / [ namespace "." ] complexFunction
                              / [ namespace "." ] complexColFunction
                              / [ namespace "." ] primitiveFunction
                              / [ namespace "." ] primitiveColFunction
namespace"."entityFunctionnamespace"."entityColFunctionnamespace"."complexFunctionnamespace"."complexColFunctionnamespace"."primitiveFunctionnamespace"."primitiveColFunction

entityFunctionImportCall

entityFunctionImportCall := entityFunctionImport       functionParameters
entityFunctionImportfunctionParameters

entityColFunctionImportCall

entityColFunctionImportCall := entityColFunctionImport    functionParameters
entityColFunctionImportfunctionParameters

complexFunctionImportCall

complexFunctionImportCall := complexFunctionImport      functionParameters
complexFunctionImportfunctionParameters

complexColFunctionImportCall

complexColFunctionImportCall := complexColFunctionImport   functionParameters
complexColFunctionImportfunctionParameters

primitiveFunctionImportCall

primitiveFunctionImportCall := primitiveFunctionImport    functionParameters
primitiveFunctionImportfunctionParameters

primitiveColFunctionImportCall

primitiveColFunctionImportCall := primitiveColFunctionImport functionParameters
primitiveColFunctionImportfunctionParameters

functionImportCallNoParens

functionImportCallNoParens := entityFunctionImport
                               / entityColFunctionImport
                               / complexFunctionImport
                               / complexColFunctionImport
                               / primitiveFunctionImport
                               / primitiveColFunctionImport
entityFunctionImportentityColFunctionImportcomplexFunctionImportcomplexColFunctionImportprimitiveFunctionImportprimitiveColFunctionImport

functionParameters

functionParameters := OPEN [ BWS functionParameter *( BWS COMMA BWS functionParameter ) ] BWS CLOSE
OPENBWSfunctionParameterBWSCOMMABWSfunctionParameterBWSCLOSE

functionParameter

functionParameter := parameterName EQ ( parameterAlias / primitiveLiteral )
parameterNameEQparameterAliasprimitiveLiteral

parameterName

parameterName := odataIdentifier
odataIdentifier

parameterAlias

parameterAlias := AT odataIdentifier
ATodataIdentifier

crossjoin

crossjoin := %s"$crossjoin" OPEN
            entitySetName *( COMMA entitySetName )
            CLOSE
%s"$crossjoin"OPENentitySetNameCOMMAentitySetNameCLOSE

queryOptions

queryOptions := queryOption *( "&" queryOption )
queryOption"&"queryOption

queryOption

queryOption := systemQueryOption
             / aliasAndValue
             / nameAndValue
             / customQueryOption
systemQueryOptionaliasAndValuenameAndValuecustomQueryOption

batchOptions

batchOptions := batchOption *( "&" batchOption )
batchOption"&"batchOption

batchOption

batchOption := format
             / customQueryOption
formatcustomQueryOption

metadataOptions

metadataOptions := metadataOption *( "&" metadataOption )
metadataOption"&"metadataOption

metadataOption

metadataOption := format
                / customQueryOption
formatcustomQueryOption

entityOptions

entityOptions := *( entityIdOption "&" ) id *( "&" entityIdOption )
entityIdOption"&"id"&"entityIdOption

entityIdOption

entityIdOption := format
               / customQueryOption
formatcustomQueryOption

entityCastOptions

entityCastOptions := *( entityCastOption "&" ) id *( "&" entityCastOption )
entityCastOption"&"id"&"entityCastOption

entityCastOption

entityCastOption := entityIdOption
                  / expand
                  / select
entityIdOptionexpandselect

id

id := ( "$id" / "id" ) EQ IRI-in-query
"$id""id"EQIRI-in-query

systemQueryOption

systemQueryOption := compute
                  / deltatoken
                  / expand
                  / filter
                  / format
                  / id
                  / inlinecount
                  / orderby
                  / schemaversion
                  / search
                  / select
                  / skip
                  / skiptoken
                  / top
                  / index
computedeltatokenexpandfilterformatidinlinecountorderbyschemaversionsearchselectskipskiptokentopindex

compute

compute := ( "$compute" / "compute" ) EQ computeItem *( COMMA computeItem )
"$compute""compute"EQcomputeItemCOMMAcomputeItem

computeItem

computeItem := commonExpr RWS "as" RWS computedProperty
commonExprRWS"as"RWScomputedProperty

computedProperty

computedProperty := odataIdentifier
odataIdentifier

expand

expand := ( "$expand" / "expand" ) EQ expandItem *( COMMA expandItem )
"$expand""expand"EQexpandItemCOMMAexpandItem

expandItem

expandItem := "$value"
                  / expandPath
                  / optionallyQualifiedEntityTypeName "/" expandPath
"$value"expandPathoptionallyQualifiedEntityTypeName"/"expandPath

expandPath

expandPath := ( STAR [ ref / OPEN levels CLOSE ]
                    / ( navigationProperty / entityAnnotationInQuery ) [ "/" optionallyQualifiedEntityTypeName ]
                      [ ref   [ OPEN expandRefOption   *( SEMI expandRefOption   ) CLOSE ]
                      / count [ OPEN expandCountOption *( SEMI expandCountOption ) CLOSE ]
                      /         OPEN expandOption      *( SEMI expandOption      ) CLOSE
                      ]
                    / ( complexProperty / complexColProperty / optionallyQualifiedComplexTypeName / complexAnnotationInQuery ) "/" expandPath
                    / streamProperty
                    )
STARrefOPENlevelsCLOSEnavigationPropertyentityAnnotationInQuery"/"optionallyQualifiedEntityTypeNamerefOPENexpandRefOptionSEMIexpandRefOptionCLOSEcountOPENexpandCountOptionSEMIexpandCountOptionCLOSEOPENexpandOptionSEMIexpandOptionCLOSEcomplexPropertycomplexColPropertyoptionallyQualifiedComplexTypeNamecomplexAnnotationInQuery"/"expandPathstreamProperty

expandCountOption

expandCountOption := filter
                  / search
filtersearch

expandRefOption

expandRefOption := expandCountOption
                  / orderby
                  / skip
                  / top
                  / inlinecount
expandCountOptionorderbyskiptopinlinecount

expandOption

expandOption := expandRefOption
                  / select
                  / expand
                  / compute
                  / levels
                  / aliasAndValue
expandRefOptionselectexpandcomputelevelsaliasAndValue

levels

levels := ( "$levels" / "levels" ) EQ ( oneToNine *DIGIT / "max" )
"$levels""levels"EQoneToNineDIGIT"max"

filter

filter := ( "$filter" / "filter" ) EQ boolCommonExpr
"$filter""filter"EQboolCommonExpr

orderby

orderby := ( "$orderby" / "orderby" ) EQ orderbyItem *( COMMA orderbyItem )
"$orderby""orderby"EQorderbyItemCOMMAorderbyItem

orderbyItem

orderbyItem := commonExpr [ RWS ( "asc" / "desc" ) ]
commonExprRWS"asc""desc"

top

top := ( "$top"  / "top"  ) EQ 1*DIGIT
"$top""top"EQDIGIT

index

index := ( "$index" / "index" ) EQ [ "-" ] 1*DIGIT
"$index""index"EQ"-"DIGIT

format

format := ( "$format" / "format" ) EQ
         ( "atom"
         / "json"
         / "xml"
         / 1*pchar "/" 1*pchar ; <a data service specific value indicating a
         )                     ; format specific to the specific data service> or
"$format""format"EQ"atom""json""xml"pchar"/"pchar

inlinecount

inlinecount := ( "$count" / "count" ) EQ boolean
"$count""count"EQboolean

schemaversion

schemaversion := ( "$schemaversion" / "schemaversion" ) EQ ( STAR / 1*unreserved )
"$schemaversion""schemaversion"EQSTARunreserved

searchExpr

searchExpr := ( searchParenExpr
             / searchNegateExpr
             / searchPhrase
             / searchWord
             ) [ searchOrExpr
               / searchAndExpr
               ]
searchParenExprsearchNegateExprsearchPhrasesearchWordsearchOrExprsearchAndExpr

searchParenExpr

searchParenExpr := OPEN BWS searchExpr BWS CLOSE
OPENBWSsearchExprBWSCLOSE

searchNegateExpr

searchNegateExpr := %s"NOT" RWS searchExpr
%s"NOT"RWSsearchExpr

searchOrExpr

searchOrExpr := RWS %s"OR"  RWS searchExpr
RWS%s"OR"RWSsearchExpr

searchAndExpr

searchAndExpr := RWS [ %s"AND" RWS ] searchExpr
RWS%s"AND"RWSsearchExpr

searchPhrase

searchPhrase := quotation-mark 1*( qchar-no-AMP-DQUOTE / SP ) quotation-mark
quotation-markqchar-no-AMP-DQUOTESPquotation-mark

searchWord

searchWord := searchChar *( searchChar / SQUOTE )
searchCharsearchCharSQUOTE

searchChar

searchChar := unreserved / pct-encoded-no-DQUOTE / "!" / "*" / "+" / "," / ":" / "@" / "/" / "?" / "$" / "="
unreservedpct-encoded-no-DQUOTE"!""*""+"","":""@""/""?""$""="

searchExpr-incomplete

searchExpr-incomplete := SQUOTE *( SQUOTE-in-string / qchar-no-AMP-SQUOTE / quotation-mark / SP ) SQUOTE
SQUOTESQUOTE-in-stringqchar-no-AMP-SQUOTEquotation-markSPSQUOTE

select

select := ( "$select" / "select" ) EQ selectItem *( COMMA selectItem )
"$select""select"EQselectItemCOMMAselectItem

selectItem

selectItem := STAR
               / allOperationsInSchema
               / selectProperty
               / optionallyQualifiedActionName
               / optionallyQualifiedFunctionName
               / ( optionallyQualifiedEntityTypeName / optionallyQualifiedComplexTypeName )
                 "/" ( selectProperty
                     / optionallyQualifiedActionName
                     / optionallyQualifiedFunctionName
                     )
STARallOperationsInSchemaselectPropertyoptionallyQualifiedActionNameoptionallyQualifiedFunctionNameoptionallyQualifiedEntityTypeNameoptionallyQualifiedComplexTypeName"/"selectPropertyoptionallyQualifiedActionNameoptionallyQualifiedFunctionName

selectProperty

selectProperty := primitiveProperty / primitiveAnnotationInQuery
               / ( primitiveColProperty / primitiveColAnnotationInQuery ) [ OPEN selectOptionPC *( SEMI selectOptionPC ) CLOSE ]
               / navigationProperty
               / selectPath [ OPEN selectOption *( SEMI selectOption ) CLOSE
                            / "/" selectProperty
                            ]
primitivePropertyprimitiveAnnotationInQueryprimitiveColPropertyprimitiveColAnnotationInQueryOPENselectOptionPCSEMIselectOptionPCCLOSEnavigationPropertyselectPathOPENselectOptionSEMIselectOptionCLOSE"/"selectProperty

selectPath

selectPath := ( complexProperty / complexColProperty / complexAnnotationInQuery ) [ "/" optionallyQualifiedComplexTypeName ]
complexPropertycomplexColPropertycomplexAnnotationInQuery"/"optionallyQualifiedComplexTypeName

selectOptionPC

selectOptionPC := filter / search / inlinecount / orderby / skip / top
filtersearchinlinecountorderbyskiptop

selectOption

selectOption := selectOptionPC
               / compute / select / aliasAndValue
selectOptionPCcomputeselectaliasAndValue

allOperationsInSchema

allOperationsInSchema := namespace "." STAR
namespace"."STAR

optionallyQualifiedActionName

optionallyQualifiedActionName := [ namespace "." ] action
namespace"."action

optionallyQualifiedFunctionName

optionallyQualifiedFunctionName := [ namespace "." ] function [ OPEN parameterNames CLOSE ]
namespace"."functionOPENparameterNamesCLOSE

parameterNames

parameterNames := parameterName *( COMMA parameterName )
parameterNameCOMMAparameterName

deltatoken

deltatoken := "$deltatoken" EQ 1*( qchar-no-AMP )
"$deltatoken"EQqchar-no-AMP

skiptoken

skiptoken := "$skiptoken" EQ 1*( qchar-no-AMP )
"$skiptoken"EQqchar-no-AMP

aliasAndValue

aliasAndValue := parameterAlias EQ parameterValue
parameterAliasEQparameterValue

nameAndValue

nameAndValue := parameterName EQ parameterValue
parameterNameEQparameterValue

parameterValue

parameterValue := arrayOrObject
               / commonExpr
arrayOrObjectcommonExpr

customQueryOption

customQueryOption := customName [ EQ customValue ]
customNameEQcustomValue

customName

customName := qchar-no-AMP-EQ-AT-DOLLAR *( qchar-no-AMP-EQ )
qchar-no-AMP-EQ-AT-DOLLARqchar-no-AMP-EQ

customValue

customValue := *( qchar-no-AMP )
qchar-no-AMP

complexAnnotationInQuery

complexAnnotationInQuery := annotationInQuery ; complex-valued annotation
annotationInQuery

entityAnnotationInQuery

entityAnnotationInQuery := annotationInQuery ; entity-valued annotation
annotationInQuery

primitiveAnnotationInQuery

primitiveAnnotationInQuery := annotationInQuery ; primitive-valued annotation
annotationInQuery

primitiveColAnnotationInQuery

primitiveColAnnotationInQuery := annotationInQuery ; primitive collection-valued annotation
annotationInQuery

context

context := "#" contextFragment
"#"contextFragment

contextFragment

contextFragment := %s"Collection($ref)"
                / %s"$ref"
                / %s"Collection(Edm.EntityType)"
                / %s"Collection(Edm.ComplexType)"
                / singletonEntity [ navigation *( containmentNavigation ) [ "/" qualifiedEntityTypeName ] ] [ selectList ]
                / qualifiedTypeName [ selectList ]
                / entitySet ( %s"/$deletedEntity" / %s"/$link" / %s"/$deletedLink" )
                / entitySet keyPredicate "/" contextPropertyPath [ selectList ]
                / entitySet [ selectList ] [ %s"/$entity" / %s"/$delta" ]
%s"Collection($ref)"%s"$ref"%s"Collection(Edm.EntityType)"%s"Collection(Edm.ComplexType)"singletonEntitynavigationcontainmentNavigation"/"qualifiedEntityTypeNameselectListqualifiedTypeNameselectListentitySet%s"/$deletedEntity"%s"/$link"%s"/$deletedLink"entitySetkeyPredicate"/"contextPropertyPathselectListentitySetselectList%s"/$entity"%s"/$delta"

entitySet

entitySet := entitySetName *( containmentNavigation ) [ "/" qualifiedEntityTypeName ]
entitySetNamecontainmentNavigation"/"qualifiedEntityTypeName

containmentNavigation

containmentNavigation := keyPredicate [ "/" qualifiedEntityTypeName ] navigation
keyPredicate"/"qualifiedEntityTypeNamenavigation

selectList

selectList := OPEN [ selectListItem *( COMMA selectListItem ) ] CLOSE
OPENselectListItemCOMMAselectListItemCLOSE

selectListItem

selectListItem := STAR ; all structural properties
                   / allOperationsInSchema
                   / [ ( qualifiedEntityTypeName / qualifiedComplexTypeName ) "/" ]
                     ( qualifiedActionName
                     / qualifiedFunctionName
                     / selectListProperty
                     )
STARallOperationsInSchemaqualifiedEntityTypeNamequalifiedComplexTypeName"/"qualifiedActionNamequalifiedFunctionNameselectListProperty

selectListProperty

selectListProperty := primitiveProperty
                   / primitiveColProperty
                   / ( navigationProperty / entityAnnotationInFragment ) [ "+" ] [ selectList ]
                   / ( complexProperty / complexColProperty / complexAnnotationInFragment ) [ "/" qualifiedComplexTypeName ] [ "/" selectListProperty ]
primitivePropertyprimitiveColPropertynavigationPropertyentityAnnotationInFragment"+"selectListcomplexPropertycomplexColPropertycomplexAnnotationInFragment"/"qualifiedComplexTypeName"/"selectListProperty

contextPropertyPath

contextPropertyPath := primitiveProperty
                    / primitiveColProperty
                    / complexColProperty
                    / complexProperty [ [ "/" qualifiedComplexTypeName ] "/" contextPropertyPath ]
primitivePropertyprimitiveColPropertycomplexColPropertycomplexProperty"/"qualifiedComplexTypeName"/"contextPropertyPath

qualifiedActionName

qualifiedActionName := namespace "." action
namespace"."action

qualifiedFunctionName

qualifiedFunctionName := namespace "." function [ OPEN parameterNames CLOSE ]
namespace"."functionOPENparameterNamesCLOSE

complexAnnotationInFragment

complexAnnotationInFragment := annotationInFragment ; complex-valued annotation
annotationInFragment

entityAnnotationInFragment

entityAnnotationInFragment := annotationInFragment ; entity-valued annotation
annotationInFragment

commonExpr

commonExpr := ( primitiveLiteral
             / arrayOrObject
             / rootExpr
             / functionExpr
             / negateExpr
             / methodCallExpr
             / parenExpr
             / castExpr
             / isofExpr
             / notExpr
             / firstMemberExpr
             )
             [ addExpr
             / subExpr
             / mulExpr
             / divExpr
             / divbyExpr
             / modExpr
             ]
             [ eqExpr
             / neExpr
             / ltExpr
             / leExpr
             / gtExpr
             / geExpr
             / hasExpr
             / inExpr
             ]
             [ andExpr
             / orExpr
             ]
primitiveLiteralarrayOrObjectrootExprfunctionExprnegateExprmethodCallExprparenExprcastExprisofExprnotExprfirstMemberExpraddExprsubExprmulExprdivExprdivbyExprmodExpreqExprneExprltExprleExprgtExprgeExprhasExprinExprandExprorExpr

boolCommonExpr

boolCommonExpr := commonExpr ; resulting in a Boolean
commonExpr

rootExpr

rootExpr := %s"$root/" ( entitySetName   [ collectionNavigationExpr ]
                      / singletonEntity [ singleNavigationExpr ]
                      / entityColFunctionImport    functionExprParameters [ collectionNavigationExpr ]
                      / entityFunctionImport       functionExprParameters [ singleNavigationExpr ]
                      / complexColFunctionImport   functionExprParameters [ complexColPathExpr ]
                      / complexFunctionImport      functionExprParameters [ complexPathExpr ]
                      / primitiveColFunctionImport functionExprParameters [ collectionPathExpr ]
                      / primitiveFunctionImport    functionExprParameters [ primitivePathExpr ]
                      )
%s"$root/"entitySetNamecollectionNavigationExprsingletonEntitysingleNavigationExprentityColFunctionImportfunctionExprParameterscollectionNavigationExprentityFunctionImportfunctionExprParameterssingleNavigationExprcomplexColFunctionImportfunctionExprParameterscomplexColPathExprcomplexFunctionImportfunctionExprParameterscomplexPathExprprimitiveColFunctionImportfunctionExprParameterscollectionPathExprprimitiveFunctionImportfunctionExprParametersprimitivePathExpr

firstMemberExpr

firstMemberExpr := memberExpr
                / inscopeVariableExpr [ "/" memberExpr ]
memberExprinscopeVariableExpr"/"memberExpr

memberExpr

memberExpr := directMemberExpr
           / ( optionallyQualifiedEntityTypeName / optionallyQualifiedComplexTypeName ) "/" directMemberExpr
directMemberExproptionallyQualifiedEntityTypeNameoptionallyQualifiedComplexTypeName"/"directMemberExpr

directMemberExpr

directMemberExpr := propertyPathExpr
                 / boundFunctionExpr
                 / annotationExpr
propertyPathExprboundFunctionExprannotationExpr

propertyPathExpr

propertyPathExpr := ( entityColNavigationProperty [ collectionNavigationExpr ]
                   / entityNavigationProperty    [ singleNavigationExpr ]
                   / complexColProperty          [ complexColPathExpr ]
                   / complexProperty             [ complexPathExpr ]
                   / primitiveColProperty        [ collectionPathExpr ]
                   / primitiveProperty           [ primitivePathExpr ]
                   / streamProperty              [ primitivePathExpr ]
                   )
entityColNavigationPropertycollectionNavigationExprentityNavigationPropertysingleNavigationExprcomplexColPropertycomplexColPathExprcomplexPropertycomplexPathExprprimitiveColPropertycollectionPathExprprimitivePropertyprimitivePathExprstreamPropertyprimitivePathExpr

annotationExpr

annotationExpr := annotationInQuery
                 [ collectionPathExpr
                 / singleNavigationExpr
                 / complexPathExpr
                 / primitivePathExpr
                 ]
annotationInQuerycollectionPathExprsingleNavigationExprcomplexPathExprprimitivePathExpr

annotationInQuery

annotationInQuery := AT [ namespace "." ] termName [ HASH annotationQualifier ]
ATnamespace"."termNameHASHannotationQualifier

annotationInFragment

annotationInFragment := AT [ namespace "." ] termName [ "#"  annotationQualifier ]
ATnamespace"."termName"#"annotationQualifier

annotationQualifier

annotationQualifier := odataIdentifier
odataIdentifier

inscopeVariableExpr

inscopeVariableExpr := implicitVariableExpr
                     / parameterAlias
                     / lambdaVariableExpr ; only allowed inside a lambdaPredicateExpr
implicitVariableExprparameterAliaslambdaVariableExpr

implicitVariableExpr

implicitVariableExpr := %s"$it"              ; the current instance of the resource identified by the resource path
                     / %s"$this"            ; the instance on which the query option is evaluated
%s"$it"%s"$this"

lambdaVariableExpr

lambdaVariableExpr := odataIdentifier
odataIdentifier

collectionNavigationExpr

collectionNavigationExpr := collectionNavNoCastExpr
                         / "/" optionallyQualifiedEntityTypeName collectionNavNoCastExpr
collectionNavNoCastExpr"/"optionallyQualifiedEntityTypeNamecollectionNavNoCastExpr

collectionNavNoCastExpr

collectionNavNoCastExpr := keyPredicate [ singleNavigationExpr ]
                        / filterExpr [ collectionNavigationExpr ]
                        / collectionPathExpr
keyPredicatesingleNavigationExprfilterExprcollectionNavigationExprcollectionPathExpr

singleNavigationExpr

singleNavigationExpr := "/" memberExpr
"/"memberExpr

filterExpr

filterExpr := %s"/$filter" OPEN boolCommonExpr CLOSE
%s"/$filter"OPENboolCommonExprCLOSE

complexColPathExpr

complexColPathExpr := collectionPathExpr
                   / "/" optionallyQualifiedComplexTypeName [ collectionPathExpr ]
collectionPathExpr"/"optionallyQualifiedComplexTypeNamecollectionPathExpr

collectionPathExpr

collectionPathExpr := count [ OPEN expandCountOption *( SEMI expandCountOption ) CLOSE ]
                   / filterExpr [ collectionPathExpr ]
                   / "/" anyExpr
                   / "/" allExpr
                   / "/" boundFunctionExpr
                   / "/" annotationExpr
countOPENexpandCountOptionSEMIexpandCountOptionCLOSEfilterExprcollectionPathExpr"/"anyExpr"/"allExpr"/"boundFunctionExpr"/"annotationExpr

complexPathExpr

complexPathExpr := "/" directMemberExpr
                / "/" optionallyQualifiedComplexTypeName [ "/" directMemberExpr ]
"/"directMemberExpr"/"optionallyQualifiedComplexTypeName"/"directMemberExpr

primitivePathExpr

primitivePathExpr := "/" [ annotationExpr / boundFunctionExpr ]
"/"annotationExprboundFunctionExpr

boundFunctionExpr

boundFunctionExpr := functionExpr ; boundFunction segments can only be composed if the type of the
functionExpr

functionExpr

functionExpr := [ namespace "." ]
               ( entityColFunction    functionExprParameters [ collectionNavigationExpr ]
               / entityFunction       functionExprParameters [ singleNavigationExpr ]
               / complexColFunction   functionExprParameters [ complexColPathExpr ]
               / complexFunction      functionExprParameters [ complexPathExpr ]
               / primitiveColFunction functionExprParameters [ collectionPathExpr ]
               / primitiveFunction    functionExprParameters [ primitivePathExpr ]
               )
namespace"."entityColFunctionfunctionExprParameterscollectionNavigationExprentityFunctionfunctionExprParameterssingleNavigationExprcomplexColFunctionfunctionExprParameterscomplexColPathExprcomplexFunctionfunctionExprParameterscomplexPathExprprimitiveColFunctionfunctionExprParameterscollectionPathExprprimitiveFunctionfunctionExprParametersprimitivePathExpr

functionExprParameters

functionExprParameters := OPEN [ BWS functionExprParameter *( BWS COMMA BWS functionExprParameter ) ] BWS CLOSE
OPENBWSfunctionExprParameterBWSCOMMABWSfunctionExprParameterBWSCLOSE

functionExprParameter

functionExprParameter := parameterName EQ ( parameterAlias / parameterValue )
parameterNameEQparameterAliasparameterValue

anyExpr

anyExpr := "any" OPEN BWS [ lambdaVariableExpr BWS COLON BWS lambdaPredicateExpr ] BWS CLOSE
"any"OPENBWSlambdaVariableExprBWSCOLONBWSlambdaPredicateExprBWSCLOSE

allExpr

allExpr := "all" OPEN BWS   lambdaVariableExpr BWS COLON BWS lambdaPredicateExpr   BWS CLOSE
"all"OPENBWSlambdaVariableExprBWSCOLONBWSlambdaPredicateExprBWSCLOSE

lambdaPredicateExpr

lambdaPredicateExpr := boolCommonExpr ; containing at least one lambdaVariableExpr
boolCommonExpr

methodCallExpr

methodCallExpr := indexOfMethodCallExpr
               / toLowerMethodCallExpr
               / toUpperMethodCallExpr
               / trimMethodCallExpr
               / substringMethodCallExpr
               / concatMethodCallExpr
               / lengthMethodCallExpr
               / matchesPatternMethodCallExpr
               / yearMethodCallExpr
               / monthMethodCallExpr
               / dayMethodCallExpr
               / hourMethodCallExpr
               / minuteMethodCallExpr
               / secondMethodCallExpr
               / fractionalsecondsMethodCallExpr
               / totalsecondsMethodCallExpr
               / dateMethodCallExpr
               / timeMethodCallExpr
               / roundMethodCallExpr
               / floorMethodCallExpr
               / ceilingMethodCallExpr
               / distanceMethodCallExpr
               / geoLengthMethodCallExpr
               / totalOffsetMinutesMethodCallExpr
               / minDateTimeMethodCallExpr
               / maxDateTimeMethodCallExpr
               / nowMethodCallExpr
               / caseMethodCallExpr
               / boolMethodCallExpr
indexOfMethodCallExprtoLowerMethodCallExprtoUpperMethodCallExprtrimMethodCallExprsubstringMethodCallExprconcatMethodCallExprlengthMethodCallExprmatchesPatternMethodCallExpryearMethodCallExprmonthMethodCallExprdayMethodCallExprhourMethodCallExprminuteMethodCallExprsecondMethodCallExprfractionalsecondsMethodCallExprtotalsecondsMethodCallExprdateMethodCallExprtimeMethodCallExprroundMethodCallExprfloorMethodCallExprceilingMethodCallExprdistanceMethodCallExprgeoLengthMethodCallExprtotalOffsetMinutesMethodCallExprminDateTimeMethodCallExprmaxDateTimeMethodCallExprnowMethodCallExprcaseMethodCallExprboolMethodCallExpr

boolMethodCallExpr

boolMethodCallExpr := endsWithMethodCallExpr
                   / startsWithMethodCallExpr
                   / containsMethodCallExpr
                   / intersectsMethodCallExpr
                   / hasSubsetMethodCallExpr
                   / hasSubsequenceMethodCallExpr
endsWithMethodCallExprstartsWithMethodCallExprcontainsMethodCallExprintersectsMethodCallExprhasSubsetMethodCallExprhasSubsequenceMethodCallExpr

concatMethodCallExpr

concatMethodCallExpr := "concat"         OPEN BWS commonExpr BWS COMMA BWS commonExpr BWS CLOSE
"concat"OPENBWScommonExprBWSCOMMABWScommonExprBWSCLOSE

containsMethodCallExpr

containsMethodCallExpr := "contains"       OPEN BWS commonExpr BWS COMMA BWS commonExpr BWS CLOSE
"contains"OPENBWScommonExprBWSCOMMABWScommonExprBWSCLOSE

endsWithMethodCallExpr

endsWithMethodCallExpr := "endswith"       OPEN BWS commonExpr BWS COMMA BWS commonExpr BWS CLOSE
"endswith"OPENBWScommonExprBWSCOMMABWScommonExprBWSCLOSE

indexOfMethodCallExpr

indexOfMethodCallExpr := "indexof"        OPEN BWS commonExpr BWS COMMA BWS commonExpr BWS CLOSE
"indexof"OPENBWScommonExprBWSCOMMABWScommonExprBWSCLOSE

lengthMethodCallExpr

lengthMethodCallExpr := "length"         OPEN BWS commonExpr BWS CLOSE
"length"OPENBWScommonExprBWSCLOSE

matchesPatternMethodCallExpr

matchesPatternMethodCallExpr := "matchesPattern" OPEN BWS commonExpr BWS COMMA BWS commonExpr BWS CLOSE
"matchesPattern"OPENBWScommonExprBWSCOMMABWScommonExprBWSCLOSE

startsWithMethodCallExpr

startsWithMethodCallExpr := "startswith"     OPEN BWS commonExpr BWS COMMA BWS commonExpr BWS CLOSE
"startswith"OPENBWScommonExprBWSCOMMABWScommonExprBWSCLOSE

substringMethodCallExpr

substringMethodCallExpr := "substring"      OPEN BWS commonExpr BWS COMMA BWS commonExpr BWS [ COMMA BWS commonExpr BWS ] CLOSE
"substring"OPENBWScommonExprBWSCOMMABWScommonExprBWSCOMMABWScommonExprBWSCLOSE

toLowerMethodCallExpr

toLowerMethodCallExpr := "tolower"        OPEN BWS commonExpr BWS CLOSE
"tolower"OPENBWScommonExprBWSCLOSE

toUpperMethodCallExpr

toUpperMethodCallExpr := "toupper"        OPEN BWS commonExpr BWS CLOSE
"toupper"OPENBWScommonExprBWSCLOSE

trimMethodCallExpr

trimMethodCallExpr := "trim"           OPEN BWS commonExpr BWS CLOSE
"trim"OPENBWScommonExprBWSCLOSE

yearMethodCallExpr

yearMethodCallExpr := "year"               OPEN BWS commonExpr BWS CLOSE
"year"OPENBWScommonExprBWSCLOSE

monthMethodCallExpr

monthMethodCallExpr := "month"              OPEN BWS commonExpr BWS CLOSE
"month"OPENBWScommonExprBWSCLOSE

dayMethodCallExpr

dayMethodCallExpr := "day"                OPEN BWS commonExpr BWS CLOSE
"day"OPENBWScommonExprBWSCLOSE

hourMethodCallExpr

hourMethodCallExpr := "hour"               OPEN BWS commonExpr BWS CLOSE
"hour"OPENBWScommonExprBWSCLOSE

minuteMethodCallExpr

minuteMethodCallExpr := "minute"             OPEN BWS commonExpr BWS CLOSE
"minute"OPENBWScommonExprBWSCLOSE

secondMethodCallExpr

secondMethodCallExpr := "second"             OPEN BWS commonExpr BWS CLOSE
"second"OPENBWScommonExprBWSCLOSE

fractionalsecondsMethodCallExpr

fractionalsecondsMethodCallExpr := "fractionalseconds"  OPEN BWS commonExpr BWS CLOSE
"fractionalseconds"OPENBWScommonExprBWSCLOSE

totalsecondsMethodCallExpr

totalsecondsMethodCallExpr := "totalseconds"       OPEN BWS commonExpr BWS CLOSE
"totalseconds"OPENBWScommonExprBWSCLOSE

dateMethodCallExpr

dateMethodCallExpr := "date"               OPEN BWS commonExpr BWS CLOSE
"date"OPENBWScommonExprBWSCLOSE

timeMethodCallExpr

timeMethodCallExpr := "time"               OPEN BWS commonExpr BWS CLOSE
"time"OPENBWScommonExprBWSCLOSE

totalOffsetMinutesMethodCallExpr

totalOffsetMinutesMethodCallExpr := "totaloffsetminutes" OPEN BWS commonExpr BWS CLOSE
"totaloffsetminutes"OPENBWScommonExprBWSCLOSE

minDateTimeMethodCallExpr

minDateTimeMethodCallExpr := "mindatetime" OPEN BWS CLOSE
"mindatetime"OPENBWSCLOSE

maxDateTimeMethodCallExpr

maxDateTimeMethodCallExpr := "maxdatetime" OPEN BWS CLOSE
"maxdatetime"OPENBWSCLOSE

nowMethodCallExpr

nowMethodCallExpr := "now"         OPEN BWS CLOSE
"now"OPENBWSCLOSE

roundMethodCallExpr

roundMethodCallExpr := "round"   OPEN BWS commonExpr BWS CLOSE
"round"OPENBWScommonExprBWSCLOSE

floorMethodCallExpr

floorMethodCallExpr := "floor"   OPEN BWS commonExpr BWS CLOSE
"floor"OPENBWScommonExprBWSCLOSE

ceilingMethodCallExpr

ceilingMethodCallExpr := "ceiling" OPEN BWS commonExpr BWS CLOSE
"ceiling"OPENBWScommonExprBWSCLOSE

distanceMethodCallExpr

distanceMethodCallExpr := "geo.distance"   OPEN BWS commonExpr BWS COMMA BWS commonExpr BWS CLOSE
"geo.distance"OPENBWScommonExprBWSCOMMABWScommonExprBWSCLOSE

geoLengthMethodCallExpr

geoLengthMethodCallExpr := "geo.length"     OPEN BWS commonExpr BWS CLOSE
"geo.length"OPENBWScommonExprBWSCLOSE

intersectsMethodCallExpr

intersectsMethodCallExpr := "geo.intersects" OPEN BWS commonExpr BWS COMMA BWS commonExpr BWS CLOSE
"geo.intersects"OPENBWScommonExprBWSCOMMABWScommonExprBWSCLOSE

hasSubsetMethodCallExpr

hasSubsetMethodCallExpr := "hassubset"      OPEN BWS commonExpr BWS COMMA BWS commonExpr BWS CLOSE
"hassubset"OPENBWScommonExprBWSCOMMABWScommonExprBWSCLOSE

hasSubsequenceMethodCallExpr

hasSubsequenceMethodCallExpr := "hassubsequence" OPEN BWS commonExpr BWS COMMA BWS commonExpr BWS CLOSE
"hassubsequence"OPENBWScommonExprBWSCOMMABWScommonExprBWSCLOSE

caseMethodCallExpr

caseMethodCallExpr := "case" OPEN BWS boolCommonExpr BWS COLON BWS commonExpr BWS
                        *( COMMA BWS boolCommonExpr BWS COLON BWS commonExpr BWS ) CLOSE
"case"OPENBWSboolCommonExprBWSCOLONBWScommonExprBWSCOMMABWSboolCommonExprBWSCOLONBWScommonExprBWSCLOSE

parenExpr

parenExpr := OPEN BWS commonExpr BWS CLOSE
OPENBWScommonExprBWSCLOSE

listExpr

listExpr := OPEN BWS [ primitiveLiteral BWS *( COMMA BWS primitiveLiteral BWS ) ] CLOSE
OPENBWSprimitiveLiteralBWSCOMMABWSprimitiveLiteralBWSCLOSE

andExpr

andExpr := RWS "and" RWS boolCommonExpr
RWS"and"RWSboolCommonExpr

orExpr

orExpr := RWS "or"  RWS boolCommonExpr
RWS"or"RWSboolCommonExpr

eqExpr

eqExpr := RWS "eq" RWS commonExpr
RWS"eq"RWScommonExpr

neExpr

neExpr := RWS "ne" RWS commonExpr
RWS"ne"RWScommonExpr

ltExpr

ltExpr := RWS "lt" RWS commonExpr
RWS"lt"RWScommonExpr

leExpr

leExpr := RWS "le" RWS commonExpr
RWS"le"RWScommonExpr

gtExpr

gtExpr := RWS "gt" RWS commonExpr
RWS"gt"RWScommonExpr

geExpr

geExpr := RWS "ge" RWS commonExpr
RWS"ge"RWScommonExpr

inExpr

inExpr := RWS "in" RWS ( listExpr / commonExpr )
RWS"in"RWSlistExprcommonExpr

hasExpr

hasExpr := RWS "has" RWS enumLiteral
RWS"has"RWSenumLiteral

addExpr

addExpr := RWS "add"   RWS commonExpr
RWS"add"RWScommonExpr

subExpr

subExpr := RWS "sub"   RWS commonExpr
RWS"sub"RWScommonExpr

mulExpr

mulExpr := RWS "mul"   RWS commonExpr
RWS"mul"RWScommonExpr

divExpr

divExpr := RWS "div"   RWS commonExpr
RWS"div"RWScommonExpr

divbyExpr

divbyExpr := RWS "divby" RWS commonExpr
RWS"divby"RWScommonExpr

modExpr

modExpr := RWS "mod"   RWS commonExpr
RWS"mod"RWScommonExpr

negateExpr

negateExpr := "-" BWS commonExpr
"-"BWScommonExpr

notExpr

notExpr := "not" RWS boolCommonExpr
"not"RWSboolCommonExpr

isofExpr

isofExpr := "isof" OPEN BWS [ commonExpr BWS COMMA BWS ] optionallyQualifiedTypeName BWS CLOSE
"isof"OPENBWScommonExprBWSCOMMABWSoptionallyQualifiedTypeNameBWSCLOSE

castExpr

castExpr := "cast" OPEN BWS [ commonExpr BWS COMMA BWS ] optionallyQualifiedTypeName BWS CLOSE
"cast"OPENBWScommonExprBWSCOMMABWSoptionallyQualifiedTypeNameBWSCLOSE

arrayOrObject

arrayOrObject := array
              / object
arrayobject

array

array := begin-array
        [ valueInUrl *( value-separator valueInUrl ) ]
        end-array
begin-arrayvalueInUrlvalue-separatorvalueInUrlend-array

object

object := begin-object
         [ member *( value-separator member ) ]
         end-object
begin-objectmembervalue-separatormemberend-object

member

member := stringInUrl name-separator valueInUrl
stringInUrlname-separatorvalueInUrl

valueInUrl

valueInUrl := stringInUrl
           / commonExpr
stringInUrlcommonExpr

begin-object

begin-object := BWS ( "{" / "%7B" ) BWS
BWS"{""%7B"BWS

end-object

end-object := BWS ( "}" / "%7D" )
BWS"}""%7D"

begin-array

begin-array := BWS ( "[" / "%5B" ) BWS
BWS"[""%5B"BWS

end-array

end-array := BWS ( "]" / "%5D" )
BWS"]""%5D"

quotation-mark

quotation-mark := DQUOTE / "%22"
DQUOTE"%22"

name-separator

name-separator := BWS COLON BWS
BWSCOLONBWS

value-separator

value-separator := BWS COMMA BWS
BWSCOMMABWS

stringInUrl

stringInUrl := quotation-mark *charInJSON quotation-mark
quotation-markcharInJSONquotation-mark

charInJSON

charInJSON := qchar-unescaped
             / qchar-JSON-special
             / escape ( quotation-mark
                      / escape
                      / ( "/" / "%2F" ) ; solidus         U+002F - literal form is allowed in the query part of a URL
                      / %s"b"             ; backspace       U+0008
                      / %s"f"             ; form feed       U+000C
                      / %s"n"             ; line feed       U+000A
                      / %s"r"             ; carriage return U+000D
                      / %s"t"             ; tab             U+0009
                      / %s"u" 4HEXDIG     ;                 U+XXXX
                      )
qchar-unescapedqchar-JSON-specialescapequotation-markescape"/""%2F"%s"b"%s"f"%s"n"%s"r"%s"t"%s"u"HEXDIGHEXDIGHEXDIGHEXDIG

qchar-JSON-special

qchar-JSON-special := SP / ":" / "{" / "}" / "[" / "]" ; some agents put these unencoded into the query part of a URL
SP":""{""}""[""]"

escape

escape := "\" / "%5C"     ; reverse solidus U+005C
"\""%5C"

qualifiedTypeName

qualifiedTypeName := singleQualifiedTypeName
                  / %s"Collection" OPEN singleQualifiedTypeName CLOSE
singleQualifiedTypeName%s"Collection"OPENsingleQualifiedTypeNameCLOSE

optionallyQualifiedTypeName

optionallyQualifiedTypeName := singleQualifiedTypeName
                            / %s"Collection" OPEN singleQualifiedTypeName CLOSE
                            / singleTypeName
                            / %s"Collection" OPEN singleTypeName CLOSE
singleQualifiedTypeName%s"Collection"OPENsingleQualifiedTypeNameCLOSEsingleTypeName%s"Collection"OPENsingleTypeNameCLOSE

singleQualifiedTypeName

singleQualifiedTypeName := qualifiedEntityTypeName
                        / qualifiedComplexTypeName
                        / qualifiedTypeDefinitionName
                        / qualifiedEnumTypeName
                        / primitiveTypeName
qualifiedEntityTypeNamequalifiedComplexTypeNamequalifiedTypeDefinitionNamequalifiedEnumTypeNameprimitiveTypeName

singleTypeName

singleTypeName := entityTypeName
               / complexTypeName
               / typeDefinitionName
               / enumerationTypeName
entityTypeNamecomplexTypeNametypeDefinitionNameenumerationTypeName

qualifiedEntityTypeName

qualifiedEntityTypeName := namespace "." entityTypeName
namespace"."entityTypeName

qualifiedComplexTypeName

qualifiedComplexTypeName := namespace "." complexTypeName
namespace"."complexTypeName

qualifiedTypeDefinitionName

qualifiedTypeDefinitionName := namespace "." typeDefinitionName
namespace"."typeDefinitionName

qualifiedEnumTypeName

qualifiedEnumTypeName := namespace "." enumerationTypeName
namespace"."enumerationTypeName

optionallyQualifiedEntityTypeName

optionallyQualifiedEntityTypeName := [ namespace "." ] entityTypeName
namespace"."entityTypeName

optionallyQualifiedComplexTypeName

optionallyQualifiedComplexTypeName := [ namespace "." ] complexTypeName
namespace"."complexTypeName

namespace

namespace := namespacePart *( "." namespacePart )
namespacePart"."namespacePart

namespacePart

namespacePart := odataIdentifier
odataIdentifier

entitySetName

entitySetName := odataIdentifier
odataIdentifier

singletonEntity

singletonEntity := odataIdentifier
odataIdentifier

entityTypeName

entityTypeName := odataIdentifier
odataIdentifier

complexTypeName

complexTypeName := odataIdentifier
odataIdentifier

typeDefinitionName

typeDefinitionName := odataIdentifier
odataIdentifier

enumerationTypeName

enumerationTypeName := odataIdentifier
odataIdentifier

enumerationMember

enumerationMember := odataIdentifier
odataIdentifier

termName

termName := odataIdentifier
odataIdentifier

odataIdentifier

odataIdentifier := identifierLeadingCharacter *127identifierCharacter
identifierLeadingCharacteridentifierCharacter

identifierLeadingCharacter

identifierLeadingCharacter := ALPHA / "_"         ; plus percent-encoded Unicode characters from the categories L or Nl
ALPHA"_"

identifierCharacter

identifierCharacter := ALPHA / "_" / DIGIT ; plus percent-encoded Unicode characters from the categories L, Nl, Nd, Mn, Mc, Pc, or Cf
ALPHA"_"DIGIT

primitiveTypeName

primitiveTypeName := %s"Edm." ( %s"Binary"
                           / %s"Boolean"
                           / %s"Byte"
                           / %s"Date"
                           / %s"DateTimeOffset"
                           / %s"Decimal"
                           / %s"Double"
                           / %s"Duration"
                           / %s"Guid"
                           / %s"Int16"
                           / %s"Int32"
                           / %s"Int64"
                           / %s"SByte"
                           / %s"Single"
                           / %s"Stream"
                           / %s"String"
                           / %s"TimeOfDay"
                           / abstractSpatialTypeName [ concreteSpatialTypeName ]
                           )
%s"Edm."%s"Binary"%s"Boolean"%s"Byte"%s"Date"%s"DateTimeOffset"%s"Decimal"%s"Double"%s"Duration"%s"Guid"%s"Int16"%s"Int32"%s"Int64"%s"SByte"%s"Single"%s"Stream"%s"String"%s"TimeOfDay"abstractSpatialTypeNameconcreteSpatialTypeName

abstractSpatialTypeName

abstractSpatialTypeName := %s"Geography"
                        / %s"Geometry"
%s"Geography"%s"Geometry"

concreteSpatialTypeName

concreteSpatialTypeName := %s"Collection"
                        / %s"LineString"
                        / %s"MultiLineString"
                        / %s"MultiPoint"
                        / %s"MultiPolygon"
                        / %s"Point"
                        / %s"Polygon"
%s"Collection"%s"LineString"%s"MultiLineString"%s"MultiPoint"%s"MultiPolygon"%s"Point"%s"Polygon"

primitiveProperty

primitiveProperty := primitiveKeyProperty / primitiveNonKeyProperty
primitiveKeyPropertyprimitiveNonKeyProperty

primitiveKeyProperty

primitiveKeyProperty := odataIdentifier
odataIdentifier

primitiveNonKeyProperty

primitiveNonKeyProperty := odataIdentifier
odataIdentifier

primitiveColProperty

primitiveColProperty := odataIdentifier
odataIdentifier

complexProperty

complexProperty := odataIdentifier
odataIdentifier

complexColProperty

complexColProperty := odataIdentifier
odataIdentifier

streamProperty

streamProperty := odataIdentifier
odataIdentifier

entityNavigationProperty

entityNavigationProperty := odataIdentifier
odataIdentifier

entityColNavigationProperty

entityColNavigationProperty := odataIdentifier
odataIdentifier

action

action := odataIdentifier
odataIdentifier

actionImport

actionImport := odataIdentifier
odataIdentifier

function

function := entityFunction
         / entityColFunction
         / complexFunction
         / complexColFunction
         / primitiveFunction
         / primitiveColFunction
entityFunctionentityColFunctioncomplexFunctioncomplexColFunctionprimitiveFunctionprimitiveColFunction

entityFunction

entityFunction := odataIdentifier
odataIdentifier

entityColFunction

entityColFunction := odataIdentifier
odataIdentifier

complexFunction

complexFunction := odataIdentifier
odataIdentifier

complexColFunction

complexColFunction := odataIdentifier
odataIdentifier

primitiveFunction

primitiveFunction := odataIdentifier
odataIdentifier

primitiveColFunction

primitiveColFunction := odataIdentifier
odataIdentifier

entityFunctionImport

entityFunctionImport := odataIdentifier
odataIdentifier

entityColFunctionImport

entityColFunctionImport := odataIdentifier
odataIdentifier

complexFunctionImport

complexFunctionImport := odataIdentifier
odataIdentifier

complexColFunctionImport

complexColFunctionImport := odataIdentifier
odataIdentifier

primitiveFunctionImport

primitiveFunctionImport := odataIdentifier
odataIdentifier

primitiveColFunctionImport

primitiveColFunctionImport := odataIdentifier
odataIdentifier

primitiveLiteral

primitiveLiteral := null
                 / boolean
                 / guid
                 / dateTimeOffsetLiteral
                 / date
                 / timeOfDayLiteral
                 / decimalLiteral
                 / doubleLiteral
                 / singleLiteral
                 / sbyteLiteral
                 / byte
                 / int16Literal
                 / int32Literal
                 / int64Literal
                 / stringLiteral
                 / durationLiteral
                 / enumLiteral
                 / binaryLiteral
                 / geographyCollection
                 / geographyLineString
                 / geographyMultiLineString
                 / geographyMultiPoint
                 / geographyMultiPolygon
                 / geographyPoint
                 / geographyPolygon
                 / geometryCollection
                 / geometryLineString
                 / geometryMultiLineString
                 / geometryMultiPoint
                 / geometryMultiPolygon
                 / geometryPoint
                 / geometryPolygon
nullbooleanguiddateTimeOffsetLiteraldatetimeOfDayLiteraldecimalLiteraldoubleLiteralsingleLiteralsbyteLiteralbyteint16Literalint32Literalint64LiteralstringLiteraldurationLiteralenumLiteralbinaryLiteralgeographyCollectiongeographyLineStringgeographyMultiLineStringgeographyMultiPointgeographyMultiPolygongeographyPointgeographyPolygongeometryCollectiongeometryLineStringgeometryMultiLineStringgeometryMultiPointgeometryMultiPolygongeometryPointgeometryPolygon

primitiveValue

primitiveValue := booleanValue
               / guidValue
               / durationValue
               / dateTimeOffsetValue
               / dateValue
               / timeOfDayValue
               / enumValue
               / fullCollectionLiteral
               / fullLineStringLiteral
               / fullMultiPointLiteral
               / fullMultiLineStringLiteral
               / fullMultiPolygonLiteral
               / fullPointLiteral
               / fullPolygonLiteral
               / decimalValue
               / doubleValue
               / singleValue
               / sbyteValue
               / byteValue
               / int16Value
               / int32Value
               / int64Value
               / binaryValue
booleanValueguidValuedurationValuedateTimeOffsetValuedateValuetimeOfDayValueenumValuefullCollectionLiteralfullLineStringLiteralfullMultiPointLiteralfullMultiLineStringLiteralfullMultiPolygonLiteralfullPointLiteralfullPolygonLiteraldecimalValuedoubleValuesingleValuesbyteValuebyteValueint16Valueint32Valueint64ValuebinaryValue

null

null := %s"null"
%s"null"

binaryLiteral

binaryLiteral := "binary" SQUOTE binaryValue SQUOTE
"binary"SQUOTEbinaryValueSQUOTE

binaryValue

binaryValue := *(4base64char) [ base64b16  / base64b8 ]
base64charbase64charbase64charbase64charbase64b16base64b8

base64b16

base64b16 := 2base64char ( %s"A" / %s"E" / %s"I" / %s"M" / %s"Q" / %s"U" / %s"Y" / %s"c" / %s"g" / %s"k" / %s"o" / %s"s" / %s"w" / %s"0" / %s"4" / %s"8" )   [ "=" ]
base64charbase64char%s"A"%s"E"%s"I"%s"M"%s"Q"%s"U"%s"Y"%s"c"%s"g"%s"k"%s"o"%s"s"%s"w"%s"0"%s"4"%s"8""="

base64b8

base64b8 := base64char ( %s"A" / %s"Q" / %s"g" / %s"w" ) [ "==" ]
base64char%s"A"%s"Q"%s"g"%s"w""=="

base64char

base64char := ALPHA / DIGIT / "-" / "_"
ALPHADIGIT"-""_"

boolean

boolean := "true" / "false"
"true""false"

booleanValue

booleanValue := %s"true" / %s"false"
%s"true"%s"false"

decimalLiteral

decimalLiteral := [ SIGN ]  1*DIGIT [ "." 1*DIGIT ] [ "e" [ SIGN ]  1*DIGIT ] / nanInfinity
SIGNDIGIT"."DIGIT"e"SIGNDIGITnanInfinity

decimalValue

decimalValue := ["+"/"-"] 1*DIGIT [ "." 1*DIGIT ] [ "e" ["+"/"-"] 1*DIGIT ] / nanInfinity
"+""-"DIGIT"."DIGIT"e""+""-"DIGITnanInfinity

doubleLiteral

doubleLiteral := decimalLiteral ; IEEE 754 binary64 floating-point number (15-17 decimal digits)
decimalLiteral

doubleValue

doubleValue := decimalValue   ; IEEE 754 binary64 floating-point number (15-17 decimal digits)
decimalValue

singleLiteral

singleLiteral := decimalLiteral ; IEEE 754 binary32 floating-point number (6-9 decimal digits)
decimalLiteral

singleValue

singleValue := decimalValue   ; IEEE 754 binary32 floating-point number (6-9 decimal digits)
decimalValue

nanInfinity

nanInfinity := %s"NaN" / %s"-INF" / %s"INF"
%s"NaN"%s"-INF"%s"INF"

guid

guid := 8HEXDIG "-" 4HEXDIG "-" 4HEXDIG "-" 4HEXDIG "-" 12HEXDIG
HEXDIGHEXDIGHEXDIGHEXDIGHEXDIGHEXDIGHEXDIGHEXDIG"-"HEXDIGHEXDIGHEXDIGHEXDIG"-"HEXDIGHEXDIGHEXDIGHEXDIG"-"HEXDIGHEXDIGHEXDIGHEXDIG"-"HEXDIGHEXDIGHEXDIGHEXDIGHEXDIGHEXDIGHEXDIGHEXDIGHEXDIGHEXDIGHEXDIGHEXDIG

guidValue

guidValue := guid
guid

byte

byte := 1*3DIGIT            ; numbers in the range from 0 to 255
DIGIT

byteValue

byteValue := byte
byte

sbyteLiteral

sbyteLiteral := [ SIGN ]  1*3DIGIT  ; numbers in the range from -128 to 127
SIGNDIGIT

sbyteValue

sbyteValue := ["+"/"-"] 1*3DIGIT  ; numbers in the range from -128 to 127
"+""-"DIGIT

int16Literal

int16Literal := [ SIGN ]  1*5DIGIT  ; numbers in the range from -32768 to 32767
SIGNDIGIT

int16Value

int16Value := ["+"/"-"] 1*5DIGIT  ; numbers in the range from -32768 to 32767
"+""-"DIGIT

int32Literal

int32Literal := [ SIGN ]  1*10DIGIT ; numbers in the range from -2147483648 to 2147483647
SIGNDIGIT

int32Value

int32Value := ["+"/"-"] 1*10DIGIT ; numbers in the range from -2147483648 to 2147483647
"+""-"DIGIT

int64Literal

int64Literal := [ SIGN ]  1*19DIGIT ; numbers in the range from -9223372036854775808 to 9223372036854775807
SIGNDIGIT

int64Value

int64Value := ["+"/"-"] 1*19DIGIT ; numbers in the range from -9223372036854775808 to 9223372036854775807
"+""-"DIGIT

stringLiteral

stringLiteral := SQUOTE *( SQUOTE-in-string / pchar-no-SQUOTE ) SQUOTE
SQUOTESQUOTE-in-stringpchar-no-SQUOTESQUOTE

SQUOTE-in-string

SQUOTE-in-string := SQUOTE SQUOTE ; two consecutive single quotes represent one within a string literal
SQUOTESQUOTE

date

date := year "-" month "-" day
year"-"month"-"day

dateValue

dateValue := date
date

dateTimeOffsetLiteral

dateTimeOffsetLiteral := date "T" timeOfDayLiteral ( "Z" / SIGN      hour COLON minute )
date"T"timeOfDayLiteral"Z"SIGNhourCOLONminute

dateTimeOffsetValueInUrl

dateTimeOffsetValueInUrl := dateTimeOffsetLiteral ; legacy name referenced in Temporal spec
dateTimeOffsetLiteral

dateTimeOffsetValue

dateTimeOffsetValue := date "T" timeOfDayValue   ( "Z" / ("+"/"-") hour ":"   minute )
date"T"timeOfDayValue"Z""+""-"hour":"minute

durationLiteral

durationLiteral := [ "duration" ] SQUOTE durationValue SQUOTE
"duration"SQUOTEdurationValueSQUOTE

durationValue

durationValue := [ "-" ] "P" [ 1*DIGIT "D" ] [ "T" [ 1*DIGIT "H" ] [ 1*DIGIT "M" ] [ 1*DIGIT [ "." 1*DIGIT ] "S" ] ]
"-""P"DIGIT"D""T"DIGIT"H"DIGIT"M"DIGIT"."DIGIT"S"

timeOfDayLiteral

timeOfDayLiteral := hour COLON minute [ COLON second [ "." fractionalSeconds ] ]
hourCOLONminuteCOLONsecond"."fractionalSeconds

timeOfDayValue

timeOfDayValue := hour ":"   minute [ ":"   second [ "." fractionalSeconds ] ]
hour":"minute":"second"."fractionalSeconds

oneToNine

oneToNine := "1" / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9"
"1""2""3""4""5""6""7""8""9"

zeroToFiftyNine

zeroToFiftyNine := ( "0" / "1" / "2" / "3" / "4" / "5" ) DIGIT
"0""1""2""3""4""5"DIGIT

year

year := [ "-" ] ( "0" 3DIGIT / oneToNine 3*DIGIT )
"-""0"DIGITDIGITDIGIToneToNineDIGITDIGITDIGIT

month

month := "0" oneToNine
      / "1" ( "0" / "1" / "2" )
"0"oneToNine"1""0""1""2"

day

day := "0" oneToNine
      / ( "1" / "2" ) DIGIT
      / "3" ( "0" / "1" )
"0"oneToNine"1""2"DIGIT"3""0""1"

hour

hour := ( "0" / "1" ) DIGIT
       / "2" ( "0" / "1" / "2" / "3" )
"0""1"DIGIT"2""0""1""2""3"

minute

minute := zeroToFiftyNine
zeroToFiftyNine

second

second := zeroToFiftyNine / "60" ; for leap seconds
zeroToFiftyNine"60"

fractionalSeconds

fractionalSeconds := 1*12DIGIT
DIGIT

enumLiteral

enumLiteral := [ qualifiedEnumTypeName ] SQUOTE singleEnumLiteral *( COMMA singleEnumLiteral ) SQUOTE
qualifiedEnumTypeNameSQUOTEsingleEnumLiteralCOMMAsingleEnumLiteralSQUOTE

singleEnumLiteral

singleEnumLiteral := enumerationMember / int64Literal
enumerationMemberint64Literal

enumValue

enumValue := singleEnumValue *( "," singleEnumValue )
singleEnumValue","singleEnumValue

singleEnumValue

singleEnumValue := enumerationMember / int64Value
enumerationMemberint64Value

geographyCollection

geographyCollection := geographyPrefix SQUOTE fullCollectionLiteral SQUOTE
geographyPrefixSQUOTEfullCollectionLiteralSQUOTE

fullCollectionLiteral

fullCollectionLiteral := sridLiteral collectionLiteral
sridLiteralcollectionLiteral

collectionLiteral

collectionLiteral := "GeometryCollection(" geoLiteral *( COMMA geoLiteral ) CLOSE
"GeometryCollection("geoLiteralCOMMAgeoLiteralCLOSE

geoLiteral

geoLiteral := collectionLiteral
                      / lineStringLiteral
                      / multiPointLiteral
                      / multiLineStringLiteral
                      / multiPolygonLiteral
                      / pointLiteral
                      / polygonLiteral
collectionLiterallineStringLiteralmultiPointLiteralmultiLineStringLiteralmultiPolygonLiteralpointLiteralpolygonLiteral

geographyLineString

geographyLineString := geographyPrefix SQUOTE fullLineStringLiteral SQUOTE
geographyPrefixSQUOTEfullLineStringLiteralSQUOTE

fullLineStringLiteral

fullLineStringLiteral := sridLiteral lineStringLiteral
sridLiterallineStringLiteral

lineStringLiteral

lineStringLiteral := "LineString" lineStringData
"LineString"lineStringData

lineStringData

lineStringData := OPEN positionLiteral 1*( COMMA positionLiteral ) CLOSE
OPENpositionLiteralCOMMApositionLiteralCLOSE

geographyMultiLineString

geographyMultiLineString := geographyPrefix SQUOTE fullMultiLineStringLiteral SQUOTE
geographyPrefixSQUOTEfullMultiLineStringLiteralSQUOTE

fullMultiLineStringLiteral

fullMultiLineStringLiteral := sridLiteral multiLineStringLiteral
sridLiteralmultiLineStringLiteral

multiLineStringLiteral

multiLineStringLiteral := "MultiLineString(" [ lineStringData *( COMMA lineStringData ) ] CLOSE
"MultiLineString("lineStringDataCOMMAlineStringDataCLOSE

geographyMultiPoint

geographyMultiPoint := geographyPrefix SQUOTE fullMultiPointLiteral SQUOTE
geographyPrefixSQUOTEfullMultiPointLiteralSQUOTE

fullMultiPointLiteral

fullMultiPointLiteral := sridLiteral multiPointLiteral
sridLiteralmultiPointLiteral

multiPointLiteral

multiPointLiteral := "MultiPoint(" [ pointData *( COMMA pointData ) ] CLOSE
"MultiPoint("pointDataCOMMApointDataCLOSE

geographyMultiPolygon

geographyMultiPolygon := geographyPrefix SQUOTE fullMultiPolygonLiteral SQUOTE
geographyPrefixSQUOTEfullMultiPolygonLiteralSQUOTE

fullMultiPolygonLiteral

fullMultiPolygonLiteral := sridLiteral multiPolygonLiteral
sridLiteralmultiPolygonLiteral

multiPolygonLiteral

multiPolygonLiteral := "MultiPolygon(" [ polygonData *( COMMA polygonData ) ] CLOSE
"MultiPolygon("polygonDataCOMMApolygonDataCLOSE

geographyPoint

geographyPoint := geographyPrefix SQUOTE fullPointLiteral SQUOTE
geographyPrefixSQUOTEfullPointLiteralSQUOTE

fullPointLiteral

fullPointLiteral := sridLiteral pointLiteral
sridLiteralpointLiteral

sridLiteral

sridLiteral := "SRID" EQ 1*5DIGIT SEMI
"SRID"EQDIGITSEMI

pointLiteral

pointLiteral := "Point" pointData
"Point"pointData

pointData

pointData := OPEN positionLiteral CLOSE
OPENpositionLiteralCLOSE

positionLiteral

positionLiteral := doubleValue SP doubleValue [ SP doubleValue ] [ SP doubleValue ] ; longitude, latitude, altitude/elevation (optional), linear referencing measure (optional)
doubleValueSPdoubleValueSPdoubleValueSPdoubleValue

geographyPolygon

geographyPolygon := geographyPrefix SQUOTE fullPolygonLiteral SQUOTE
geographyPrefixSQUOTEfullPolygonLiteralSQUOTE

fullPolygonLiteral

fullPolygonLiteral := sridLiteral polygonLiteral
sridLiteralpolygonLiteral

polygonLiteral

polygonLiteral := "Polygon" polygonData
"Polygon"polygonData

polygonData

polygonData := OPEN ringLiteral *( COMMA ringLiteral ) CLOSE
OPENringLiteralCOMMAringLiteralCLOSE

ringLiteral

ringLiteral := OPEN positionLiteral *( COMMA positionLiteral ) CLOSE
OPENpositionLiteralCOMMApositionLiteralCLOSE

geometryCollection

geometryCollection := geometryPrefix SQUOTE fullCollectionLiteral      SQUOTE
geometryPrefixSQUOTEfullCollectionLiteralSQUOTE

geometryLineString

geometryLineString := geometryPrefix SQUOTE fullLineStringLiteral      SQUOTE
geometryPrefixSQUOTEfullLineStringLiteralSQUOTE

geometryMultiLineString

geometryMultiLineString := geometryPrefix SQUOTE fullMultiLineStringLiteral SQUOTE
geometryPrefixSQUOTEfullMultiLineStringLiteralSQUOTE

geometryMultiPoint

geometryMultiPoint := geometryPrefix SQUOTE fullMultiPointLiteral      SQUOTE
geometryPrefixSQUOTEfullMultiPointLiteralSQUOTE

geometryMultiPolygon

geometryMultiPolygon := geometryPrefix SQUOTE fullMultiPolygonLiteral    SQUOTE
geometryPrefixSQUOTEfullMultiPolygonLiteralSQUOTE

geometryPoint

geometryPoint := geometryPrefix SQUOTE fullPointLiteral           SQUOTE
geometryPrefixSQUOTEfullPointLiteralSQUOTE

geometryPolygon

geometryPolygon := geometryPrefix SQUOTE fullPolygonLiteral         SQUOTE
geometryPrefixSQUOTEfullPolygonLiteralSQUOTE

geographyPrefix

geographyPrefix := "geography"
"geography"

geometryPrefix

geometryPrefix := "geometry"
"geometry"

asyncresult

asyncresult := "AsyncResult" ":" OWS 3DIGIT
"AsyncResult"":"OWSDIGITDIGITDIGIT

content-id

content-id := "Content-ID" ":" OWS request-id
"Content-ID"":"OWSrequest-id

isolation

isolation := [ "OData-" ] "Isolation" ":" OWS "snapshot"
"OData-""Isolation"":"OWS"snapshot"

request-id

request-id := 1*unreserved
unreserved

odata-entityid

odata-entityid := "OData-EntityID"   ":" OWS IRI-in-header
"OData-EntityID"":"OWSIRI-in-header

odata-error

odata-error := "OData-Error"      ":" OWS "{" DQUOTE %s"code" DQUOTE ":" *( VCHAR / SP )
"OData-Error"":"OWS"{"DQUOTE%s"code"DQUOTE":"VCHARSP

odata-maxversion

odata-maxversion := "OData-MaxVersion" ":" OWS 1*DIGIT "." 1*DIGIT
"OData-MaxVersion"":"OWSDIGIT"."DIGIT

odata-version

odata-version := "OData-Version"    ":" OWS "4.0" [ oneToNine ]
"OData-Version"":"OWS"4.0"oneToNine

prefer

prefer := "Prefer" ":" OWS preference *( OWS "," OWS preference )
"Prefer"":"OWSpreferenceOWS","OWSpreference

preference

preference := allowEntityReferencesPreference
           / callbackPreference
           / continueOnErrorPreference
           / includeAnnotationsPreference
           / maxpagesizePreference
           / omitValuesPreference
           / respondAsyncPreference
           / returnPreference
           / trackChangesPreference
           / waitPreference
allowEntityReferencesPreferencecallbackPreferencecontinueOnErrorPreferenceincludeAnnotationsPreferencemaxpagesizePreferenceomitValuesPreferencerespondAsyncPreferencereturnPreferencetrackChangesPreferencewaitPreference

allowEntityReferencesPreference

allowEntityReferencesPreference := [ "odata." ] "allow-entityreferences"
"odata.""allow-entityreferences"

callbackPreference

callbackPreference := [ "odata." ] "callback" OWS ";" OWS "url" EQ-h DQUOTE URI DQUOTE
"odata.""callback"OWS";"OWS"url"EQ-hDQUOTEURIDQUOTE

continueOnErrorPreference

continueOnErrorPreference := [ "odata." ] "continue-on-error" [ EQ-h boolean ]
"odata.""continue-on-error"EQ-hboolean

includeAnnotationsPreference

includeAnnotationsPreference := [ "odata." ] "include-annotations" EQ-h DQUOTE annotationsList DQUOTE
"odata.""include-annotations"EQ-hDQUOTEannotationsListDQUOTE

annotationsList

annotationsList := annotationIdentifier *("," annotationIdentifier)
annotationIdentifier","annotationIdentifier

annotationIdentifier

annotationIdentifier := [ excludeOperator ]
                       ( STAR
                       / namespace "." ( termName / STAR )
                       )
                       [ "#" odataIdentifier ]
excludeOperatorSTARnamespace"."termNameSTAR"#"odataIdentifier

excludeOperator

excludeOperator := "-"
"-"

maxpagesizePreference

maxpagesizePreference := [ "odata." ] "maxpagesize" EQ-h oneToNine *DIGIT
"odata.""maxpagesize"EQ-honeToNineDIGIT

omitValuesPreference

omitValuesPreference := "omit-values" EQ-h ( "nulls" / "defaults" )
"omit-values"EQ-h"nulls""defaults"

respondAsyncPreference

respondAsyncPreference := "respond-async"
"respond-async"

returnPreference

returnPreference := "return" EQ-h ( %s"representation" / %s"minimal" )
"return"EQ-h%s"representation"%s"minimal"

trackChangesPreference

trackChangesPreference := [ "odata." ] "track-changes"
"odata.""track-changes"

waitPreference

waitPreference := "wait" EQ-h 1*DIGIT
"wait"EQ-hDIGIT

obs-text

obs-text := %x80-FF
%x80-FF

OWS

OWS := *( SP / HTAB )  ; "optional" whitespace
SPHTAB

BWS-h

BWS-h := *( SP / HTAB )  ; "bad" whitespace in header values
SPHTAB

EQ-h

EQ-h := BWS-h EQ BWS-h
BWS-hEQBWS-h

RWS

RWS := 1*( SP / HTAB / "%20" / "%09" )  ; "required" whitespace
SPHTAB"%20""%09"

BWS

BWS := *( SP / HTAB / "%20" / "%09" )  ; "bad" whitespace
SPHTAB"%20""%09"

AT

AT := "@" / "%40"
"@""%40"

COLON

COLON := ":" / "%3A"
":""%3A"

COMMA

COMMA := "," / "%2C"
",""%2C"

EQ

EQ := "="
"="

HASH

HASH := "%23" ; the # character is not allowed in the query part
"%23"

SIGN

SIGN := "+" / "%2B" / "-"
"+""%2B""-"

SEMI

SEMI := ";" / "%3B"
";""%3B"

STAR

STAR := "*" / "%2A"
"*""%2A"

SQUOTE

SQUOTE := "'" / "%27"
"'""%27"

OPEN

OPEN := "(" / "%28"
"(""%28"

CLOSE

CLOSE := ")" / "%29"
")""%29"

URI

URI := scheme ":" hier-part [ "?" query ] [ "#" fragment ]
scheme":"hier-part"?"query"#"fragment

hier-part

hier-part := "//" authority path-abempty
              / path-absolute
              / path-rootless
"//"authoritypath-abemptypath-absolutepath-rootless

scheme

scheme := ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
ALPHAALPHADIGIT"+""-""."

authority

authority := [ userinfo "@" ] host [ ":" port ]
userinfo"@"host":"port

userinfo

userinfo := *( unreserved / pct-encoded / sub-delims / ":" )
unreservedpct-encodedsub-delims":"

host

host := IP-literal / IPv4address / reg-name
IP-literalIPv4addressreg-name

port

port := *DIGIT
DIGIT

IP-literal

IP-literal := "[" ( IPv6address / IPvFuture  ) "]"
"["IPv6addressIPvFuture"]"

IPvFuture

IPvFuture := "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
"v"HEXDIG"."unreservedsub-delims":"

IPv6address

IPv6address := 6( h16 ":" ) ls32
                 /                       "::" 5( h16 ":" ) ls32
                 / [               h16 ] "::" 4( h16 ":" ) ls32
                 / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
                 / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
                 / [ *3( h16 ":" ) h16 ] "::"    h16 ":"   ls32
                 / [ *4( h16 ":" ) h16 ] "::"              ls32
                 / [ *5( h16 ":" ) h16 ] "::"              h16
                 / [ *6( h16 ":" ) h16 ] "::"
h16":"h16":"h16":"h16":"h16":"h16":"ls32"::"h16":"h16":"h16":"h16":"h16":"ls32h16"::"h16":"h16":"h16":"h16":"ls32h16":"h16"::"h16":"h16":"h16":"ls32h16":"h16"::"h16":"h16":"ls32h16":"h16"::"h16":"ls32h16":"h16"::"ls32h16":"h16"::"h16h16":"h16"::"

h16

h16 := 1*4HEXDIG
HEXDIG

ls32

ls32 := ( h16 ":" h16 ) / IPv4address
h16":"h16IPv4address

IPv4address

IPv4address := dec-octet "." dec-octet "." dec-octet "." dec-octet
dec-octet"."dec-octet"."dec-octet"."dec-octet

dec-octet

dec-octet := "1" 2DIGIT            ; 100-199
              / "2" %x30-34 DIGIT     ; 200-249
              / "25" %x30-35          ; 250-255
              / %x31-39 DIGIT         ; 10-99
              / DIGIT                 ; 0-9
"1"DIGITDIGIT"2"%x30-34DIGIT"25"%x30-35%x31-39DIGITDIGIT

reg-name

reg-name := *( unreserved / pct-encoded / sub-delims )
unreservedpct-encodedsub-delims

path-abempty

path-abempty := *( "/" segment )
"/"segment

path-absolute

path-absolute := "/" [ segment-nz *( "/" segment ) ]
"/"segment-nz"/"segment

path-rootless

path-rootless := segment-nz *( "/" segment )
segment-nz"/"segment

segment

segment := *pchar
pchar

segment-nz

segment-nz := 1*pchar
pchar

pchar

pchar := unreserved / pct-encoded / sub-delims / ":" / "@"
unreservedpct-encodedsub-delims":""@"

query

query := *( pchar / "/" / "?" )
pchar"/""?"

fragment

fragment := *( pchar / "/" / "?" )
pchar"/""?"

pct-encoded

pct-encoded := "%" HEXDIG HEXDIG
"%"HEXDIGHEXDIG

unreserved

unreserved := ALPHA / DIGIT / "-" / "." / "_" / "~"
ALPHADIGIT"-"".""_""~"

sub-delims

sub-delims := "$" / "&" / "'" /                                     "=" / other-delims
"$""&""'""="other-delims

other-delims

other-delims := "!" /                   "(" / ")" / "*" / "+" / "," / ";"
"!""("")""*""+"","";"

pchar-no-SQUOTE

pchar-no-SQUOTE := unreserved / pct-encoded-no-SQUOTE / other-delims / "$" / "&" / "=" / ":" / "@"
unreservedpct-encoded-no-SQUOTEother-delims"$""&""="":""@"

pct-encoded-no-SQUOTE

pct-encoded-no-SQUOTE := "%" ( "0" / "1" /   "3" / "4" / "5" / "6" / "8" / "9" / A-to-F ) HEXDIG
                      / "%" "2" ( "0" / "1" / "2" / "3" / "4" / "5" / "6" /   "8" / "9" / A-to-F )
"%""0""1""3""4""5""6""8""9"A-to-FHEXDIG"%""2""0""1""2""3""4""5""6""8""9"A-to-F

qchar-no-AMP

qchar-no-AMP := unreserved / pct-encoded           / other-delims / ":" / "@" / "/" / "?" / "$" / "'" / "="
unreservedpct-encodedother-delims":""@""/""?""$""'""="

qchar-no-AMP-EQ

qchar-no-AMP-EQ := unreserved / pct-encoded           / other-delims / ":" / "@" / "/" / "?" / "$" / "'"
unreservedpct-encodedother-delims":""@""/""?""$""'"

qchar-no-AMP-EQ-AT-DOLLAR

qchar-no-AMP-EQ-AT-DOLLAR := unreserved / pct-encoded           / other-delims / ":" /       "/" / "?" /       "'"
unreservedpct-encodedother-delims":""/""?""'"

qchar-no-AMP-SQUOTE

qchar-no-AMP-SQUOTE := unreserved / pct-encoded           / other-delims / ":" / "@" / "/" / "?" / "$" /       "="
unreservedpct-encodedother-delims":""@""/""?""$""="

qchar-no-AMP-DQUOTE

qchar-no-AMP-DQUOTE := unreserved / pct-encoded-no-DQUOTE / other-delims / ":" / "@" / "/" / "?" / "$" / "'" / "="
unreservedpct-encoded-no-DQUOTEother-delims":""@""/""?""$""'""="

qchar-unescaped

qchar-unescaped := unreserved / pct-encoded-unescaped / other-delims / ":" / "@" / "/" / "?" / "$" / "'" / "="
unreservedpct-encoded-unescapedother-delims":""@""/""?""$""'""="

pct-encoded-unescaped

pct-encoded-unescaped := "%" ( "0" / "1" /   "3" / "4" /   "6" / "7" / "8" / "9" / A-to-F ) HEXDIG
                      / "%" "2" ( "0" / "1" /   "3" / "4" / "5" / "6" / "7" / "8" / "9" / A-to-F )
                      / "%" "5" ( DIGIT / "A" / "B" /   "D" / "E" / "F" )
"%""0""1""3""4""6""7""8""9"A-to-FHEXDIG"%""2""0""1""3""4""5""6""7""8""9"A-to-F"%""5"DIGIT"A""B""D""E""F"

pct-encoded-no-DQUOTE

pct-encoded-no-DQUOTE := "%" ( "0" / "1" /   "3" / "4" / "5" / "6" / "7" / "8" / "9" / A-to-F ) HEXDIG
                      / "%" "2" ( "0" / "1" /   "3" / "4" / "5" / "6" / "7" / "8" / "9" / A-to-F )
"%""0""1""3""4""5""6""7""8""9"A-to-FHEXDIG"%""2""0""1""3""4""5""6""7""8""9"A-to-F

IRI-in-header

IRI-in-header := 1*( VCHAR / obs-text )
VCHARobs-text

IRI-in-query

IRI-in-query := 1*qchar-no-AMP
qchar-no-AMP

ALPHA

ALPHA := %x41-5A / %x61-7A
%x41-5A%x61-7A

DIGIT

DIGIT := %x30-39
%x30-39

HEXDIG

HEXDIG := DIGIT / A-to-F
DIGITA-to-F

A-to-F

A-to-F := "A" / "B" / "C" / "D" / "E" / "F"
"A""B""C""D""E""F"

DQUOTE

DQUOTE := %x22
%x22

SP

SP := %x20
%x20

HTAB

HTAB := %x09
%x09

VCHAR

VCHAR := %x21-7E
%x21-7E