Changes between Version 39 and Version 40 of S3/S3Model/ComponentResources
- Timestamp:
- 02/04/14 13:16:11 (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
S3/S3Model/ComponentResources
v39 v40 2 2 [[TOC]] 3 3 4 Component resources are an S3 framework concept to simplify the implementation of and access to aggregation models, which is the most common type of data models used in Sahana-Eden.4 '''Component Resources''' (more commonly referred to as simply "components") are an S3 framework concept to simplify the access to sub-entities related to a master entity. 5 5 6 Typically, such an aggregation model has a master entity and a number of associated (sub-)entities ("have"-relationships):6 Typically, a master entity has a number of associated sub-entities ("have"-relationships), e.g.: 7 7 8 8 - organisations = have => offices, projects, teams … … 10 10 - groups = have => members, tasks 11 11 12 Each of these relationships can be represented as a join between the respective tables.12 These sub-entities are called ''components'' of the master entity. 13 13 14 The "Component Resource" extension provides the functionality to pre-configure and re-use these joins as pseudo-attributes ("components") of the master entity, thereby replacing the joins by simple identifiers (aliases) which can be used to construct queries, e.g. in URLs: 14 A component relationship constitutes a join between the master entity and the sub-entity. The S3 framework provides functionality to pre-define such joins and then use them as pseudo-attributes of the master entity. 15 16 In URLs, component relationships can be utilized to construct implicit queries (also called "projections"): 15 17 16 18 {{{ 17 # Join "office": org_organisation <-- id/organisation_id --> org_office 19 # Offices of organisation 5 20 # "office" is a component of "org/organisation" 21 # Join: org_organisation <-- id/organisation_id --> org_office 18 22 19 23 /org/organisation/5/office 20 24 }}} 21 25 22 or 26 ...likewise in URL filter queries: 23 27 24 28 {{{ 25 # Join "contact": pr_person <-- pe_id/pe_id --> pr_contact 29 # Persons with the email address user@example.com 30 # "contact" is a component of "pr/person" 31 # Join: pr_person <-- pe_id/pe_id --> pr_contact 26 32 27 33 /pr/person?contact.contact_method=EMAIL&contact.value=user@example.com 28 34 }}} 29 35 30 The "Component Resource" extension is one of the fundamental RAD concepts of the S3 framework. 31 32 Besides simplified construction of queries and views, it also facilitates keyless (=implicit) constraints e.g. in CRUD forms and XML imports: 36 Besides simplified construction of queries and views, it also facilitates implicit (=keyless) constraints e.g. in CRUD forms and XML imports: 33 37 34 38 {{{#!xml