From: MORIOKA Tomohiko Date: Fri, 6 May 2016 00:18:24 +0000 (+0900) Subject: (char-db-json-insert-char-features): Add "@type" based on glyph X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=66202020ecf4e51869b4e5695598b98b01bf6ab5;p=chise%2Fest.git (char-db-json-insert-char-features): Add "@type" based on glyph granularity. --- diff --git a/char-db-json.el b/char-db-json.el index a8b897e..d8044d1 100644 --- a/char-db-json.el +++ b/char-db-json.el @@ -396,6 +396,7 @@ (unless column (setq column (current-column))) (let ((est-view-url-prefix "http://chise.org/est/view") + id obj-id type name value ; has-long-ccs-name rest radical strokes @@ -428,9 +429,31 @@ (format "{ \"@context\": \"%s/genre/character/context.json\"" est-view-url-prefix)) (setq line-separator (format ",%s" line-breaking)) - (insert (format "%s \"@id\": \"%s\"" - line-separator - (www-uri-make-object-url char))) + (setq id (www-uri-make-object-url char)) + (insert (format "%s \"@id\": \"%s\"" line-separator id)) + (setq obj-id (file-name-nondirectory id)) + (setq type + (cond + ((string-match "^a2\\." obj-id) + "chise:super-abstract-character") + ((string-match "^a\\." obj-id) + "chise:abstract-character") + ((string-match "^o\\." obj-id) + "chise:unified-glyph") + ((string-match "^rep\\." obj-id) + "chise:abstract-glyph") + ((string-match "^g\\." obj-id) + "chise:detailed-glyph") + ((string-match "^g2\\." obj-id) + "chise:abstract-glyph-form") + ((string-match "^gi\\." obj-id) + "chise:abstract-glyph-form") + ((string-match "^repi\\." obj-id) + "chise:glyph-image") + (t + "chise:character") + )) + (insert (format "%s \"@type\": \"%s\"" line-separator type)) (when (memq '<-subsumptive attributes) (when (or readable (not for-sub-node)) (when (setq value (get-char-attribute char '<-subsumptive))