Page History
The following ABNF definition specifies the Long Syntax the SNOMED CT Expression Constraint Language. Please note that all keywords are case insensitive.
This ABNF syntax and the ANTLR syntax is maintained in the SNOMED Expression Constraint Language GitHub repository.
expressionConstraint = ws ( refinedExpressionConstraint / compoundExpressionConstraint / dottedExpressionConstraint / subExpressionConstraint ) ws refinedExpressionConstraint = subExpressionConstraint ws ":" ws eclRefinement compoundExpressionConstraint = conjunctionExpressionConstraint / disjunctionExpressionConstraint / exclusionExpressionConstraint conjunctionExpressionConstraint = subExpressionConstraint 1*(ws conjunction ws subExpressionConstraint) disjunctionExpressionConstraint = subExpressionConstraint 1*(ws disjunction ws subExpressionConstraint) exclusionExpressionConstraint = subExpressionConstraint ws exclusion ws subExpressionConstraint dottedExpressionConstraint = subExpressionConstraint 1*(ws dottedExpressionAttribute) dottedExpressionAttribute = dot ws eclAttributeName subExpressionConstraint= [constraintOperator ws] ( ( [memberOf ws] (eclFocusConcept / "(" ws expressionConstraint ws ")") *(ws memberFilterConstraint)) / (eclFocusConcept / "(" ws expressionConstraint ws ")") ) *(ws (descriptionFilterConstraint / conceptFilterConstraint)) [ws historySupplement] eclFocusConcept = eclConceptReference / wildCard / altIdentifier dot = "." memberOf = ( "^" /
expressionConstraint = ws ( refinedExpressionConstraint / compoundExpressionConstraint / dottedExpressionConstraint / subExpressionConstraint ) ws
refinedExpressionConstraint = subExpressionConstraint ws ":" ws eclRefinement
compoundExpressionConstraint = conjunctionExpressionConstraint / disjunctionExpressionConstraint / exclusionExpressionConstraint
conjunctionExpressionConstraint = subExpressionConstraint 1*(ws conjunction ws subExpressionConstraint)
disjunctionExpressionConstraint = subExpressionConstraint 1*(ws disjunction ws subExpressionConstraint)
exclusionExpressionConstraint = subExpressionConstraint ws exclusion ws subExpressionConstraint
dottedExpressionConstraint = subExpressionConstraint 1*(ws dottedExpressionAttribute)
dottedExpressionAttribute = dot ws eclAttributeName
subExpressionConstraint= [constraintOperator ws] ( ( [memberOf ws] (eclFocusConcept / "(" ws expressionConstraint ws ")") *(ws memberFilterConstraint)) / (eclFocusConcept / "(" ws expressionConstraint ws ")") ) *(ws (descriptionFilterConstraint / conceptFilterConstraint)) [ws historySupplement]
eclFocusConcept = eclConceptReference / wildCard
dot = "."
memberOf = ( "^" /("m"/"M") ("e"/"E") ("m"/"M") ("b"/"B") ("e"/"E") ("r"/"R") ("o"/"O") ("f"/"F") )[wsws "[" ws (refsetFieldNameSet / wildCard) ws "]" ]refsetFieldNameSet = refsetFieldName *( ws "," ws refsetFieldName )refsetFieldName= 1*alphaeclConceptReference= conceptId [ws "|" ws term ws "|"]eclConceptReferenceSeteclConceptReferenceSet = "(" ws eclConceptReference 1*(mws eclConceptReference) ws ")"conceptId= sctIdterm= 1*nonwsNonPipe *( 1*SP1*nonwsNonPipe )wildCard = "*" / (1*nonwsNonPipe ) altIdentifier = (QM altIdentifierSchemeAlias "#" altIdentifierCodeWithinQuotes QM / altIdentifierSchemeAlias "#" altIdentifierCodeWithoutQuotes) [ws "|" ws term ws "|"] altIdentifierSchemeAlias = alpha *(dash / alpha / integerValue) altIdentifierCodeWithinQuotes = 1*anyNonEscapedChar altIdentifierCodeWithoutQuotes = 1*(alpha / digit / dash / "." / "_") wildCard = "*" / ( ("a"/"A") ("n"/"N") ("y"/"Y") ) constraintOperator = childOf / childOrSelfOf / descendantOrSelfOf / descendantOf / parentOf / parentOrSelfOf / ancestorOrSelfOf / ancestorOf / top / bottom descendantOf = "<" / ( ("d"/"D") ("e"/"E") ("s"/"S") ("c"/"C") ("e"/"E") ("n"/"N") ("d"/"D") ("a"/"A") ("n"/"N") ("yt"/"YT"))constraintOperator = childOf / childOrSelfOf / descendantOrSelfOf / descendantOf / parentOf / parentOrSelfOf / ancestorOrSelfOf / ancestorOf
descendantOf = "<" / (("o"/"O") ("f"/"F") mws ) descendantOrSelfOf = "<<" / ( ("d"/"D") ("e"/"E") ("s"/"S") ("c"/"C") ("e"/"E") ("n"/"N") ("d"/"D") ("a"/"A") ("n"/"N") ("t"/"T") ("o"/"O") ("fr"/"FR")mws )descendantOrSelfOf = "<<" / ( ("d("s"/"S") ("e"/"DE") ("el"/"EL") ("sf"/"SF") ("co"/"CO") ("ef"/"EF") mws ) childOf = "<!" / (("nc"/"NC") ("dh"/"DH") ("ai"/"AI") ("nl"/"NL") ("td"/"TD") ("o"/"O") ("rf"/"RF") mws ) childOrSelfOf = "<<!" / (("sc"/"SC") ("eh"/"EH") ("li"/"LI") ("fl"/"FL") ("od"/"OD") ("fo"/"FO")mws )childOf = "<!" / (("c("r"/"CR") ("hs"/"HS") ("ie"/"IE") ("l"/"L") ("df"/"DF") ("o"/"O") ("f"/"F") mws)childOrSelfOf = "<<!" / () ancestorOf = ">" / ( ("a"/"A") ("n"/"N") ("c"/"C") ("e"/"E") ("hs"/"HS") ("it"/"IT") ("lo"/"LO") ("dr"/"DR")("o"/"O") ("rf"/"RF") mws ) ancestorOrSelfOf = ">>" / ( ("sa"/"SA") ("en"/"EN") ("lc"/"LC") ("fe"/"FE") ("os"/"OS") ("ft"/"FT")mws )
ancestorOf = ">" / (("ao"/"AO") ("nr"/"NR") ("co"/"CO") ("er"/"ER") ("s"/"S") ("te"/"TE") ("ol"/"OL") ("rf"/"RF") ("o"/"O") ("f"/"F") mws)ancestorOrSelfOf = ">>" /) parentOf = ">!" / (("ap"/"AP") ("na"/"NA") ("cr"/"CR") ("e"/"E") ("sn"/"SN") ("t"/"T") ("o"/"O") ("r"/"
RT") ("o"/"O") ("rf"/"RF") mws ) parentOrSelfOf = ">>!" / (("sp"/"SP") ("ea"/"EA") ("lr"/"LR") ("fe"/"FE") ("on"/"ON") ("ft"/"FT")mws )parentOf = ">!" / (("p("o"/"PO") ("ar"/"AR") ("rs"/"RS") ("e"/"E") ("nl"/"NL") ("tf"/"TF") ("o"/"O") ("f"/"F") mws)parentOrSelfOf = ">>!" /) top = "!!>" / (("pt"/"PT") ("ao"/"AO") ("rp"/"R") ("e"/"E") ("n"/"N") ("t"/"T") ("o"/"O") ("r"/"R") ("s"/"S") ("e"/"E") ("l"/"L") ("f"/"F")P") mws ) bottom = "!!<" / (("b"/"B") ("o"/"O") ("t"/"T") ("t"/"T") ("o"/"O") ("fm"/"FM") mws )conjunction= (("a"/"A") ("n"/"N") ("d"/"D") mws) / ","disjunction= ("o"/"O") ("r"/"R") mwsexclusion= ("m"/"M") ("i"/"I") ("n"/"N") ("u"/"U") ("s"/"S") mwseclRefinement= subRefinement ws [conjunctionRefinementSet / disjunctionRefinementSet]conjunctionRefinementSet= 1*(ws conjunction ws subRefinement)disjunctionRefinementSet= 1*(ws disjunction ws subRefinement)subRefinement= eclAttributeSet / eclAttributeGroup / "(" ws eclRefinement ws ")"eclAttributeSet= subAttributeSet ws [conjunctionAttributeSet / disjunctionAttributeSet]conjunctionAttributeSet= 1*(ws conjunction ws subAttributeSet)disjunctionAttributeSet= 1*(ws disjunction ws subAttributeSet)subAttributeSet= eclAttribute / "(" ws eclAttributeSet ws ")"eclAttributeGroup= ["[" cardinality "]" ws] "{" ws eclAttributeSet ws "}"eclAttribute= ["[" cardinality "]" ws] [reverseFlag ws] eclAttributeName ws (expressionComparisonOperator ws subExpressionConstraint / numericComparisonOperator ws "#" numericValue / stringComparisonOperatorwsws (typedSearchTerm / typedSearchTermSet) / booleanComparisonOperator ws booleanValue)cardinality= minValue to maxValueminValue= nonNegativeIntegerValueto= ".." / (mws ("t"/"T") ("o"/"O") mws)maxValue= nonNegativeIntegerValue / manymany= "*" / ( ("m"/"M") ("a"/"A") ("n"/"N") ("y"/"Y"))reverseFlag= ( ("r"/"R") ("e"/"E") ("v"/"V") ("e"/"E") ("r"/"R") ("s"/"S") ("e"/"E") ("o"/"O") ("f"/"F")) / "R"eclAttributeName= subExpressionConstraintexpressionComparisonOperator= "=" / "!=" / ("n"/"N") ("o"/"O") ("t"/"T") ws "=" / "<>"numericComparisonOperator= "=" / "!=" / ("n"/"N") ("o"/"O") ("t"/"T") ws "=" / "<>" / "<=" / "<" / ">=" / ">"timeComparisonOperatortimeComparisonOperator = "=" / "!=" / ("n"/"N") ("o"/"O") ("t"/"T") ws "=" / "<>" / "<=" / "<" / ">=" / ">"stringComparisonOperator= "=" / "!=" / ("n"/"N") ("o"/"O") ("t"/"T") ws "=" / "<>"booleanComparisonOperator="=" / "!=" / ("n"/"N") ("o"/"O") ("t"/"T") ws "=" / "<>"idComparisonOperator = "=" / "!=" / ("n"/"N") ("o"/"O") ("t"/"T") ws "=" / "<>"filterConstraint = descriptionFilterConstraint / conceptFilterConstraint / memberFilterConstraint / historySupplement
descriptionFilterConstraint =descriptionFilterConstraint = "{{" ws [ "d" / "D"] ws descriptionFilter] ws descriptionFilter *(ws "," ws descriptionFilter) ws "}}"descriptionFilterdescriptionFilter = termFilter / languageFilter / typeFilter / dialectFilter / moduleFilter / effectiveTimeFilter /activeFilteractiveFilter / descriptionIdFilterdescriptionIdFilter = descriptionIdKeyword ws idComparisonOperator ws (descriptionId / descriptionIdSet)descriptionIdKeyworddescriptionIdKeyword = ("i"/"I") ("d"/"D")descriptionId = sctIddescriptionIdSet = "(" ws descriptionId *(mws descriptionId) ws ")"termFiltertermFilter = termKeyword ws stringComparisonOperator ws (typedSearchTerm /typedSearchTermSettypedSearchTermSet)termKeyword= ("t"/"T") ("e"/"E") ("r"/"R") ("m"/"M")typedSearchTerm= ([ matchKeyword ws ":" ws ] matchSearchTermSet ) / ( wild ws ":" ws wildSearchTermSet )typedSearchTermSet= "("ws typedSearchTermws typedSearchTerm *(mws typedSearchTermmws typedSearchTerm) ws ")"wildwild = ("w"/"W") ("i"/"I") ("l"/"L") ("d"/"D")matchKeyword= ("m"/"M") ("a"/"A") ("t"/"T") ("c"/"C") ("h"/"H")matchSearchTerm=1*(nonwsNonEscapedChar / escapedChar)matchSearchTermSet=QMQM ws matchSearchTerm *(mws matchSearchTerm) ws QMwildSearchTerm= 1*(anyNonEscapedChar / escapedWildChar)wildSearchTermSet= QM wildSearchTerm QMlanguageFilterlanguageFilter = language ws booleanComparisonOperator ws (languageCode / languageCodeSet)languagelanguage = ("l"/"L") ("a"/"A") ("n"/"N") ("g"/"G") ("u"/"U") ("a"/"A") ("g"/"G") ("e"/"E")languageCode= 2alphalanguageCodeSet= "(" ws languageCode *(mws languageCode) ws ")"typeFilter= typeIdFilter / typeTokenFiltertypeIdFilter= typeId ws booleanComparisonOperator ws (subExpressionConstraint / eclConceptReferenceSet)typeId= ("t"/"T") ("y"/"Y") ("p"/"P") ("e"/"E") ("i"/"I") ("d"/"D")typeTokenFilter= type ws booleanComparisonOperator ws (typeToken / typeTokenSet)type=("t"/"T") ("y"/"Y") ("p"/"P") ("e"/"E")typeToken= synonym / fullySpecifiedName / definitiontypeTokenSet= "(" ws typeToken *(mws typeToken) ws ")"synonym= ("s"/"S") ("y"/"Y") ("n"/"N")[("o"/"O")("n"/"N")("y"/"Y")("m"/"M")]fullySpecifiedName= ( ("f"/"F") ("s"/"S") ("n"/"N") ) / (("f"/"F")("u"/"U")("l"/"L")("l"/"L")("y"/"Y")("s"/"S")("p"/"P")("e"/"E")("c"/"C")("i"/"I")("f"/"F")("i"/"I")("e"/"E")("d"/"D")("n"/"N")("a"/"A")("m"/"M")("e"/"E"))definition= ("d"/"D") ("e"/"E") ("f"/"F")[("i"/"I")("n"/"N")("i"/"I")("t"/"T")("i"/"I")("o"/"O")("n"/"N")]dialectFilter =] dialectFilter = (dialectIdFilter / dialectAliasFilter)[ ws acceptabilitySet ]dialectIdFilter= dialectId ws booleanComparisonOperator ws (subExpressionConstraint / dialectIdSet)dialectId= ("d"/"D") ("i"/"I") ("a"/"A") ("l"/"L") ("e"/"E") ("c"/"C") ("t"/"T") ("i"/"I") ("d"/"D")dialectAliasFilter= dialect ws booleanComparisonOperator ws (dialectAlias / dialectAliasSet)dialect=("d"/"D") ("i"/"I") ("a"/"A") ("l"/"L") ("e"/"E") ("c"/"C") ("t"/"T")dialectAlias= alpha *( dash / alpha / integerValue)dialectAliasSet= "(" wsdialectAliasdialectAlias [ws acceptabilitySet] *(mws dialectAlias [ws acceptabilitySet]) ws ")"dialectIdSet="(" wseclConceptReferenceeclConceptReference [ws acceptabilitySet]*(mwseclConceptReferenceeclConceptReference [ws acceptabilitySet]) ws ")"acceptabilitySet= acceptabilityConceptReferenceSet / acceptabilityTokenSetacceptabilityConceptReferenceSet = "(" ws eclConceptReference *(mws eclConceptReference) ws ")"acceptabilityTokenSet= "(" ws acceptabilityToken *(mws acceptabilityToken) ws ")"acceptabilityToken= acceptable / preferredacceptable=("a"/"A") ("c"/"C") ("c"/"C") ("e"/"E") ("p"/"P") ("t"/"T")[("a"/"A")("b"/"B")("l"/"L")("e"/"E")]preferred= ("p"/"P") ("r"/"R") ("e"/"E") ("f"/"F") ("e"/"E") ("r"/"R")[("r"/"R")("e"/"E")("d"/"D")]conceptFilterConstraint= "{{" ws ("c" / "C") wsconceptFilterconceptFilter *(ws "," ws conceptFilter) ws "}}"conceptFilterconceptFilter = definitionStatusFilter / moduleFilter / effectiveTimeFilter / activeFilterdefinitionStatusFilterdefinitionStatusFilter = definitionStatusIdFilter / definitionStatusTokenFilterdefinitionStatusIdFilter=definitionStatusIdKeyworddefinitionStatusIdKeyword ws booleanComparisonOperatorwsws (subExpressionConstraint /eclConceptReferenceSeteclConceptReferenceSet)definitionStatusIdKeyword= ("d"/"D") ("e"/"E") ("f"/"F") ("i"/"I")("n"/"N")("i"/"I")("t"/"T")("i"/"I")("o"/"O")("n"/"N")("s"/"S")("t"/"T")("a"/"A")("t"/"T")("u"/"U")("s"/"S")("i"/"I")("d"/"D")definitionStatusTokenFilter=definitionStatusKeyworddefinitionStatusKeyword ws booleanComparisonOperator ws (definitionStatusToken /definitionStatusTokenSetdefinitionStatusTokenSet)definitionStatusKeyword= ("d"/"D") ("e"/"E") ("f"/"F") ("i"/"I")("n"/"N")("i"/"I")("t"/"T")("i"/"I")("o"/"O")("n"/"N")("s"/"S")("t"/"T")("a"/"A")("t"/"T")("u"/"U")("s"/"S")definitionStatusToken= primitiveToken / definedTokendefinitionStatusTokenSet= "("ws definitionStatusTokenws definitionStatusToken *(mws definitionStatusToken) ws ")"primitiveToken=("p"/"P")("r"/"R")("i"/"I")("m"/"M")("i"/"I")("t"/"T")("i"/"I")("v"/"V")("e"/"E")definedToken=("d"/"D")("e"/"E")("f"/"F")("i"/"I")("n"/"N")("e"/"E")("d"/"D")moduleFilter=moduleIdKeywordmoduleIdKeyword ws booleanComparisonOperatorwsws (subExpressionConstraint /eclConceptReferenceSeteclConceptReferenceSet)moduleIdKeyword=("m"/"M")("o"/"O")("d"/"D")("u"/"U")("l"/"L")("e"/"E")("i"/"I")("d"/"D")effectiveTimeFilter = effectiveTimeKeyword ws timeComparisonOperator ws ( timeValue / timeValueSet )effectiveTimeKeyword =("e"/"E")("f"/"F")("f"/"F")("e"/"E")("c"/"C")("t"/"T")("i"/"I")("v"/"V")("e"/"E")("t"/"T")("i"/"I")("m"/"M")("e"/"E")timeValue =QMQM [ year monthdayday ] QMtimeValueSet = "(" ws timeValue *(mws timeValue) ws ")"year= digitNonZero digit digit digitdigitmonth="01" / "02" / "03" / "04" / "05" / "06" / "07" / "08" / "09" / "10" / "11" / "12"day="01" / "02" / "03" / "04" / "05" / "06" / "07" / "08" / "09" / "10" / "11" / "12" / "13" / "14" / "15" / "16" / "17" / "18" / "19" / "20" / "21" / "22" / "23" / "24" / "25" / "26" / "27" / "28" / "29" / "30" / "31"activeFilter= activeKeyword ws booleanComparisonOperator ws activeValueactiveKeyword=("a"/"A")("c"/"C")("t"/"T")("i"/"I")("v"/"V")("e"/"E")activeValue= activeTrueValue / activeFalseValueactiveTrueValue= "1" / "true"activeFalseValue= "0" / "false"memberFilterConstraint = "{{" ws ("m" / "M") wsmemberFiltermemberFilter *(ws "," ws memberFilter) ws "}}"memberFiltermemberFilter = moduleFilter / effectiveTimeFilter / activeFilter /memberFieldFiltermemberFieldFilter memberFieldFilter = refsetFieldNamewsws (expressionComparisonOperator ws subExpressionConstraint / numericComparisonOperator ws "#" numericValue / stringComparisonOperatorwsws (typedSearchTerm / typedSearchTermSet) / booleanComparisonOperator ws booleanValue / ws timeComparisonOperator ws (timeValue / timeValueSet) )historySupplement = "{{" ws "+" ws historyKeyword [historyProfileSuffixhistoryProfileSuffix / ws historySubset ] ws "}}"historyKeyword =("h"/"H") ("i"/"I") ("s"/"S") ("t"/"T")("o"/"O")("r"/"R")("y"/"Y")historyProfileSuffix = historyMinimumSuffix / historyModerateSuffix / historyMaximumSuffixhistoryMinimumSuffix =("-"/"_") ("m"/"M") ("i"/"I") ("n"/"N")historyModerateSuffix = ("-"/"_") ("m"/"M") ("o"/"O") ("d"/"D")historyMaximumSuffix =("-"/"_") ("m"/"M") ("a"/"A") ("x"/"X")historySubset = "(" ws expressionConstraint ws ")"numericValue= ["-"/"+"] (decimalValue / integerValue)stringValue= 1*(anyNonEscapedChar / escapedChar)integerValue=digitNonZerodigitNonZero *digit / zerodecimalValue= integerValue "." 1*digitbooleanValue= true / falsetrue= ("t"/"T") ("r"/"R") ("u"/"U") ("e"/"E")false= ("f"/"F") ("a"/"A") ("l"/"L") ("s"/"S") ("e"/"E")nonNegativeIntegerValue= (digitNonZero *digit ) / zerosctId= digitNonZero 5*17( digit )ws= *( SP / HTAB / CR / LF / comment ) ; optional white spacemws= 1*( SP / HTAB / CR / LF / comment ) ; mandatory white spacecomment= "/*" *(nonStarChar / starWithNonFSlash) "*/"nonStarChar= SP / HTAB / CR / LF / %x21-29 / %x2B-7E /UTF8-2 / UTF8-3 / UTF8-4starWithNonFSlash= %x2A nonFSlashnonFSlash= SP / HTAB / CR / LF / %x21-2E / %x30-7E /UTF8-2 / UTF8-3 / UTF8-4SP= %x20 ; spaceHTAB= %x09 ; tabCR= %x0D ; carriage returnLF= %x0A ; line feedQM= %x22 ; quotation markBS= %x5C ; back slashstar=%x2A%x2A ; asteriskdigit= %x30-39zero= %x30digitNonZero= %x31-39nonwsNonPipe= %x21-7B / %x7D-7E / UTF8-2 / UTF8-3 / UTF8-4anyNonEscapedChar= SP / HTAB / CR / LF / %x20-21 / %x23-5B / %x5D-7E / UTF8-2 / UTF8-3 / UTF8-4escapedChar= BS QM / BS BSescapedWildChar= BS QM / BS BS / BS starnonwsNonEscapedChar=%x21%x21 / %x23-5B / %x5D-7E / UTF8-2 / UTF8-3 / UTF8-4alpha= %x41-5A / %x61-7Adash= %x2DUTF8-2= %xC2-DF UTF8-tailUTF8-3= %xE0 %xA0-BF UTF8-tail / %xE1-EC 2( UTF8-tail ) / %xED %x80-9F UTF8-tail / %xEE-EF 2( UTF8-tail )UTF8-4= %xF0 %x90-BF 2( UTF8-tail ) / %xF1-F3 3( UTF8-tail ) / %xF4 %x80-8F 2( UTF8-tail )UTF8-tail= %x80-BF