Changes between Version 10 and Version 11 of RestApi


Ignore:
Timestamp:
04.09.2011 19:01:15 (9 years ago)
Author:
jri
Comment:

Creating a complex topic type

Legend:

Unmodified
Added
Removed
Modified
  • RestApi

    v10 v11  
    366366}}} 
    367367 
     368==== Example 2: Creating a complex topic type ==== 
     369 
     370Before creating the complex topic type we create its (simple) child types: 
     371 
     372{{{ 
     373curl localhost:8080/core/topictype -X POST -H Content-Type:application/json -d ' 
     374  {uri: "spaceorg.planetarium.planet_name", 
     375   value: "Name", 
     376   data_type_uri: "dm4.core.text"}' 
     377 
     378curl localhost:8080/core/topictype -X POST -H Content-Type:application/json -d ' 
     379  {uri: "spaceorg.planetarium.mass", 
     380   value: "Mass", 
     381   data_type_uri: "dm4.core.number"}' 
     382 
     383curl localhost:8080/core/topictype -X POST -H Content-Type:application/json -d ' 
     384  {uri: "spaceorg.planetarium.distance_to_earth", 
     385   value: "Distance to Earth", 
     386   data_type_uri: "dm4.core.number"}' 
     387}}} 
     388 
     389Then we create the complex topic type: 
     390 
     391{{{ 
     392curl localhost:8080/core/topictype -i -X POST -H Content-Type:application/json -d ' 
     393  {uri: "spaceorg.planetarium.planet", 
     394   value: "Planet", 
     395   data_type_uri: "dm4.core.composite", 
     396   assoc_defs: [ 
     397     { 
     398       assoc_type_uri: "dm4.core.composition_def", 
     399       part_topic_type_uri: "spaceorg.planetarium.planet_name", 
     400       part_cardinality_uri: "dm4.core.one" 
     401     }, { 
     402       assoc_type_uri: "dm4.core.composition_def", 
     403       part_topic_type_uri: "spaceorg.planetarium.mass", 
     404       part_cardinality_uri: "dm4.core.one" 
     405     }, { 
     406       assoc_type_uri: "dm4.core.composition_def", 
     407       part_topic_type_uri: "spaceorg.planetarium.distance_to_earth", 
     408       part_cardinality_uri: "dm4.core.one" 
     409     }]}' \ 
     410| jsonpretty 
     411}}} 
     412 
     413Response: 
     414 
     415{{{ 
     416HTTP/1.1 200 OK 
     417Content-Type: application/json 
     418 
     419{ 
     420  "id": 3697, 
     421  "uri": "spaceorg.planetarium.planet", 
     422  "type_uri": "dm4.core.topic_type", 
     423  "value": "Planet", 
     424  "composite": { 
     425  }, 
     426  "data_type_uri": "dm4.core.composite", 
     427  "assoc_defs": [ 
     428    { 
     429      "id": 3702, 
     430      "uri": "spaceorg.planetarium.planet_name", 
     431      "assoc_type_uri": "dm4.core.composition_def", 
     432      "whole_topic_type_uri": "spaceorg.planetarium.planet", 
     433      "whole_role_type_uri": "dm4.core.whole", 
     434      "whole_cardinality_uri": "dm4.core.one", 
     435      "part_topic_type_uri": "spaceorg.planetarium.planet_name", 
     436      "part_role_type_uri": "dm4.core.part", 
     437      "part_cardinality_uri": "dm4.core.one", 
     438      "view_config_topics": [ 
     439 
     440      ] 
     441    }, 
     442    { 
     443      "id": 3712, 
     444      "uri": "spaceorg.planetarium.mass", 
     445      "assoc_type_uri": "dm4.core.composition_def", 
     446      "whole_topic_type_uri": "spaceorg.planetarium.planet", 
     447      "whole_role_type_uri": "dm4.core.whole", 
     448      "whole_cardinality_uri": "dm4.core.one", 
     449      "part_topic_type_uri": "spaceorg.planetarium.mass", 
     450      "part_role_type_uri": "dm4.core.part", 
     451      "part_cardinality_uri": "dm4.core.one", 
     452      "view_config_topics": [ 
     453 
     454      ] 
     455    }, 
     456    { 
     457      "id": 3722, 
     458      "uri": "spaceorg.planetarium.distance_to_earth", 
     459      "assoc_type_uri": "dm4.core.composition_def", 
     460      "whole_topic_type_uri": "spaceorg.planetarium.planet", 
     461      "whole_role_type_uri": "dm4.core.whole", 
     462      "whole_cardinality_uri": "dm4.core.one", 
     463      "part_topic_type_uri": "spaceorg.planetarium.distance_to_earth", 
     464      "part_role_type_uri": "dm4.core.part", 
     465      "part_cardinality_uri": "dm4.core.one", 
     466      "view_config_topics": [ 
     467 
     468      ] 
     469    } 
     470  ], 
     471  "index_mode_uris": [ 
     472 
     473  ], 
     474  "view_config_topics": [ 
     475 
     476  ] 
     477} 
     478}}} 
     479 
    368480== Association Types == 
    369481