A data domain (domain) can cross-reference another in its definition creating a relationship between two or more domains. In the following diagramexample, the student
domain makes a cross-reference to the country
domain:
...
Code Block | ||
---|---|---|
| ||
{ "modelSchema": { "properties": { "<property1>": { "type": "uri", "uriType": "xref", "xrefLocation": "<path (or UUID) of a domain or domain property>", "" ...other item1 properties.... }, "<property2>": { ... } } } } |
xrefLocation
When defining a reference, the domain
path to the reference is used. When POSTing data for the reference the data record path is used.
Some examples will help clarify:
Reference an
...
Entire Data Record
When POSTing the reference, the xrefLocation
entry in the model schema for referencing a complete data record would be:
...
Code Block |
---|
"homeCountry": "/drs/country:v1/MEX" |
Reference a Property in
...
a Data Record
When POSTing the reference, the xrefLocation
entry in the model schema for referencing a property of a data record would be:
"xrefLocation": "/domains/{domain-name}[:version][/property]"
e.g.
Code Block |
---|
"homeCountry": { "type": "uri", "uriType": "xref", "xrefLocation": "/domains/country:v1/name" } |
...
A Cross Reference Example
The following demonstrates in more detail the example where properties from an existing country
domain is to be referenced by a new domain called students
. Assume the country
domain contains many properties including the country name and the address for the immigration office. The student
domain will reference the countries
domain twice:
...