I'm using openEHR XMLs to commit VERSIONs to an API.
To have valid XMLs, each version should have a reference to the CONTRIBUTION, so there is a lot of redundancy if many VERSIONs are committed.
<xs:complexType name="VERSION" abstract="true">
<xs:element name="contribution" type="OBJECT_REF"/>
1. Change the XSDs to make the VERSION.contribution optional. The commit service provider will create the CONTRIBUTION using the AUDIT_DETAILS. The API will look like:
CommitContribution( HierObjectId ehrId, AuditDetails commitAudit, OriginalVersion versions)
2. Make the CONTRIBUTION the committal unit, and that will have all the VERSIONs in, also needs to have the VERSION.contribution optional, because it should also avoid the redundancy of having all the VERSION->CONTRIBUTION relationshiops. The commit service provider will have all the info to link the VERSIONs to the CONTRIBUTION when storing the data. The CONTRIBUTION will also have the AUDIT_DETAILS data. The API will look like:
CommitContribution( HierObjectId ehrId, Contribution contribution)