Changeset 275 for trunk/src/json


Ignore:
Timestamp:
04/12/10 20:56:36 (15 years ago)
Author:
lgiessmann
Message:

json: started to implement a mark-as-deleted-handler that deleted from a given json-package topics, names, variants, occurrences and roles

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/json/json_tmcl.lisp ΒΆ

    r273 r275  
    99
    1010(in-package :json-tmcl)
     11
     12
     13;; =============================================================================
     14;; --- mark-as-deleted handler -------------------------------------------------
     15;; =============================================================================
     16; a test string ...
     17(defvar cl-user::*js-1*
     18  "{\"type\":\"Topic\",
     19    \"topics\":[\"http://textgrid.org/isidorus/tmcl/service\"],
     20    \"associations\":[{\"itemIdentities\":null,
     21                      \"type\":[\"http://psi.topicmaps.org/tmcl/applies-to\"],
     22                      \"scopes\":null,
     23                      \"roles\":[{\"itemIdentities\":null,
     24                                  \"type\":[\"http://psi.topicmaps.org/tmcl/constraint-role\"],
     25                                  \"topicRef\":[\"http://textgrid.org/isidorus/tmcl/exc\"]},
     26                                 {\"itemIdentities\":null,
     27                                  \"type\":[\"http://psi.topicmaps.org/tmcl/topictype-role\"],
     28                                  \"topicRef\":[\"http://textgrid.org/isidorus/tmcl/service\"]}]}],
     29    \"parent-topic\":[\"http://textgrid.org/isidorus/my-service/my-service\"],
     30    \"parent-name\":{\"itemIdentities\":null,
     31                     \"type\":[\"http://textgrid.org/isidorus/tmcl/service-name\"],
     32                     \"scopes\":null,
     33                     \"value\":\"my-service\",
     34                     \"variants\":null},
     35    \"names\":[{\"itemIdentities\":null,
     36                \"type\":[\"http://textgrid.org/isidorus/tmcl/service-name\"],
     37                \"scopes\":null,
     38                \"value\":\"my-service\",
     39                \"variants\":null}],
     40    \"variants\":[{\"itemIdentities\":null,
     41                   \"scopes\":[[\"http://textgrid.org/isidorus/tmcl/display\"]],
     42                   \"resourceData\":{\"datatype\":\"http://www.w3.org/2001/XMLSchema#string\",
     43                                     \"value\":\"http://textgrid.org/isidorus/tmcl/service\"},
     44                   \"resourceRef\":null},
     45                  {\"itemIdentities\":null,
     46                   \"scopes\":[[\"http://textgrid.org/isidorus/tmcl/is-ref\"]],
     47                   \"resourceData\":null,
     48                   \"resourceRef\":\"http://any-ref.org\"}],
     49    \"occurrences\":[{\"itemIdentities\":null,
     50                      \"type\":[\"http://textgrid.org/isidorus/tmcl/service-key\"],
     51                      \"scopes\":null,
     52                      \"resourceData\":{\"datatype\":\"http://www.w3.org/2001/XMLSchema#string\",
     53                                        \"value\":\"service-key\"}}],
     54    \"parent-association\":{\"itemIdentities\":null,
     55                            \"type\":[\"http://psi.topicmaps.org/tmcl/applies-to\"],
     56                            \"scopes\":null,
     57                            \"roles\":[{\"itemIdentities\":null,
     58                                        \"type\":[\"http://psi.topicmaps.org/tmcl/constraint-role\"],
     59                                        \"topicRef\":[\"http://textgrid.org/isidorus/tmcl/exc\"]},
     60                                       {\"itemIdentities\":null,
     61                                        \"type\":[\"http://psi.topicmaps.org/tmcl/topictype-role\"],
     62                                        \"topicRef\":[\"http://textgrid.org/isidorus/tmcl/service\"]}]},
     63    \"roles\":[{\"itemIdentities\":null,
     64                \"type\":[\"http://psi.topicmaps.org/tmcl/constraint-role\"],
     65                \"topicRef\":[\"http://textgrid.org/isidorus/tmcl/exc\"]}]}")
     66
     67
     68(defun mark-as-deleted-from-json (json-data)
     69  (declare (string json-data))
     70 
     71;{\"type\":<\"Topic\" | \"Occurrence\" | \"Name\"
     72;           \"Association\" | \"Role\" | \"Variant\" >,
     73; \"topics\": <one psi per topic of the topic that have to be deleted>,
     74; \"associations\": <a list of associations that should be deleted in the
     75;                   specified json format>,
     76; \"parent-topic\": <one psi of the parent topic the deleted
     77;                    objects are contained in or null if the
     78;                    deleted object is the topic itself>,
     79; \"parent-name\": <the owner parent of the deleted variants>,
     80; \"names\": <a list of names that have to be deleted>,
     81; \"variants\": <a list of variants that have to be deleted>,
     82; \"occurrences\": <a list of occurrences that have to be deleted>,
     83; \"parent-association\": <one association in the specified json
     84;                          format, that is the parent of the passed
     85;                          role>
     86; \"roles\": <a list of roles in the specified json format>}
     87  (let ((values (json:decode-json-from-string json-data)))
     88    values
     89    ))
     90
    1191
    1292
Note: See TracChangeset for help on using the changeset viewer.