Commit 104c0825 authored by MORIOKA Tomohiko's avatar MORIOKA Tomohiko
Browse files

(concord-object-spec-to-nested-form): Abolished.

(chise-json-char-get-normalized-spec): Support `=decomposition@cid',
`=decomposition@hanyo-denshi' and `=decomposition@mj'.
(chise-json-separate-normalized-spec): Support `=decomposition';
change the format of return value.
(chise-json-char-get-info): Support `=decomposition'; modify for
`chise-json-separate-normalized-spec'; use "subsumed-in" instead of
"<-subsumptive@nil" for `<-subsumptive'.
parent 70fdd284
......@@ -541,58 +541,10 @@
(cdr cell)))))))
full-nested-feature)))
(defun concord-object-spec-to-nested-form (spec-alist)
(concord-full-nested-feature-simplify
(concord-object-spec-to-full-nested-form
spec-alist)))
;; (defun chise-json-separate-features (nested-spec)
;; (let ((case-fold-search nil)
;; ccs-spec
;; subsumption-spec
;; variant-spec
;; glyph-example-spec
;; other-rel-spec
;; other-spec
;; metadata-spec
;; key)
;; (dolist (cell nested-spec)
;; (setq key (car cell))
;; (if (find-charset key)
;; (setq ccs-spec (cons cell ccs-spec))
;; (setq key (symbol-name key))
;; (cond
;; ((string-match "^=" key)
;; (setq ccs-spec (cons cell ccs-spec))
;; )
;; ((string-match "^\\(<-\\|->\\)\\(denotational\\|subsumptive\\)" key)
;; (setq subsumption-spec (cons cell subsumption-spec))
;; )
;; ((string-match "^<-HNG" key)
;; (setq subsumption-spec (cons cell subsumption-spec))
;; )
;; ((string-match "^\\(<-\\|->\\)[A-Z][A-Z]" key)
;; (setq glyph-example-spec (cons cell glyph-example-spec))
;; )
;; ((string-match "^\\(<-\\|->\\)[A-Z][a-z]" key)
;; (setq other-rel-spec (cons cell other-rel-spec))
;; )
;; ((string-match "^\\(<-\\|->\\)" key)
;; (setq variant-spec (cons cell variant-spec))
;; )
;; ((string-match "^\\*" key)
;; (setq metadata-spec (cons cell metadata-spec))
;; )
;; (t
;; (setq other-spec (cons cell other-spec))
;; ))))
;; (vector other-spec
;; ccs-spec
;; subsumption-spec
;; other-rel-spec
;; variant-spec
;; glyph-example-spec
;; metadata-spec)))
;; (defun concord-object-spec-to-nested-form (spec-alist)
;; (concord-full-nested-feature-simplify
;; (concord-object-spec-to-full-nested-form
;; spec-alist)))
(defun chise-json-encode-general-feature-pair (feature-pair)
(let ((feature-name (car feature-pair))
......@@ -937,76 +889,6 @@
(chise-json-encode-variant-feature-pair feature-pair char-id))
variant-spec)))
;; (defun concord-object-spec-to-json-ld-spec (spec-alist object)
;; (let ((obj-rep (chise-rdf-iri-encode-object object))
;; (ret (chise-json-separate-features spec-alist))
;; (genre (if (characterp object)
;; 'character
;; (concord-object-genre object)))
;; general-spec id-spec
;; granularity-spec interscript-spec
;; variant-spec glyph-example-spec
;; metadata-spec
;; dest general-dest)
;; (setq general-spec (aref ret 0)
;; id-spec (aref ret 1)
;; granularity-spec (aref ret 2)
;; interscript-spec (aref ret 3)
;; variant-spec (aref ret 4)
;; glyph-example-spec (aref ret 5)
;; metadata-spec (aref ret 6))
;; (dolist (cell metadata-spec)
;; (setq dest
;; (cons (cons (chise-json-encode-feature-name (car cell))
;; (cdr cell))
;; dest)))
;; (setq dest (nreverse dest))
;; (if glyph-example-spec
;; (setq dest
;; (cons (chise-json-encode-variant-spec glyph-example-spec
;; obj-rep 'glyph-example)
;; dest)))
;; (if variant-spec
;; (setq dest
;; (cons (chise-json-encode-variant-spec variant-spec
;; obj-rep 'variant)
;; dest)))
;; (if interscript-spec
;; (setq dest
;; (cons (chise-json-encode-variant-spec interscript-spec
;; obj-rep 'interscript)
;; dest)))
;; (if granularity-spec
;; (setq dest
;; (cons (chise-json-encode-variant-spec granularity-spec
;; obj-rep 'intergranularity)
;; dest)))
;; (if id-spec
;; (setq dest
;; (cons (chise-json-encode-id-spec id-spec genre)
;; dest)))
;; (dolist (cell general-spec)
;; (setq general-dest
;; (cons (if (eq (car cell) 'name)
;; (chise-json-encode-name-feature-pair cell)
;; (chise-json-encode-general-feature-pair cell))
;; general-dest)))
;; (dolist (cell general-dest)
;; (setq dest (cons cell dest)))
;; (list*
;; (cons '@context "http://rdf.chise.org/contexts/chise.jsonld")
;; (cons '@id obj-rep)
;; dest)))
;; (defun concord-object-get-json-ld-spec (object &optional spec)
;; (concord-object-spec-to-json-ld-spec
;; (concord-object-spec-to-nested-form
;; (or spec
;; (if (characterp object)
;; (char-attribute-alist object)
;; (concord-object-spec object))))
;; object))
(defun chise-json-api-character-decode (args)
(let (ccs cpos char format-type ret)
(when (and (setq ccs (assoc "ccs" args))
......@@ -1234,9 +1116,9 @@
<-HNG@KR
->HNG@MISC
<-HNG@MISC
=decomposition@cid
=decomposition@hanyo-denshi
=decomposition@mj
;; =decomposition@cid
;; =decomposition@hanyo-denshi
;; =decomposition@mj
abstract-glyph@iwds-1)))
nil
(if (and (memq (car cell) '(<-denotational
......@@ -1262,7 +1144,8 @@
dest))
)
((or (eq 'hanyu-dazidian (car cell))
(string-match "^ideographic-structure\\($\\|@\\)" (symbol-name (car cell))))
(string-match "^\\(ideographic-structure\\|=decomposition\\)\\($\\|@\\)"
(symbol-name (car cell))))
(setq dest
(cons (cons (car cell)
(list (cons 'body (apply #'vector (cdr cell)))))
......@@ -1295,6 +1178,7 @@
(defun chise-json-separate-normalized-spec (normalized-spec &optional subnode)
(let (CCS-spec
decomposition-spec
structure-spec
parents-spec children-spec
relation-spec
......@@ -1319,6 +1203,10 @@
(setq base-name (car cell)
domain nil))
(cond
((eq base-name '=decomposition)
(setq decomposition-spec (cons (cons domain (cdr cell))
decomposition-spec))
)
((eq base-name 'ideographic-structure)
(setq structure-spec (cons (cons domain (cdr cell))
structure-spec))
......@@ -1347,6 +1235,7 @@
)))))
(vector parents-spec
CCS-spec
decomposition-spec
structure-spec
children-spec
relation-spec
......@@ -2246,6 +2135,7 @@
hanyu-dazidian
parents-spec ; domain-parents-alist
CCS-spec
decomposition-spec decomposition-type
structure-spec
children-spec
relation-spec
......@@ -2272,10 +2162,11 @@
CCS-spec (sort (aref char-info 1)
(lambda (a b)
(char-attribute-name< (car a)(car b))))
structure-spec (aref char-info 2)
children-spec (aref char-info 3)
relation-spec (aref char-info 4)
other-spec (aref char-info 5))
decomposition-spec (aref char-info 2)
structure-spec (aref char-info 3)
children-spec (aref char-info 4)
relation-spec (aref char-info 5)
other-spec (aref char-info 6))
(setq id (chise-json-make-char-id (caar CCS-spec)
(cdr (assq 'body (cdar CCS-spec)))))
(setq ret (chise-json-other-spec-get-radical-strokes other-spec))
......@@ -2435,6 +2326,39 @@
nil)
t)))))
dest)))
(when decomposition-spec
(setq dest
(cons
(cons
'decompositions
(mapcar (lambda (cell)
(cons
(if (car cell)
(progn
(setq decomposition-type 'ivs)
(format "chise:domain/ivd/%s" (car cell)))
(progn
(setq decomposition-type 'decomposition)
'chise:domain/common))
(progn
(setq ret (mapcar #'identity
(cdr (assq 'body (cdr cell)))))
(list*
(cons decomposition-type
(chise-json-encode-ucs-string
(mapconcat #'char-to-string ret "")))
(cons 'character-sequence
(mapvector #'chise-json-char-get-ref-info
ret))
(del-alist 'body (cdr cell))))))
(sort decomposition-spec
(lambda (a b)
(if (car a)
(if (car b)
(string< (car a)(car b))
nil)
t)))))
dest)))
(dolist (cell (sort other-spec
(lambda (a b)
(chise-json-normalized-feature< b a))))
......@@ -2573,6 +2497,10 @@
'jishu)
((equal (car cell) '(<-denotational . component))
'component-category)
((equal (car cell) '(<-subsumptive))
'subsumed-in)
((null (cdar cell))
(caar cell))
(t
(format "%s@%s" (caar cell)(cdar cell))
))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment