Introduction
      This schema defines the DICOM constraint document.
      
      A DICOM constraint document defines rules 
      to check the conformance of a DICOM content with respect to 
      the DICOM standard and other organization-wide guidelines.  
      This XML schema document defines the XML schema constraining 
      constraint documents.
      
      A constraint document defines one or more constraint rules.  
      A constraint rule is the unit of invocation for conformance checking.
      At run time, a user may invoke a PL/SQL
      or Java function to check the conformance of a DICOM content
      with respect to a particular rule. Each invocable rule
      is defined as a GLOBAL_RULE, which can reference other global 
      rules internally.  
      A constraint rule can be decomposed into individual predicates.  
      A predicate can be a logical statement, a relational statement 
      comparing values, a function call evaluation that returns a
      Boolean type, or a reference to other predicate definitions.   
      Predicate definitions are recursive. A predicate can be a logical
      statement, which includes the logical OR of two other predicates. 
      Each predicate can be a relational predicate. For example:
      (patientName=="Joe Smith"  AND patientSex=="M")
      After being translated into a predicate, the preceding example becomes:     
      
        An example to find an object that has
              (patientName="Joe Smith" AND patientSex=="M")
         
        
          
            
              00100010
              
                
                  
                    Smith
                    Joe
                  
                
              
            
          
          
            
              00100040
              
                M
              
            
          
        
      
 
      Constraint macros can be used to simplify the definition of 
      complex constraint rules. Constraint macros follow the same predicate 
      definition grammar as constraint rules. The operands in 
      constraint macros can be variables rather than fixed values, as they are 
      in constraint rules. The variables in a macro are substituted when the 
      macro is invoked. For example, you can define a macro to compare
      patient names ( patientName == $NAME ). When this macro is invoked,
      the parameter NAME is assigned the value "Joe Smith" and the macro is
      transformed into the predicate:( patientName == "Joe Smith").
      As another example, you can define a macro to check if a DICOM attribute
      is a code sequence attribute. A code sequence attribute must contain the
      mandatory child attributes, code value and code scheme. This macro
      checks whether the specified code sequence attribute contains these
      mandatory child attributes. 
      
        
          A subset of Code Sequence Macro defined in DICOM standard, 
          PS3.3-2007, Table 8.8-1
        
        
          CodeAttr
        
        
          Code value must not be empty
          
            ${CodeAttr}.00080100
            
          
        
        
          Code scheme designator must not be empty
          
          
            ${CodeAttr}.00080102
            
          
        
        
      
       
      You can separate a constraint definition into multiple files.  
      Each file defines one or more constraint rules or macros.  
      A file can import the macros and constraint rules that are 
      defined in a difference file. You must specify the set of 
      external rules or macros before referencing them in a file.
      EXTERNAL_RULE_INCLUDE and EXTERNAL_MACRO_INCLUDE
      statements serve this purpose.
      
     Structure Overview
      Question mark "?" means optional items.
      Plus "+" means one or more items.
      Asterisk "*" means zero or more items.
      
    CONFORMANCE_CONSTRAINT_DEFINITION
      DOCUMENT_HEADER?
        DOCUMENT_CHANGE_LOG+
          DOCUMENT_MODIFIER
          DOCUMENT_MODIFICATION_DATE
          DOCUMENT_VERSION?
          MODIFICATION_COMMENT?
          BASE_DOCUMENT?
          BASE_DOCUMENT_RELEASE_DATE?
          BASE_DOCUMENT_DESCRIPTION?
    EXTERNAL_MACRO_INCLUDE*
    EXTERNAL_RULE_INCLUDE*
    (GLOBAL_MACRO|GLOBAL_RULE)+
    
    GLOBAL_RULE (name) | PREDICATE_DEFINITION (name)
      DESCRIPTION?
      PREDICATE_DEFINITION*
      PREDICATE+
      ACTION (when, action)*
        
    GLOBAL_MACRO (name)
      DESCRIPTION?
      PARAMETER_DECLARATION+
      PREDICATE_DEFINITION*
      PREDICATE+
      ACTION (when, action)*
      
    PREDICATE
      DESCRIPTION?
      (LOGICAL|RELATIONAL|BOOLEAN_FUNC|INVOKE_MACRO|PREDICATE_REF|GLOBAL_RULE_REF)
      ACTION (when, action)*
      
    LOGICAL(operator)
      PREDICATE+
    RELATIONAL(operator)
      (ATTRIBUTE_TAG|FUNCTION)(ATTRIBUTE_TAG|STRING_VALUE|XML_VALUE|FUNCTION)+
    BOOLEAN_FUNC(operator)
      (ATTRIBUTE_TAG|STRING_VALUE|XML_VALUE|FUNCTION)*
    INVOKE_MACRO
      MACRO_NAME
      PARAMETER+
        NAME
        VALUE
    FUNCTION(operator)
      (ATTRIBUTE_TAG|STRING_VALUE|XML_VALUE|FUNCTION)*
    
  
  
    
      A constraint document defines groups of predicates to validate the conformance of a DICOM content or a DICOM metadata document.
    
    
      
        
        
          
            
              
                
              
            
          
        
        
          
            
              
                
              
            
          
        
        
          
            
              
              
            
            
              
              
            
          
          
            
              
              
            
            
              
              
            
          
        
      
    
    
    
      
      
    
    
      
      
    
    
      
      
    
    
      
      
    
  
  
    
      A predicate group is the logical AND 
      of a collection of predicates or predicate groups. 
      Each predicate group has a name that is unique within 
      its parent. Any other predicates can reference
      this predicate group by its name. The value of the reference 
      is the Boolean of the predicate group.
      Optionally, a predicate group can contain a set of 
      predicate definitions. These definitions are not part of the
      logical AND component of the predicate group, but they
      are meant to be referenced within the predicate group.
      A predicate group has an optional action element that
      specifies what action to take when the predicate evaluates to true
      or false.
      
    
    
      
      
      
        
      
      
    
    
  
  
    
      
      
    
    
      
      
      
      
        
      
      
    
    
  
  
    
      
        A type to specify an action for a predicate value.
        The "when" attribute specifies the predicate value.
        The "action" attribute specifies the type of action.
        When the action type is "log", "warning", or "error",
        the string value of this attribute is returned
        in a log file or as part of warning or error message.
      
    
    
      
        
        
      
    
  
  
    
      
      
      
      
    
  
  
    
      
      
        
        
        
        
        
        
      
      
    
  
  
    
      
      
        
          
            
            
          
        
      
    
  
  
    
      
      
    
    
      
        
          
            
              A derive B   ( (NOT A)  OR B )
            
          
          
          
          
          
          
        
      
    
  
  
    
      
        
        
      
      
        
        
        
        
      
    
    
      
        
          
            
            gt     greater than
            ge     greater than or equal to
            lt     less than
            le     less than or equal to
            eq     equal to
            ne     not equal to
            in     value in the set of
            match  attribute value matches pattern
              The second operand must be a Java regular expression 
              pattern as specified by JDK1.5 java.lang.String class 
              documentation. Within the second operand, strings in 
              the form "${...}" are interpreted as regular expressions rather
              than macro parameters. The first operand must be a DICOM 
              attribute tag. The tag must identify an attribute
              that belongs to one of the following value representation 
              types:
                 AE, AS, AT, CS, DA, DT, LO, LT, PN,
                 SH, ST, TM, UI and UT
            Note that the operands must be compatible with each other 
            when a predicate invokes relational operator. For example, 
            (patientAge > 005M) is a valid predicate. But 
            (patientAge > "Joe Smith") is not a valid predicate, because 
            the operand "Joe Smith" cannot be cast into an instance 
            of the patient age attribute.
            
          
          
          
          
          
          
          
          
          
        
      
    
  
  
    
      
      
      
      
    
    
      
        
          To allow future extensions, the set of allowed operators for Boolean 
          function types are not fixed. Operator names are case-sensitive.
          The current values for this operator 
          are: "notEmpty", "occurs", "true", and "false". 
          "occurs" takes a single operand ATTRIBUTE_TAG, 
          and returns true if an attribute matching the tag exists. (The 
          attribute value can be an empty string or null. For example, 
          a DICOM type 2 attribute may be empty.); Otherwise, it returns
          false.
          "notEmpty" takes a single operand ATTRIBUTE_TAG. 
          It returns true if an attribute matching the tag exists in 
          a DICOM content and has a non-null value (e.g. a DICOM type 1 
          attribute); otherwise, it returns false.
          "true" takes no operand and it always returns true.
          "false" takes no operand and it always returns false.
        
      
      
        
          
        
      
    
  
  
    
      
      
      
      
    
    
      
        
          To allow future extensions, the set of allowed operators for 
          function types are not fixed. Operator names are case-sensitive.
          This feature is not supported for Oracle Database 11g Release 1.