Changes between Version 13 and Version 14 of RestApi


Ignore:
Timestamp:
18.10.2011 04:23:19 (9 years ago)
Author:
jri
Comment:

Create an association type

Legend:

Unmodified
Added
Removed
Modified
  • RestApi

    v13 v14  
    572572For details about the association type format see DataFormat#AssociationType. 
    573573 
     574=== Create an association type === 
     575 
     576{{{ 
     577POST /core/assoctype 
     578 
     579<the association type to create> 
     580}}} 
     581 
     582For details about the association type format see DataFormat#AssociationType. 
     583 
     584For a create operation not all of the association type's properties are involved: 
     585 
     586||= Property =||= Mandatory / Optional =|| 
     587|| `uri` || Optional. Default URI is `domain.project.assoc_type_<ID>`. You can change the URI later on through an update operation. However, the URI is typically specified at creation time. || 
     588|| `value` || Optional. Default association type name is an empty string. You can change the name later on through an update operation. However, the name is typically specified at creation time. || 
     589|| `data_type_uri` || Mandatory. || 
     590|| `index_mode_uris` || Optional. Default is no indexing. || 
     591|| `assoc_defs` || For complex association types: Optional. Default is no child types. You can add child types later on through an update operation. However, the child types are typically specified at creation time.\\\\For simple association types: Do //not// specify child types. || 
     592|| `view_config_topics` || Optional. Default is no view models. || 
     593 
     594When creating a complex association type: For details about the association definition format see DataFormat#AssociationDefinition. 
     595 
     596For a create operation not all of the association definition's properties are involved: 
     597 
     598||= Property =||= Mandatory / Optional =|| 
     599|| `assoc_type_uri` || Mandatory. || 
     600|| `whole_cardinality_uri` || For a "composition": Do //not// specify the parent cardinality ("one" is assumed).\\\\For an "aggregation": Mandatory. || 
     601|| `part_topic_type_uri` || Mandatory. || 
     602|| `part_cardinality_uri` || Mandatory. || 
     603|| `view_config_topics` || Optional. Default is no view models. || 
     604 
     605==== Example 1: Creating a simple association type ==== 
     606 
     607{{{ 
     608curl localhost:8080/core/assoctype -i \ 
     609-X POST \ 
     610-H Content-Type:application/json \ 
     611-d '{uri: "spaceorg.planetarium.discoverer", 
     612     value: "Discoverer", 
     613     data_type_uri: "dm4.core.text"}' \ 
     614| jsonpretty 
     615}}} 
     616 
     617Response: 
     618 
     619{{{ 
     620HTTP/1.1 200 OK 
     621Content-Type: application/json 
     622 
     623{ 
     624  "id": 2784, 
     625  "uri": "spaceorg.planetarium.discoverer", 
     626  "type_uri": "dm4.core.assoc_type", 
     627  "value": "Discoverer", 
     628  "composite": { 
     629  }, 
     630  "data_type_uri": "dm4.core.text", 
     631  "index_mode_uris": [ 
     632  ], 
     633  "assoc_defs": [ 
     634  ], 
     635  "label_config": [ 
     636  ], 
     637  "view_config_topics": [ 
     638  ] 
     639} 
     640}}} 
     641 
    574642== Commands == 
    575643