From: MORIOKA Tomohiko Date: Mon, 26 Aug 2013 07:31:48 +0000 (+0900) Subject: (est-rdf-encode-feature-name): Map domain to xmlns-prefix; refer X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=691ade1d730fc96b9beab2d0a929290f2edc7759;p=chise%2Fest.git (est-rdf-encode-feature-name): Map domain to xmlns-prefix; refer feature `rdf-namespace-prefix' and `rdf-namespace-uri'; return '( ) instead of '( . ). (est-rdf-display-object-desc): Modify for `est-rdf-encode-feature-name'. --- diff --git a/est-rdf-view.el b/est-rdf-view.el index eaafab7..62e21c7 100644 --- a/est-rdf-view.el +++ b/est-rdf-view.el @@ -8,7 +8,8 @@ (defun est-rdf-encode-feature-name (feature-name) (let ((str (symbol-name feature-name)) base domain - ret is-not-top) + ret is-not-top + xmlns-prefix xmlns-uri) (if (string-match "@" str) (setq base (substring str 0 (match-beginning 0)) domain (substring str (match-end 0))) @@ -24,14 +25,22 @@ (t (char-to-string c))) (setq is-not-top t))) base "")) - ;; (if (eq (aref ret 0) ?.) - ;; (setq ret (concat "meta" ret))) - (cons (if domain - (concat "est." - (mapconcat #'identity - (split-string domain "/") - ".")) - "est") + (if domain + (setq xmlns-prefix + (or xmlns-prefix + (concat "est." + (mapconcat #'identity + (split-string domain "/") + ".")))) + (setq xmlns-prefix (or (char-feature-property + feature-name 'rdf-namespace-prefix) + 'est) + xmlns-uri (char-feature-property + feature-name 'rdf-namespace-uri))) + (list xmlns-prefix + (or xmlns-uri + (format "http://www.chise.org/est/rdf.cgi?domain=%s/" + xmlns-prefix)) (www-uri-encode-feature-name (intern ret))))) (defun est-rdf-format-object (obj) @@ -77,7 +86,7 @@ logical-feature-name object-spec logical-object-spec rdf-feature-name rdf-feature-name-space - rdf-feature-name-base rdf-feature-name-domain + rdf-feature-name-base rdf-feature-name-domain rdf-feature-name-uri feature-type rdf-container value ret metadata-feature-target metadata-feature-type @@ -120,12 +129,15 @@ (setq value (www-get-feature-value object logical-feature)) (setq ret (est-rdf-encode-feature-name logical-feature)) (setq rdf-feature-name-domain (car ret) - rdf-feature-name-base (cdr ret)) - (setq rdf-feature-name (format "%s:%s" (car ret)(cdr ret))) + rdf-feature-name-uri (nth 1 ret) + rdf-feature-name-base (nth 2 ret)) + (setq rdf-feature-name (format "%s:%s" + rdf-feature-name-domain + rdf-feature-name-base)) (setq rdf-feature-name-space - (format "xmlns:%s=\"http://www.chise.org/est/rdf.cgi?domain=%s/\"" - (car ret) - (car ret))) + (format "xmlns:%s=\"%s\"" + rdf-feature-name-domain + rdf-feature-name-uri)) (setq feature-type (www-feature-type logical-feature)) (if (and (consp value) (cdr value)) @@ -145,23 +157,28 @@ (setq metadata-feature-target (intern (substring logical-feature-name 0 (1+ (match-beginning 0))))) + ;; (setq metadata-feature-type + ;; (intern (substring logical-feature-name + ;; (1+ (match-beginning 0))))) (setq metadata-feature-type (intern (substring logical-feature-name - (1+ (match-beginning 0))))) + (+ (match-beginning 0) 2)))) (setq ret (est-rdf-encode-feature-name metadata-feature-target)) (princ (format "\n" - (car ret)(cdr ret))) + (car ret)(nth 2 ret))) (setq ret (est-rdf-encode-feature-name metadata-feature-type)) (setq rdf-feature-name-domain (car ret) - rdf-feature-name-base (cdr ret)) - (setq rdf-feature-name (format "%s:%s" (car ret)(cdr ret))) + rdf-feature-name-uri (nth 1 ret) + rdf-feature-name-base (nth 2 ret)) + (setq rdf-feature-name (format "%s:%s" + rdf-feature-name-domain + rdf-feature-name-base)) (setq rdf-feature-name-space - (format - "xmlns:%s=\"http://www.chise.org/est/rdf.cgi?domain=%s/\"" - (car ret) - (car ret))) + (format "xmlns:%s=\"%s\"" + rdf-feature-name-domain + rdf-feature-name-uri)) ) (t (setq metadata-feature-type nil)