SNOMED Documentation Search
The following ABNF definition specifies the SNOMED CT template syntax. This syntax incorporates the Expression Constraint Language version 1.3 (ECL v1.3), with some adaptations to support slot references.
Please note that some of the rules referenced below are defined elsewhere. In particular, definitionStatus is defined in SNOMED CT compositional grammar. This rule definition must therefore be combined with the syntax below before it can be used.
; Template Syntax v1.1
templateSlot = templateReplacementSlot / templateInformationSlot
templateReplacementSlot = conceptReplacementSlot / expressionReplacementSlot / tokenReplacementSlot / concreteValueReplacementSlot
conceptReplacementSlot = "[[" ws ws "+" ws conceptReplacement [slotName ws] "]]"
expressionReplacementSlot = "[[" ws "+" ws expressionReplacement [slotName ws] "]]"
tokenReplacementSlot = "[[" ws "+" ws tokenReplacement "id" ws [ "(" ws expressionConstraint ws ")" ws] [slotName ws] "]]"expressionReplacementSlot
concreteValueReplacementSlot = "[[" ws ws "+" ws concreteValueReplacement [slotName ws] "]]"
conceptReplacement = "id"scg" ws ] [ "(" ws expressionConstraint slotExpressionConstraint ws ")" ws] [slotName
expressionReplacement = ["scg" ws] ["]]"(" ws slotExpressionConstraint ws ")" ws]
tokenReplacement = tokenReplacementSlot = "[[" ws "+" ws "tok" ws [ "(" ws slotTokenSet ws ")" ws] [slotName ws] "]]"
concreteValueReplacementSlot = stringReplacementSlot / integerReplacementSlot / decimalReplacementSlot
concreteValueReplacement = stringReplacement / integerReplacement / decimalReplacement / booleanReplacement
stringReplacement = " stringReplacementSlot = "[[" ws "+" ws "str" ws [ "(" ws slotStringSet ws ")" ws] [slotName ws] "]]"
integerReplacementSlot integerReplacement = "[[" ws "+" ws "int" ws [ "(" ws slotIntegerSet ws ")" ws] [slotName ws] "]]" decimalReplacementSlot = "[[" ws "+" ws "
decimalReplacement = "dec" ws [ "(" ws slotDecimalSet ws ")" ws] [slotName ws] "]]"
booleanReplacement = "bool" ws [ "(" ws slotBooleanSet ws ")" ws]
slotTokenSet = slotToken *(mws slotToken)
slotStringSet = slotString *(mws slotString)
slotIntegerSet = ( "#" integerValue slotIntegerValue / slotIntegerRange) *(mws ("#" integerValue slotIntegerValue / slotIntegerRange))
slotDecimalSet = ( "#" decimalValue slotDecimalValue / slotDecimalRange) *(mws ("#" decimalValue slotDecimalValue / slotDecimalRange))
slotBooleanSet = slotBooleanValue *(mws slotBooleanValue)
slotIntegerRange = ( slotIntegerMinimum to [ slotIntegerMaximum ] ) / ( to slotIntegerMaximum )
slotIntegerMinimum = [ exclusiveMinimum ] "#" integerValueslotIntegerValue
slotIntegerMaximum = [ exclusiveMaximum ] slotIntegerValue
slotIntegerValue = "#" digitNonZero *digit / "#" integerValuezero
slotDecimalRange = ( slotDecimalMinimum to [ slotDecimalMaximum ] ) / ( to slotDecimalMaximum )
slotDecimalMinimum = [ exclusiveMinimum ] "#" DecimalValueslotDecimalValue
slotDecimalMaximum = [ exclusiveMaximum ] slotDecimalValue
slotDecimalValue = "#" DecimalValue" integerValue "." 1*digit
exclusiveMinimum = ">"
exclusiveMaximum = "<"
slotBooleanValue = true / false
true = ("t"/"T") ("r"/"R") ("u"/"U") ("e"/"E")
false = ("f"/"F") ("a"/"A") ("l"/"L") ("s"/"S") ("e"/"E")
slotName = "@" (nonQuoteStringValue / slotString)
slotToken = definitionStatus / memberOf / constraintOperator / conjunction / disjunction / exclusion / reverseFlag / expressionComparisonOperator / numericComparisonOperator / stringComparisonOperatorstringComparisonOperator / booleanComparisonOperator
slotString = QM stringValue slotStringValue QM
nonQuoteStringValue = *(%x21 / %x23-26 / %x28%x2A-3F / %x41-5A / %x5C / %x5E-7E) ; string with no ws, quotes, at, square brackets or square round brackets
templateInformationSlot = "[[" ws slotInformation ws "]]"
slotInformation = [cardinality ws] [slotName ws]
...
; Expression Constraint Language v1.4
slotExpressionConstraint = ws ( slotRefinedExpressionConstraint / slotCompoundExpressionConstraint / slotDottedExpressionConstraint / slotSubExpressionConstraint ) ws
slotRefinedExpressionConstraint = slotSubExpressionConstraint ws ":" ws slotEclRefinement
slotCompoundExpressionConstraint = slotConjunctionExpressionConstraint / slotDisjunctionExpressionConstraint / slotExclusionExpressionConstraint
slotConjunctionExpressionConstraint = slotSubExpressionConstraint 1*(ws conjunction ws slotSubExpressionConstraint)
slotDisjunctionExpressionConstraint = slotSubExpressionConstraint 1*(ws disjunction ws slotSubExpressionConstraint)
slotExclusionExpressionConstraint = slotSubExpressionConstraint ws exclusion ws slotSubExpressionConstraint
slotDottedExpressionConstraint = slotSubExpressionConstraint 1*(ws slotDottedExpressionAttribute)
slotDottedExpressionAttribute = dot ws slotEclAttributeName
slotSubExpressionConstraint = [constraintOperator ws] [memberOf ws] (slotEclFocusConcept / "(" ws slotExpressionConstraint ws ")")
slotEclFocusConcept = slotEclConceptReference / wildCard
dot = "."
memberOf = "^"
slotEclConceptReference = conceptId [ws "|" ws term ws "|"]
conceptId = sctId
term = 1*nonwsNonPipe *( 1*SP 1*nonwsNonPipe )
wildcard = "*"
constraintOperator = childOf / descendantOrSelfOf / descendantOf / parentOf / ancestorOrSelfOf / ancestorOf
descendantOf = "<"
descendantOrSelfOf = "<<"
childOf = "<!"
ancestorOf = ">"
ancestorOrSelfOf = ">>"
parentOf = ">!"
conjunction = (("a"/"A") ("n"/"N") ("d"/"D") mws) / ","
disjunction = ("o"/"O") ("r"/"R") mws
exclusion = ("m"/"M") ("i"/"I") ("n"/"N") ("u"/"U") ("s"/"S") mws
slotEclRefinement = slotSubRefinement ws [slotConjunctionRefinementSet / slotDisjunctionRefinementSet]
slotConjunctionRefinementSet = 1*(ws conjunction ws slotSubRefinement)
slotDisjunctionRefinementSet = 1*(ws disjunction ws slotSubRefinement)
slotSubRefinement = slotEclAttributeSet / slotEclAttributeGroup / "(" ws slotEclRefinement ws ")"
slotEclAttributeSet = slotSubAttributeSet ws [slotConjunctionAttributeSet / slotDisjunctionAttributeSet]
slotConjunctionAttributeSet = 1*(ws conjunction ws slotSubAttributeSet)
slotDisjunctionAttributeSet = 1*(ws disjunction ws slotSubAttributeSet)
slotSubAttributeSet = slotEclAttribute / "(" ws slotEclAttributeSet ws ")"
slotEclAttributeGroup = ["[" cardinality "]" ws] "{" ws slotEclAttributeSet ws "}"
slotEclAttribute = ["[" cardinality "]" ws] [reverseFlag ws] slotEclAttributeName ws (expressionComparisonOperator ws slotSubExpressionConstraint / numericComparisonOperator ws slotNumericValue / stringComparisonOperator ws slotStringValue / booleanComparisonOperator ws booleanValue)
cardinality = minValue to maxValue
minValue = nonNegativeIntegerValue
to = ".."
maxValue = nonNegativeIntegerValue / many
many = "*"
reverseFlag = "R"
slotEclAttributeName = slotSubExpressionConstraint
expressionComparisonOperator = "=" / "!="
numericComparisonOperator = "=" / "!=" / "<=" / "<" / ">=" / ">"
stringComparisonOperator = "=" / "!="
booleanComparisonOperator = "=" / "!="
slotNumericValue = "#" ["-"/"+"] (slotDecimalValue / slotIntegerValue)
slotStringValue = QM 1*(anyNonEscapedChar / escapedChar) QM
integerValue = digitNonZero *digit / zero
decimalValue = integerValue "." 1*digit
booleanValue = true / false
; true = ("t"/"T") ("r"/"R") ("u"/"U") ("e"/"E")
; false = ("f"/"F") ("a"/"A") ("l"/"L") ("s"/"S") ("e"/"E")
nonNegativeIntegerValue = (digitNonZero *digit ) / zero
sctId = digitNonZero 5*17( digit )
ws = *( SP / HTAB / CR / LF / comment ) ; optional white space
mws = 1*( SP / HTAB / CR / LF / comment ) ; mandatory white space
comment = "/*" *(nonStarChar / starWithNonFSlash) "*/"
nonStarChar = SP / HTAB / CR / LF / %x21-29 / %x2B-7E /UTF8-2 / UTF8-3 / UTF8-4
starWithNonFSlash = %x2A nonFSlash
nonFSlash = SP / HTAB / CR / LF / %x21-2E / %x30-7E /UTF8-2 / UTF8-3 / UTF8-4
SP = %x20 ; space
HTAB = %x09 ; tab
CR = %x0D ; carriage return
LF = %x0A ; line feed
QM = %x22 ; quotation mark
BS = %x5C ; back slash
digit = %x30-39
zero = %x30
digitNonZero = %x31-39
nonwsNonPipe = %x21-7B / %x7D-7E / UTF8-2 / UTF8-3 / UTF8-4
anyNonEscapedChar = SP / HTAB / CR / LF / %x20-21 / %x23-5B / %x5D-7E / UTF8-2 / UTF8-3 / UTF8-4
escapedChar = BS QM / BS BS
UTF8-2 = %xC2-DF UTF8-tail
UTF8-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
; Additional rules from Compositional Grammar
definitionStatus = equivalentTo / subtypeOf
equivalentTo = "==="
subtypeOf = "<<<"