Changes between Version 11 and Version 12 of Malted/PluginDevelopmentNotes


Ignore:
Timestamp:
24.02.2014 17:10:38 (11 years ago)
Author:
Malte
Comment:

revision of paragraph on json-composite manipulation syntax

Legend:

Unmodified
Added
Removed
Modified
  • Malted/PluginDevelopmentNotes

    v11 v12  
    1818=== Referencing existing topic instances from client-side topic-models (JavaScript / JSON Syntax) serialization syntax === 
    1919 
     20For creating a complete composite (with all new/or existing child-topics) in one Request, the topic models (JSON) array of child-topics needs to use the following semantics like this:[[BR]] 
     21(comment by jri, see updateAggregationMany() in AttachedCompositeValue. 4 cases are supported:) 
     22 
    2023{{{ 
    2124    // for deleting or referencing existing topics, child topic array (of the one specific type) needs to look like this  
     
    2427}}} 
    2528 
    26 For creating new child-topic instances with one big reuquese, the topc models child-topic array needs look like this:[[BR]] 
    27 (comment by jri, see updateAggregationMany() in AttachedCompositeValue. 3 cases are supported:) 
     29An example request making use of all 4 cases could carry a payload (HTTP Body in the POST) could look like the following one (withou the // comments): 
    2830 
    2931{{{ 
    30     // create new topic and assign it (when no prefix is found. In this case an entire topic object is expected (with ID -1 and URI "")), e.g.: 
    31     [ "del_id:40190", { "id":-1, "uri": "", "type_uri":"dm4.tags.tag", "value": "my_personal_tag"}, "ref_id:51131", "ref_id:11318"] 
     32    [ // deletes a reference to an existing topic 
     33      "del_id:40190", 
     34      // creates a new topic and references it 
     35      { "id":-1, "uri": "", "type_uri":"dm4.tags.tag", "value": "my_personal_tag"},  
     36      // references an existing topic by id 
     37      "ref_id:51131", 
     38      // references an existing topic by uri 
     39      "ref_uri: "my.cool.instance.data_uri"] 
    3240}}} 
    3341 
    34 As soon one knows this syntax, this frees one from the error-prone solution of creating topics in a 1st step, e.g. via AJAX-calls, and reference them in a 2nd step (and all that on client-side) 
     42As soon one knows this syntax, it frees the developer from the error-prone solutions of creating topics in multiple-steps, e.g. creating them independently (e.g. in JavaScript) in a 1st step and then reference them in a 2nd step. 
    3543 
    3644== Working on DeepaMehta's server-side, resp. on your model ==