A data domain (domain) can cross-reference another in its definition creating a relationship between two or more domains. In the following diagram, the student
domain makes a cross-reference to the country
domain:
When a student
MDR is POSTed, the request body would include a reference to a specific country
master data record:
...
When POSTing the reference, the xrefLocation
entry in the model schema for referencing a complete MDR would be:
"xrefLocation": "/referencedomains/{domain-name}[:versionv<version>]"
e.g.
Code Block |
---|
"homeCountry": { "type": "uri", "uriType": "xref", "xrefLocation": "/domaindomains/country:1v1" } |
When POSTing the data for the reference use the displayName
of the desired MDR e.g.:
...
When POSTing the reference, the xrefLocation
entry in the model schema for referencing a property of a MDR would be:
"xrefLocation": "/referencedomains/{domain-name}[:version][/property]"
e.g.
Code Block |
---|
"homeCountry": { "type": "uri", "uriType": "xref", "xrefLocation": "/domaindomains/country:1v1/name" } |
An 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:
...
Code Block |
---|
{ "name": "students", "modelSchema": { "properties": { "homeCountry": { "type": "uri", "uriType": "xref", "xrefLocation": "/mdrdomains/country:v1/name" }, "immigrationAddress": { "type": "uri", "uriType": "xref", "xrefLocation": "/mdrdomains/country:v1/immigrationAddress" }, . . . } } } |
...
Code Block | ||
---|---|---|
| ||
"name": { "type": "string" }, "country": { "type": "uri", "uriType": "xref" } |
2. POST the domain for country
with a model schema that includes a reference to state
including the xrefLocation
:
Code Block | ||
---|---|---|
| ||
"name": { "type": "string" }, "state": { "type": "uri", "uriType":"xref" } |
3. PUT PATCH the domain for state
with a model schema that includes the reference to country
:
...
Data can be posted only if all uri's of type xref
have valid xrefLocation
`s.
NOTE: PUTing PATCHing a domain:version is denied if any data is POSTed to the domain:version
.
Using UUIDs
The underlying store in YOUnite uses UUIDs to access data elements. UUIDs can be used instead of domain paths. See Using UUIDs Instead of Domain or MDR Pathnames for moreit.