cspace-config Relationships
What is a Relationships
are used to configure the different relations needed by the UI and services e.g. affects, has broader, has narrower, is dependant upon
Where are Relationships
Relationships are part of the spec element of the cspace-config
Structure of Relationships
<relationships> <relation id="broaderContext"> <displayName>has broader term</displayName> <predicate>hasBroader</predicate> <subject>n</subject> <object>1</object> <showsiblings>equivalentContexts:equivalentContext</showsiblings> <directional>false</directional> <sourceTypes>location,locationauthorities,personauthorities,person,organization,taxon,taxonomyauthorities</sourceTypes> <destinationTypes>location,locationauthorities,personauthorities,person,organization,taxon,taxonomyauthorities</destinationTypes> </relation> <relation id="narrowerContexts"> <inverseOf>broaderContext</inverseOf> <displayName>has narrower term</displayName> <predicate>hasNarrower</predicate> <subject>1</subject> <object>n</object> <childname>narrowerContext</childname> <directional>false</directional> <sourceTypes>location,locationauthorities,personauthorities,person,organization,taxon,taxonomyauthorities</sourceTypes> <destinationTypes>location,locationauthorities,personauthorities,person,organization,taxon,taxonomyauthorities</destinationTypes> </relation> <relation id="broader"> <displayName>has broader term</displayName> <directional>true</directional> <sourceTypes>collectionobjects,intakes,acquisitions,loansin,loansout</sourceTypes> <destinationTypes>collectionobjects,intakes,acquisitions,loansin,loansout</destinationTypes> </relation> <relation id="affects"> <displayName>affects</displayName> <directional>false</directional> <sourceTypes>all</sourceTypes> <destinationTypes>all</destinationTypes> </relation> </relationships>
relation
attribute
id
- string
- no default required
- should be unique within relationships as it is the key which you search against etc
elements
displayName
- string
- default
- name of the relationship, can be used to return to the UI
predicate
- string
- default
- name of the relationship in the service layer
subject
- string
- default
- expects n or 1 to help define hierarchical relationships
object
- string
- default
- expects n or 1 to help define hierarchical relationships
inverseOf
- string
- default
- if this is a hierarchical relationship which is modeled in the service layer as a single directional relationship then this is how you specify that it is the inverse of the relationship specified by the id here
showsiblings
- string
- default
- if set and this is a hierarchical relationship then the UI requires a list of the sibling relationships. The value of this tag is {repeatId}:{fieldId} that the data whats to be shown in - relates to the uispec
childname
- string
- default
- for 1:n hierarchical relationships where multiple results will be returned for this context. Childname specifies the name of the field id in the uispec
directional
- boolean true|false 1|0 yes|no
- default true
- sets up the relationship as a two-way(false) or a hierachical one-way(true)
sourceTypes
- set of strings (currently uses service urls of the records)
- default {""}
- allows restriction of the types of record that can be used with this relationship. If 'all' is specified then there are no restrictions
- sourceTypes should the service names of the recordTypes e.g. if service-url is defined use that else use id
- when directional = false sourceTypes should equal destinationTypes
destinationTypes
- set of strings
- default {""}
- allows restriction of the types of record that can be used with this relationship. If 'all' is specified then there are no restrictions
- sourceTypes should the service names of the recordTypes e.g. if service-url is defined use that else use id