Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

    "homeCountry": "/mdrs/country:v1/MEX/name",

Defining a Cross-Reference in the modelSchema

To reference another domain, include the cross-reference property definitions "type": "uri",   "uriType": "xref"  and "xrefLocation". The xrefLocation is the  MDR path to another  MDR or a property of the another MDR.  

Code Block
languagejs
{
	"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 MDR path is used. Some examples will help clarify:

Reference an Entire Master Data Record

When POSTing the reference, the xrefLocation entry in the model schema for referencing a complete MDR would be:

...

Code Block
"homeCountry": "/mdrs/country:v1/MEX"

Reference a Property in a Master Data Record

When POSTing the reference, the xrefLocation entry in the model schema for referencing a property of a MDR would be:

    "xrefLocation": "/domains/{domain-name}[:version][/property]"
e.g.
Code Block
"homeCountry": {
	"type": "uri",
	"uriType": "xref",
	"xrefLocation": "/domains/country:v1/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:

  1. In a property called homeCountry 
  2. A property called immigrationAddress

GET the address Property in the countries Model Schema

GET /domains/versions/<country-version-uuid>/properties
Code Block
languagejs
[
	{
			.
			.
		"propertyName": "immigrationAddress",
		"propertyType": "node",
				.
			.
	},
	{
			.
			.
		"propertyName": "name",
		"propertyType": "string"
			.
			.
	}
]

Create a New students Domain and Add the Cross-Reference To the First Version's Model Schema

POST /domains/versions/<students-domain-uuid>

...

Again, the students domain could just reference the country MDR once which would cause the entire country MDR to be inserted.

How to Establish Circular Cross-References

Consider the situation where a state domain needs to reference to country and country needs a reference back to multiple state MDRs.

...