Versions Compared

Key

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

...

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
{
	"name": <reference-name>,
	"modelSchema": {
		"properties": {
			"<property1>": {
				"type": "uri",
				"uriType": "xref",
				"xrefLocation": "<path (or UUID) of a domain or domain property>",
				""
				...other item1 properties....
			},
			"<property2>": {
				 ... 
			}
		}
	}
}

...

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>
Code Block
{
	"name": "students",
	"modelSchema": {
		"properties": {
			"homeCountry": {
				"type": "uri",
				"uriType": "xref",
				"xrefLocation": "/domains/country:v1/name"
			},
			"immigrationAddress": {
				"type": "uri",
				"uriType": "xref",
				"xrefLocation": "/domains/country:v1/immigrationAddress"
			},
			    .
		        .
                .
		}
	}
}

...

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

This creates a "chicken-or-the-egg" problem since the schema for one will exist before the other. To remedy one of the domains can be updated after both are created. For example:


1. POST the domain for state with a model schema that includes a reference to country with no xrefLocationmodelSchema for the state domain:

Code Block
languagetext
"name": {
	"type": "string"
}

...

Code Block
languagetext
"name": {
	"type": "string"
},
"state": {
	"type": "uri",
	"uriType":"xref",
	"xrefLocation": "/domain/state:v1/name" 
}

3. 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: PATCHing a domain:version is denied if any data is POSTed to it.

...