+(defgeneric mergemap-reader (notation)
+ (:documentation "Internal notation dispatch. The explicit CTM/XTM adapter adds :XTM."))
+(defmethod mergemap-reader ((notation t)) nil)
+(defmethod mergemap-reader ((notation (eql :ctm)))
+ (lambda (bytes resource source-key parser)
+ (deserialize-string (decode-ctm-resource bytes source-key)
+ :document-iri resource :source-name source-key
+ :resource-resolver (parser-resource-resolver parser)
+ :max-resource-depth (parser-max-resource-depth parser))))
+(defun mergemap-notation-kind (notation position)
+ (cond ((string= notation "http://psi.topicmaps.org/iso13250/ctm") :ctm)
+ ((string= notation "http://psi.topicmaps.org/iso13250/xtm") :xtm)
+ (t (problem 'ctm-rejection :unknown-mergemap-notation position
+ "The notation IRI is not supported by this processor."))))
+(defun decode-ctm-resource (bytes source-key)
+ ;; Only CTM resources use the CTM decoder, including the existing BOM policy.
+ (let ((*source-name* source-key) (*source-text* ""))
+ (decode-utf8 bytes :strip-bom t)))
+