38 | | * Needs additional components in the infrastructure, namely: a "function registry" where the semantics of all operations/constants is described and all allowed arguments are defined (semantics + allowed datatypes). |
39 | | * The proposed solution does not guarantee that referenced nodes do exist (usage of a component in various contexts or when refering to optional elements). This is especially important for derivation of values depending on component-external elements. In this case the editor should notify the user of this problem. |
| 40 | * needs additional components in the infrastructure, namely: a "function registry" where the semantics of all operations/constants is described and all allowed arguments are defined (semantics + allowed datatypes). |
| 41 | * the proposed solution does not guarantee that referenced nodes do exist (usage of a component in various contexts or when refering to optional elements). This is especially important for derivation of values depending on component-external elements. In this case the editor should notify the user of this problem. |
90 | | |
| 92 | ==== Open questions ==== |
| 93 | * Using new namespace? |
| 94 | |
| 95 | == Second solution == |
| 96 | A simpler solution would be to define a fixed set of functions (numeric operations + some frequently used functions like replacement of language codes with language names) and keywords (like $filesize, $current_time etc.)). |
| 97 | |
| 98 | The CMD general component schema is extended with one additional (optional) attribute (AutoValue) for the elements and attributes specification. This attribute contains the function that is used to generate the content of the element/attribute and is based on these predefined functions and keywords. Content of other elements that is needed to generate the value is addressed by using XPath expressions. |
| 99 | |
| 100 | |
| 101 | ==== Pros ==== |
| 102 | * simpler solution as proposal 1 (reduces implementation effort) |
| 103 | * no need to build new infrastructure components |
| 104 | |
| 105 | ==== Cons ==== |
| 106 | * may lack expressiveness (missing functions may become clear at some later point) |
| 107 | * adding new functions needs changes in all editors (may occur regularly) |
| 108 | * the proposed solution does not guarantee that referenced nodes do exist (usage of a component in various contexts or when refering to optional elements). This is especially important for derivation of values depending on component-external elements. In this case the editor should notify the user of this problem. |
| 109 | |
| 110 | ==== Centre impact ==== |
| 111 | |
| 112 | * Affected tools |
| 113 | * Infrastructure |
| 114 | * Component Registry |
| 115 | * Editors |
| 116 | * Arbil |
| 117 | * ProForma |
| 118 | * Viewers |
| 119 | * |
| 120 | * Impact on instances |
| 121 | |
| 122 | === Implementation examples === |
| 123 | The specification of CMDI elements and attributes is extended by one optional attribute (AutoValue (xs:string)). |
| 124 | {{{ |
| 125 | <!-- list of all attributes that can be bound to a cl_el --> |
| 126 | <xs:attributeGroup name="clarin_element_attributes"> |
| 127 | <xs:attribute name="name" type="xs:Name" use="required"> |
| 128 | <xs:annotation> |
| 129 | <xs:documentation>The name of the element.</xs:documentation> |
| 130 | </xs:annotation> |
| 131 | </xs:attribute> |
| 132 | ... |
| 133 | <xs:attribute name="AutoValue" type="xs:string"> |
| 134 | <xs:annotation> |
| 135 | <xs:documentation>A function that is used to derive the content of this element based on external information.</xs:documentation> |
| 136 | </xs:annotation> |
| 137 | </xs:attribute> |
| 138 | </xs:attributeGroup> |
| 139 | }}} |
| 140 | and similar for Attribute specifications |
| 141 | |
| 142 | ==== Implementation on component model level ==== |
| 143 | Example: |
| 144 | {{{ |
| 145 | <CMD_Element name="AgeOfFile" AutoValue="$CurrentDate-date({../CreationDate})"/> |
| 146 | }}} |
| 147 | |
| 148 | |
| 149 | |
| 150 | ==== Open questions ==== |
| 151 | * Using new namespace? |
| 152 | * Allowed syntax? |