XML allows for two mechanisms that can be employed to express a relationship between two entities: embedding and referencing. The difference is shown on the right. DDEX uses both mechanisms. Referencing is used typically when a composite may need to be used multiple times. For example, because Sound Recordings are usually referenced from at least two Releases in a NewReleaseMessage, the DDEX standard uses the referencing mechanism for linking
Releases. Shouldn't there also be an explanation with an example of where embedding is used to express a relationship?
Using ID and IDREF
The referencing mechanism employed by DDEX – and many other XML schemas – is often called "ID/IDREF pairs". In that case, the composite that is to be referenced needs to contain an element with a datatype of
xs:ID. In DDEX messages this element is named
XXX denoting the type of the composite. So, the relevant element for all Resources (
Images, etc.) is called
ResourceReference and the relevant element for a Release composite is called
These references are strings and the first letter of these strings denotes the type of composite they belong to:
- References to a Release start with the letter R;
- References to a Resources start with the letter A (because the letter R is already used);
- References to a Deal start with the letter D;
- References to a Cue start with the letter C;
Referring to one of these references is achieved by elements of datatype xs:IDREF. The name of these referring elements is
YYYZZZReference with YYY being the type of element that is referencing and ZZZ being the type of element that is being referenced. Therefore, the element to reference from a Release to a Resource such as a SoundRecording is called
ReleaseResourceReference. The example below shows a
Release pointing to two
SoundRecordings: Line 17 points to the second
SoundRecording (it's reference is provided in line 9) and the line 18 points to the first SoundRecording (it's reference is provided in line 4): Dont you think you shoudl number the lines so that people dont have to count them down to follow the text? Or is this something engineers understand without that?
Best practices for selecting ID/IDREF values
ID/IDREF values in DDEX have to be:
- ASCII strings;
- Start with the specific letter as indicated above; and
- May not contain certain characters (
;, whitespace characters or different parenthesis).
The scope of the ID/IDREF pair is the message in which they are used. Therefore a
ResourceReference used in a message is only valid in that message. When the same
SoundRecording is communicated in a different message, it's
ResourceReference will, in all likelihood, change.
It might therefore be best to start each message with reference number 1 and simply increase the number for each subsequent reference element.
It is specifically recommended to not use any of the metadata elements for the References:
Do not do this
Instead do this
(Note: this is not valid DDEX XML) Which? The stuff above or the stuff to the left? If the stuff above, then that makes no sense as we are trying to get them to create valid DDEX XML arent we?