27 | | == Proposed solutions == |
28 | | No concrete proposals, open for discussion. |
| 27 | |
| 28 | == Proposed solution == |
| 29 | The idea is to specify a generic solution for value derivation in CMDI 1.2 without specific restrictions on allowed functions or constants. This is particularly important as there was no broader evaluation of needed functionality (and the above mentioned examples are probably just a start). Furthermore additional extensions in the infrastructure that are needed to support this functionality can be developed at a later time (as long as they are not directly related to the CMDI 1.2 specification process). |
| 30 | |
| 31 | The CMD general component schema is extended with two additional (optional) attributes (AutoValueProcedure and AutoValueParameters) for the elements and attributes specification. AutoValueProcedure contains a URI of an external specification of a procedure or constant (like "getLanguageNameForISO639", "numericAddition" "filesize", "currentDate" etc.). A second attribute contains the arguments for these procedures as a list of XPath expressions (referencing other elements in the same component). |
| 32 | |
| 33 | ==== Pros ==== |
| 34 | * By referencing external procedures the functionality can be easily extended |
| 35 | * Procedures can be implemented as services (which hide their complexity) |
| 36 | |
| 37 | ==== Cons ==== |
| 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 | |
| 41 | |
| 42 | ==== Centre impact ==== |
| 43 | |
| 44 | * Affected tools |
| 45 | * Infrastructure |
| 46 | * Component Registry |
| 47 | * Editors |
| 48 | * Arbil |
| 49 | * ProForma |
| 50 | * Viewers |
| 51 | * |
| 52 | * Impact on instances |
| 53 | |
| 54 | |
| 55 | ==== Implementation examples ==== |
| 56 | Derivation rules will be represented on the model level only (component specification -> XSD), not on the instance level. |
| 57 | |
| 58 | * Implementation in general component schema |
| 59 | The specification of CMDI elements and attributes is extended by two optional attributes (AutoValueProcedure (xs:anyURI) and AutoValueParameters (xs:string)). |
| 60 | {{{ |
| 61 | <!-- list of all attributes that can be bound to a cl_el --> |
| 62 | <xs:attributeGroup name="clarin_element_attributes"> |
| 63 | <xs:attribute name="name" type="xs:Name" use="required"> |
| 64 | <xs:annotation> |
| 65 | <xs:documentation>The name of the element.</xs:documentation> |
| 66 | </xs:annotation> |
| 67 | </xs:attribute> |
| 68 | ... |
| 69 | <xs:attribute name="AutoValueProcedure" type="xs:anyURI"> |
| 70 | <xs:annotation> |
| 71 | <xs:documentation>The URI of a procedure that is used to derive the content of this element based on external information.</xs:documentation> |
| 72 | </xs:annotation> |
| 73 | </xs:attribute> |
| 74 | <xs:attribute name="AutoValueParameters" type="xs:string"> |
| 75 | <xs:annotation> |
| 76 | <xs:documentation>A list of XPath expressions that is used as arguments for the procedure specified in AutoValueProcedure.</xs:documentation> |
| 77 | </xs:annotation> |
| 78 | </xs:attribute> |
| 79 | </xs:attributeGroup> |
| 80 | }}} |
| 81 | and similar for Attribute specifications |
| 82 | |
| 83 | * Implementation on component model level |
| 84 | |
| 85 | {{{ |
| 86 | <CMD_Element name="Duration" AutoValueProcedure="http://www.clarin.eu/cmdi/autovalue/procedure/datediff" AutoValueParameter="../StartRangeDate ../EndRangeDate"/> |
| 87 | }}} |
| 88 | |
| 89 | |
| 90 | |