Versions Compared

Key

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

...

Code Block
languageyml
titleProperty definition
linenumberstrue
<propertyStringDefinition>
    <id>editor</id>
    <propertyType>string</propertyType>
    <cardinality>single</cardinality>
    <required>true</required>
</propertyStringDefinition>

Overwriting Using

...

a Document Type Definition

In an object a document type definition, a propertyReference can be used to set a value for the required attribute of a property. This value can be different from the value specified in the property definition. In this case, the required attribute will have the value soecified in the object document type definition.

Since the editor property should be optional for an imported1 document, the required attribute is set to false by means of a propertyReference.

...

In the example code below, the editor property is not included directly in the imported2 document type definition. But it is based on the non-static (floating) secondary object type noeditor. The definition of noeditor uses the editor property and sets its required attribute to false by means of a propertyReference. Thus, for objects documents of the type imported2, the editor property will be available and optional.

...

Handling Multiple Property References

In an object a document type definition, it is possible to set a value for the required attribute of a property, and additionally include multiple secondary object types specifying the required attribute for the same property as well. If at least one definition implies required=true, this attribute will be true for every object document of the corresponding type. The value true dominates over false regardless of the location of the propertyReference.

In the example code below, an object a document type imported3 is defined. The editor property is included, but the required attribute is overwritten to false. Thus, the editor property would be optional. However, the two secondary object types noeditor and witheditor may have different values specified for the required attribute of the editor property.

...

The definition of the secondary object type noeditor overwrites the required attribute of the editor property to false. This value equals the specification in the imported3 object document type definition. In contrast, the definition of witheditor includes the editor property by means of a propertyReference but does not explicitly specify a value for the required attribute. This means that the value true from the property definition will be used for witheditor.

If an object a document of type imported3 has none of the two secondary object types, the editor property is optional.
If an object a document of type imported3 has the secondary object type noeditor, nothing changes. The editor property is still optional.
But if an object a document of type imported3 has the secondary object type witheditor, the property editor is mandatory in this object.

...