[SEDA 2.1] Make MessageDigestCodeListVersion optional
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 03 Mar 2017 10:37:07 +0100
changeset 2402 ad791cf90bc2
parent 2401 317b5c7b3d49
child 2410 b2cf743e2787
[SEDA 2.1] Make MessageDigestCodeListVersion optional This includes some random reording in the uicfg (due to reordering of the schema?).
cubicweb_seda/entities/generated.py
cubicweb_seda/i18n/en.po
cubicweb_seda/i18n/fr.po
cubicweb_seda/migration/0.8.0_Any.py
cubicweb_seda/schema/seda2.py
cubicweb_seda/views/uicfg.py
cubicweb_seda/xsd/seda-2.0-types.xsd
cubicweb_seda/xsd2yams.py
test/test_profile_generation.py
test/test_schema.py
--- a/cubicweb_seda/entities/generated.py	Fri Mar 03 10:21:01 2017 +0100
+++ b/cubicweb_seda/entities/generated.py	Fri Mar 03 10:37:07 2017 +0100
@@ -58,6 +58,11 @@
     fetch_attrs, cw_fetch_order = fetch_config(['user_cardinality'])
     value_attr = None
 
+class SEDAMessageDigestAlgorithmCodeListVersion(SEDAAnyEntity):
+    __regid__ = 'SEDAMessageDigestAlgorithmCodeListVersion'
+    fetch_attrs, cw_fetch_order = fetch_config(['user_cardinality'])
+    value_attr = None
+
 class SEDAMimeTypeCodeListVersion(SEDAAnyEntity):
     __regid__ = 'SEDAMimeTypeCodeListVersion'
     fetch_attrs, cw_fetch_order = fetch_config(['user_cardinality'])
--- a/cubicweb_seda/i18n/en.po	Fri Mar 03 10:21:01 2017 +0100
+++ b/cubicweb_seda/i18n/en.po	Fri Mar 03 10:37:07 2017 +0100
@@ -356,6 +356,9 @@
 msgid "New SEDALength"
 msgstr ""
 
+msgid "New SEDAMessageDigestAlgorithmCodeListVersion"
+msgstr ""
+
 msgid "New SEDAMimeType"
 msgstr ""
 
@@ -1294,6 +1297,12 @@
 msgid "SEDALength_plural"
 msgstr ""
 
+msgid "SEDAMessageDigestAlgorithmCodeListVersion"
+msgstr ""
+
+msgid "SEDAMessageDigestAlgorithmCodeListVersion_plural"
+msgstr ""
+
 msgid "SEDAMimeType"
 msgstr ""
 
@@ -2462,6 +2471,12 @@
 msgid "This SEDALength:"
 msgstr ""
 
+msgid "This SEDAMessageDigestAlgorithmCodeListVersion"
+msgstr ""
+
+msgid "This SEDAMessageDigestAlgorithmCodeListVersion:"
+msgstr ""
+
 msgid "This SEDAMimeType"
 msgstr ""
 
@@ -3328,6 +3343,9 @@
 msgid "add a SEDALength"
 msgstr ""
 
+msgid "add a SEDAMessageDigestAlgorithmCodeListVersion"
+msgstr ""
+
 msgid "add a SEDAMimeType"
 msgstr ""
 
@@ -4190,6 +4208,10 @@
 msgid "container"
 msgstr ""
 
+msgctxt "SEDAMessageDigestAlgorithmCodeListVersion"
+msgid "container"
+msgstr ""
+
 msgctxt "SEDAMimeType"
 msgid "container"
 msgstr ""
@@ -6433,18 +6455,32 @@
 msgid "seda_management_tab"
 msgstr ""
 
-msgid "seda_message_digest_algorithm_code_list_version"
+msgid "seda_message_digest_algorithm_code_list_version_from"
+msgstr ""
+
+msgctxt "SEDAMessageDigestAlgorithmCodeListVersion"
+msgid "seda_message_digest_algorithm_code_list_version_from"
+msgstr ""
+
+msgid "seda_message_digest_algorithm_code_list_version_from_object"
 msgstr ""
 
 msgctxt "SEDAArchiveTransfer"
-msgid "seda_message_digest_algorithm_code_list_version"
-msgstr ""
-
-msgid "seda_message_digest_algorithm_code_list_version_object"
+msgid "seda_message_digest_algorithm_code_list_version_from_object"
+msgstr ""
+
+msgid "seda_message_digest_algorithm_code_list_version_to"
+msgstr ""
+
+msgctxt "SEDAMessageDigestAlgorithmCodeListVersion"
+msgid "seda_message_digest_algorithm_code_list_version_to"
+msgstr ""
+
+msgid "seda_message_digest_algorithm_code_list_version_to_object"
 msgstr ""
 
 msgctxt "ConceptScheme"
-msgid "seda_message_digest_algorithm_code_list_version_object"
+msgid "seda_message_digest_algorithm_code_list_version_to_object"
 msgstr ""
 
 msgid "seda_mime_type_code_list_version_from"
@@ -8058,6 +8094,10 @@
 msgid "user_annotation"
 msgstr ""
 
+msgctxt "SEDAMessageDigestAlgorithmCodeListVersion"
+msgid "user_annotation"
+msgstr ""
+
 msgctxt "SEDAMimeType"
 msgid "user_annotation"
 msgstr ""
@@ -8561,6 +8601,10 @@
 msgid "user_cardinality"
 msgstr ""
 
+msgctxt "SEDAMessageDigestAlgorithmCodeListVersion"
+msgid "user_cardinality"
+msgstr ""
+
 msgctxt "SEDAMimeType"
 msgid "user_cardinality"
 msgstr ""
--- a/cubicweb_seda/i18n/fr.po	Fri Mar 03 10:21:01 2017 +0100
+++ b/cubicweb_seda/i18n/fr.po	Fri Mar 03 10:37:07 2017 +0100
@@ -363,6 +363,9 @@
 msgid "New SEDALength"
 msgstr ""
 
+msgid "New SEDAMessageDigestAlgorithmCodeListVersion"
+msgstr ""
+
 msgid "New SEDAMimeType"
 msgstr ""
 
@@ -1304,6 +1307,12 @@
 msgid "SEDALength_plural"
 msgstr ""
 
+msgid "SEDAMessageDigestAlgorithmCodeListVersion"
+msgstr ""
+
+msgid "SEDAMessageDigestAlgorithmCodeListVersion_plural"
+msgstr ""
+
 msgid "SEDAMimeType"
 msgstr "type MIME"
 
@@ -2474,6 +2483,12 @@
 msgid "This SEDALength:"
 msgstr ""
 
+msgid "This SEDAMessageDigestAlgorithmCodeListVersion"
+msgstr ""
+
+msgid "This SEDAMessageDigestAlgorithmCodeListVersion:"
+msgstr ""
+
 msgid "This SEDAMimeType"
 msgstr ""
 
@@ -3342,6 +3357,9 @@
 msgid "add a SEDALength"
 msgstr ""
 
+msgid "add a SEDAMessageDigestAlgorithmCodeListVersion"
+msgstr ""
+
 msgid "add a SEDAMimeType"
 msgstr ""
 
@@ -4204,6 +4222,10 @@
 msgid "container"
 msgstr ""
 
+msgctxt "SEDAMessageDigestAlgorithmCodeListVersion"
+msgid "container"
+msgstr ""
+
 msgctxt "SEDAMimeType"
 msgid "container"
 msgstr ""
@@ -6454,18 +6476,32 @@
 msgid "seda_management_tab"
 msgstr "gestion"
 
-msgid "seda_message_digest_algorithm_code_list_version"
+msgid "seda_message_digest_algorithm_code_list_version_from"
+msgstr ""
+
+msgctxt "SEDAMessageDigestAlgorithmCodeListVersion"
+msgid "seda_message_digest_algorithm_code_list_version_from"
+msgstr ""
+
+msgid "seda_message_digest_algorithm_code_list_version_from_object"
 msgstr "algorithmes d'empreinte"
 
 msgctxt "SEDAArchiveTransfer"
-msgid "seda_message_digest_algorithm_code_list_version"
-msgstr ""
-
-msgid "seda_message_digest_algorithm_code_list_version_object"
+msgid "seda_message_digest_algorithm_code_list_version_from_object"
+msgstr ""
+
+msgid "seda_message_digest_algorithm_code_list_version_to"
+msgstr ""
+
+msgctxt "SEDAMessageDigestAlgorithmCodeListVersion"
+msgid "seda_message_digest_algorithm_code_list_version_to"
+msgstr ""
+
+msgid "seda_message_digest_algorithm_code_list_version_to_object"
 msgstr ""
 
 msgctxt "ConceptScheme"
-msgid "seda_message_digest_algorithm_code_list_version_object"
+msgid "seda_message_digest_algorithm_code_list_version_to_object"
 msgstr ""
 
 msgid "seda_mime_type_code_list_version_from"
@@ -8085,6 +8121,10 @@
 msgid "user_annotation"
 msgstr ""
 
+msgctxt "SEDAMessageDigestAlgorithmCodeListVersion"
+msgid "user_annotation"
+msgstr ""
+
 msgctxt "SEDAMimeType"
 msgid "user_annotation"
 msgstr ""
@@ -8588,6 +8628,10 @@
 msgid "user_cardinality"
 msgstr ""
 
+msgctxt "SEDAMessageDigestAlgorithmCodeListVersion"
+msgid "user_cardinality"
+msgstr ""
+
 msgctxt "SEDAMimeType"
 msgid "user_cardinality"
 msgstr ""
--- a/cubicweb_seda/migration/0.8.0_Any.py	Fri Mar 03 10:21:01 2017 +0100
+++ b/cubicweb_seda/migration/0.8.0_Any.py	Fri Mar 03 10:37:07 2017 +0100
@@ -1,7 +1,12 @@
 from cubicweb_seda.dataimport import import_seda_schemes, LCSV_FILES
 
+add_entity_type('SEDAMessageDigestAlgorithmCodeListVersion')
+drop_relation_type('seda_message_digest_algorithm_code_list_version')
+
 add_entity_type('SEDALegalStatus')
 
+sync_schema_props_perms('seda_algorithm')
+
 lcsv_files = [file_def for file_def in LCSV_FILES
               if file_def[-1] == 'legal_status.csv']
 import_seda_schemes(cnx, lcsv_files=lcsv_files)
--- a/cubicweb_seda/schema/seda2.py	Fri Mar 03 10:21:01 2017 +0100
+++ b/cubicweb_seda/schema/seda2.py	Fri Mar 03 10:37:07 2017 +0100
@@ -127,9 +127,24 @@
     inlined = True
     constraints = []
 
-class archive_transfer_message_digest_algorithm_code_list_version(RelationDefinition):
-    name = 'seda_message_digest_algorithm_code_list_version'
-    subject = 'SEDAArchiveTransfer'
+@seda_profile_element(cardinalities=['0..1', '1'], default_cardinality='0..1',
+                      annotable=True)
+class SEDAMessageDigestAlgorithmCodeListVersion(EntityType):
+    u""""""
+
+
+class archive_transfer_message_digest_algorithm_code_list_version_from(RelationDefinition):
+    name = 'seda_message_digest_algorithm_code_list_version_from'
+    subject = 'SEDAMessageDigestAlgorithmCodeListVersion'
+    object = 'SEDAArchiveTransfer'
+    cardinality = '1?'
+    composite = fulltext_container = 'object'
+    inlined = True
+    constraints = []
+
+class message_digest_algorithm_code_list_version_message_digest_algorithm_code_list_version_to(RelationDefinition):
+    name = 'seda_message_digest_algorithm_code_list_version_to'
+    subject = 'SEDAMessageDigestAlgorithmCodeListVersion'
     object = 'ConceptScheme'
     cardinality = '?*'
     composite = fulltext_container = None
@@ -752,7 +767,7 @@
     cardinality = '?*'
     composite = fulltext_container = None
     inlined = True
-    constraints = [RQLConstraint('O in_scheme CS, EXISTS(S container AT, AT seda_message_digest_algorithm_code_list_version CS) OR EXISTS(S container AU, AU is SEDAArchiveUnit,           CS scheme_relation_type RT, RT name "seda_algorithm",           CS scheme_entity_type ET, ET name "SEDABinaryDataObject")')]
+    constraints = [RQLConstraint('O in_scheme CS, EXISTS(S container AT, CACLV seda_message_digest_algorithm_code_list_version_from AT,        CACLV seda_message_digest_algorithm_code_list_version_to CS) OR EXISTS(S container AU, AU is SEDAArchiveUnit,           CS scheme_relation_type RT, RT name "seda_algorithm",           CS scheme_entity_type ET, ET name "SEDABinaryDataObject")')]
 
 class compressed_algorithm(RelationDefinition):
     name = 'seda_algorithm'
--- a/cubicweb_seda/views/uicfg.py	Fri Mar 03 10:21:01 2017 +0100
+++ b/cubicweb_seda/views/uicfg.py	Fri Mar 03 10:37:07 2017 +0100
@@ -24,14 +24,16 @@
 ives['SEDAReplaces'] = 'subobject'
 ives['SEDAAltReferencesArchiveUnitRefId'] = 'subobject'
 ives['SEDACreatingOsVersion'] = 'subobject'
+ives['SEDARepositoryArchiveUnitPID'] = 'subobject'
 ives['SEDAKeywordReference'] = 'subobject'
 ives['SEDASignature'] = 'subobject'
-ives['SEDAFilePlanPosition'] = 'subobject'
+ives['SEDASpatial'] = 'subobject'
+ives['SEDAMessageDigestAlgorithmCodeListVersion'] = 'subobject'
 ives['SEDAFormatLitteral'] = 'subobject'
 ives['SEDADateCreatedByApplication'] = 'subobject'
 ives['SEDAFormatId'] = 'subobject'
 ives['SEDAOriginatingAgencyArchiveUnitIdentifier'] = 'subobject'
-ives['SEDAClassificationReassessingDate'] = 'subobject'
+ives['SEDAAltClassificationRulePreventInheritance'] = 'subobject'
 ives['SEDAGpsAltitudeRef'] = 'subobject'
 ives['SEDAAltIsVersionOfArchiveUnitRefId'] = 'subobject'
 ives['SEDAArchiveUnitRefId'] = 'subobject'
@@ -39,10 +41,12 @@
 ives['SEDASentDate'] = 'subobject'
 ives['SEDAGpsLongitude'] = 'subobject'
 ives['SEDALanguage'] = 'subobject'
+ives['SEDAClassificationReassessingDate'] = 'subobject'
 ives['SEDAGpsLatitude'] = 'subobject'
 ives['SEDADiameter'] = 'subobject'
 ives['SEDACustodialHistoryFile'] = 'subobject'
 ives['SEDAStatus'] = 'subobject'
+ives['SEDASeqStorageRuleRule'] = 'subobject'
 ives['SEDAAltReplacesArchiveUnitRefId'] = 'subobject'
 ives['SEDArestrictionValue'] = 'subobject'
 ives['SEDASystemId'] = 'subobject'
@@ -52,21 +56,20 @@
 ives['SEDAAltArchiveUnitArchiveUnitRefId'] = 'subobject'
 ives['SEDAwhen'] = 'subobject'
 ives['SEDAKeywordType'] = 'subobject'
-ives['SEDAEventIdentifier'] = 'subobject'
+ives['SEDAGpsAltitude'] = 'subobject'
 ives['SEDAIsVersionOf'] = 'subobject'
 ives['SEDAArchivalAgreement'] = 'subobject'
 ives['SEDArestrictionEndDate'] = 'subobject'
-ives['SEDADisseminationRuleCodeListVersion'] = 'subobject'
+ives['SEDASeqAltArchiveUnitArchiveUnitRefIdManagement'] = 'subobject'
 ives['SEDATitle'] = 'subobject'
 ives['SEDAGpsDateStamp'] = 'subobject'
 ives['SEDAEncoding'] = 'subobject'
 ives['SEDACreatingApplicationVersion'] = 'subobject'
 ives['SEDATransactedDate'] = 'subobject'
-ives['SEDAAltRequiresArchiveUnitRefId'] = 'subobject'
+ives['SEDARepositoryObjectPID'] = 'subobject'
+ives['SEDARegisteredDate'] = 'subobject'
 ives['SEDANeedAuthorization'] = 'subobject'
-ives['SEDARepositoryObjectPID'] = 'subobject'
-ives['SEDASpatial'] = 'subobject'
-ives['SEDAVersion'] = 'subobject'
+ives['SEDAEvent'] = 'subobject'
 ives['SEDARelationship'] = 'subobject'
 ives['SEDATag'] = 'subobject'
 ives['SEDAAltStorageRulePreventInheritance'] = 'subobject'
@@ -81,22 +84,20 @@
 ives['SEDACreatingApplicationName'] = 'subobject'
 ives['SEDAKeyword'] = 'subobject'
 ives['SEDADescription'] = 'subobject'
-ives['SEDARegisteredDate'] = 'subobject'
+ives['SEDAFilePlanPosition'] = 'subobject'
 ives['SEDAArchiveUnit'] = 'subobject'
-ives['SEDAAltAccessRulePreventInheritance'] = 'subobject'
+ives['SEDASeqAccessRuleRule'] = 'subobject'
 ives['SEDARefNonRuleId'] = 'subobject'
 ives['SEDAWidth'] = 'subobject'
-ives['SEDAAltDisseminationRulePreventInheritance'] = 'subobject'
+ives['SEDAClassificationRuleCodeListVersion'] = 'subobject'
 ives['SEDARequires'] = 'subobject'
-ives['SEDAStorageRuleCodeListVersion'] = 'subobject'
 ives['SEDAOriginatingSystemId'] = 'subobject'
-ives['SEDAAltClassificationRulePreventInheritance'] = 'subobject'
+ives['SEDAVersion'] = 'subobject'
 ives['SEDAGpsLongitudeRef'] = 'subobject'
 ives['SEDASource'] = 'subobject'
-ives['SEDARepositoryArchiveUnitPID'] = 'subobject'
 ives['SEDAEndDate'] = 'subobject'
 ives['SEDACreatingOs'] = 'subobject'
-ives['SEDAGpsAltitude'] = 'subobject'
+ives['SEDAAltRequiresArchiveUnitRefId'] = 'subobject'
 ives['SEDAWeight'] = 'subobject'
 ives['SEDAType'] = 'subobject'
 ives['SEDADocumentType'] = 'subobject'
@@ -108,7 +109,7 @@
 ives['SEDACompressionAlgorithmCodeListVersion'] = 'subobject'
 ives['SEDATemporal'] = 'subobject'
 ives['SEDAPhysicalDataObject'] = 'subobject'
-ives['SEDASeqAltArchiveUnitArchiveUnitRefIdManagement'] = 'subobject'
+ives['SEDAStartDate'] = 'subobject'
 ives['SEDAThickness'] = 'subobject'
 ives['SEDAAltAppraisalRulePreventInheritance'] = 'subobject'
 ives['SEDASeqAppraisalRuleRule'] = 'subobject'
@@ -122,19 +123,21 @@
 ives['SEDAReuseRuleCodeListVersion'] = 'subobject'
 ives['SEDAAcquiredDate'] = 'subobject'
 ives['SEDASeqReuseRuleRule'] = 'subobject'
+ives['SEDAServiceLevel'] = 'subobject'
 ives['SEDANumberOfPage'] = 'subobject'
 ives['SEDAAppraisalRuleCodeListVersion'] = 'subobject'
 ives['SEDAJuridictional'] = 'subobject'
 ives['SEDAReuseRule'] = 'subobject'
+ives['SEDACustodialHistoryItem'] = 'subobject'
 ives['SEDATransferringAgencyArchiveUnitIdentifier'] = 'subobject'
 ives['SEDALength'] = 'subobject'
 ives['SEDAArchivalAgencyArchiveUnitIdentifier'] = 'subobject'
 ives['SEDAOriginatingAgency'] = 'subobject'
 ives['SEDACreatedDate'] = 'subobject'
-ives['SEDACustodialHistoryItem'] = 'subobject'
-ives['SEDASeqStorageRuleRule'] = 'subobject'
+ives['SEDADisseminationRuleCodeListVersion'] = 'subobject'
+ives['SEDAAltAccessRulePreventInheritance'] = 'subobject'
 ives['SEDADepth'] = 'subobject'
-ives['SEDAStartDate'] = 'subobject'
+ives['SEDAEventIdentifier'] = 'subobject'
 ives['SEDAAltBinaryDataObjectAttachment'] = 'subobject'
 ives['SEDANeedReassessingAuthorization'] = 'subobject'
 ives['SEDAStorageRule'] = 'subobject'
@@ -146,16 +149,14 @@
 ives['SEDARelatedTransferReference'] = 'subobject'
 ives['SEDAAttachment'] = 'subobject'
 ives['SEDASeqClassificationRuleRule'] = 'subobject'
-ives['SEDASeqAccessRuleRule'] = 'subobject'
-ives['SEDAClassificationRuleCodeListVersion'] = 'subobject'
-ives['SEDAEvent'] = 'subobject'
+ives['SEDAStorageRuleCodeListVersion'] = 'subobject'
+ives['SEDASubmissionAgency'] = 'subobject'
 ives['SEDAMimeType'] = 'subobject'
 ives['SEDAReceivedDate'] = 'subobject'
-ives['SEDASubmissionAgency'] = 'subobject'
 ives['SEDAMimeTypeCodeListVersion'] = 'subobject'
 ives['SEDARecipient'] = 'subobject'
 ives['SEDADataObjectReference'] = 'subobject'
-ives['SEDAServiceLevel'] = 'subobject'
+ives['SEDAAltDisseminationRulePreventInheritance'] = 'subobject'
 ives['SEDAShape'] = 'subobject'
 ives['SEDAAltIsPartOfArchiveUnitRefId'] = 'subobject'
 
@@ -175,8 +176,10 @@
 abaa.tag_subject_of(('*', 'seda_archival_agency', '*'), False)
 abaa.tag_object_of(('*', 'seda_transferring_agency', '*'), False)
 abaa.tag_subject_of(('*', 'seda_transferring_agency', '*'), False)
-abaa.tag_object_of(('*', 'seda_message_digest_algorithm_code_list_version', '*'), False)
-abaa.tag_subject_of(('*', 'seda_message_digest_algorithm_code_list_version', '*'), False)
+abaa.tag_subject_of(('*', 'seda_message_digest_algorithm_code_list_version_from', '*'), False)
+abaa.tag_object_of(('*', 'seda_message_digest_algorithm_code_list_version_from', '*'), False)
+abaa.tag_object_of(('*', 'seda_message_digest_algorithm_code_list_version_to', '*'), False)
+abaa.tag_subject_of(('*', 'seda_message_digest_algorithm_code_list_version_to', '*'), False)
 abaa.tag_subject_of(('*', 'seda_mime_type_code_list_version_from', '*'), False)
 abaa.tag_object_of(('*', 'seda_mime_type_code_list_version_from', '*'), False)
 abaa.tag_object_of(('*', 'seda_mime_type_code_list_version_to', '*'), False)
@@ -530,6 +533,7 @@
 affk = uicfg.autoform_field_kwargs
 affk.tag_subject_of(('*', 'comment', '*'), {'widget': fw.TextInput({'size': 80})})
 affk.tag_subject_of(('*', 'archival_agreement', '*'), {'widget': fw.TextInput({'size': 80})})
+affk.tag_subject_of(('*', 'seda_message_digest_algorithm_code_list_version_to', '*'), {'label': 'value'})
 affk.tag_subject_of(('*', 'seda_mime_type_code_list_version_to', '*'), {'label': 'value'})
 affk.tag_subject_of(('*', 'seda_encoding_code_list_version_to', '*'), {'label': 'value'})
 affk.tag_subject_of(('*', 'seda_compression_algorithm_code_list_version_to', '*'), {'label': 'value'})
@@ -588,8 +592,10 @@
 afs.tag_subject_of(('*', 'seda_archival_agency', '*'), 'main', 'attributes')
 afs.tag_object_of(('*', 'seda_transferring_agency', '*'), 'main', 'hidden')
 afs.tag_subject_of(('*', 'seda_transferring_agency', '*'), 'main', 'attributes')
-afs.tag_object_of(('*', 'seda_message_digest_algorithm_code_list_version', '*'), 'main', 'hidden')
-afs.tag_subject_of(('*', 'seda_message_digest_algorithm_code_list_version', '*'), 'main', 'hidden')
+afs.tag_subject_of(('*', 'seda_message_digest_algorithm_code_list_version_from', '*'), 'main', 'hidden')
+afs.tag_object_of(('*', 'seda_message_digest_algorithm_code_list_version_from', '*'), 'main', 'hidden')
+afs.tag_object_of(('*', 'seda_message_digest_algorithm_code_list_version_to', '*'), 'main', 'hidden')
+afs.tag_subject_of(('*', 'seda_message_digest_algorithm_code_list_version_to', '*'), 'main', 'attributes')
 afs.tag_subject_of(('*', 'seda_mime_type_code_list_version_from', '*'), 'main', 'hidden')
 afs.tag_object_of(('*', 'seda_mime_type_code_list_version_from', '*'), 'main', 'hidden')
 afs.tag_object_of(('*', 'seda_mime_type_code_list_version_to', '*'), 'main', 'hidden')
@@ -945,8 +951,9 @@
 pvs.tag_object_of(('*', 'seda_related_transfer_reference', '*'), 'hidden')
 pvs.tag_object_of(('*', 'seda_archival_agency', '*'), 'hidden')
 pvs.tag_object_of(('*', 'seda_transferring_agency', '*'), 'hidden')
-pvs.tag_object_of(('*', 'seda_message_digest_algorithm_code_list_version', '*'), 'hidden')
-pvs.tag_subject_of(('*', 'seda_message_digest_algorithm_code_list_version', '*'), 'hidden')
+pvs.tag_subject_of(('*', 'seda_message_digest_algorithm_code_list_version_from', '*'), 'hidden')
+pvs.tag_object_of(('*', 'seda_message_digest_algorithm_code_list_version_from', '*'), 'hidden')
+pvs.tag_object_of(('*', 'seda_message_digest_algorithm_code_list_version_to', '*'), 'hidden')
 pvs.tag_subject_of(('*', 'seda_mime_type_code_list_version_from', '*'), 'hidden')
 pvs.tag_object_of(('*', 'seda_mime_type_code_list_version_from', '*'), 'hidden')
 pvs.tag_object_of(('*', 'seda_mime_type_code_list_version_to', '*'), 'hidden')
@@ -1120,7 +1127,8 @@
 rec.tag_object_of(('*', 'seda_transfer_request_reply_identifier', '*'), {'novalue_label': ' '})
 rec.tag_subject_of(('*', 'seda_archival_agency', '*'), {'novalue_label': '<no value specified>'})
 rec.tag_subject_of(('*', 'seda_transferring_agency', '*'), {'novalue_label': '<no value specified>'})
-rec.tag_subject_of(('*', 'seda_message_digest_algorithm_code_list_version', '*'), {'novalue_label': '<no value specified>'})
+rec.tag_object_of(('*', 'seda_message_digest_algorithm_code_list_version_from', '*'), {'novalue_label': ' '})
+rec.tag_subject_of(('*', 'seda_message_digest_algorithm_code_list_version_to', '*'), {'novalue_label': '<no value specified>'})
 rec.tag_object_of(('*', 'seda_mime_type_code_list_version_from', '*'), {'novalue_label': ' '})
 rec.tag_subject_of(('*', 'seda_mime_type_code_list_version_to', '*'), {'novalue_label': '<no value specified>'})
 rec.tag_object_of(('*', 'seda_encoding_code_list_version_from', '*'), {'novalue_label': ' '})
--- a/cubicweb_seda/xsd/seda-2.0-types.xsd	Fri Mar 03 10:21:01 2017 +0100
+++ b/cubicweb_seda/xsd/seda-2.0-types.xsd	Fri Mar 03 10:37:07 2017 +0100
@@ -159,7 +159,7 @@
     <!-- Digest -->
     <xsd:group name="DigestAlgorithmCodeListGroup">
         <xsd:sequence>
-            <xsd:element name="MessageDigestAlgorithmCodeListVersion" type="CodeType">
+            <xsd:element name="MessageDigestAlgorithmCodeListVersion" type="CodeType" minOccurs="0">
                 <xsd:annotation>
                     <xsd:documentation>Liste de l'algorithme de hachage utilisé dans le message.</xsd:documentation>
                 </xsd:annotation>
--- a/cubicweb_seda/xsd2yams.py	Fri Mar 03 10:21:01 2017 +0100
+++ b/cubicweb_seda/xsd2yams.py	Fri Mar 03 10:37:07 2017 +0100
@@ -145,7 +145,8 @@
         'S container AT'),
     ('SEDABinaryDataObject', 'seda_algorithm'): (
         'O in_scheme CS, '
-        'EXISTS(S container AT, AT seda_message_digest_algorithm_code_list_version CS) '
+        'EXISTS(S container AT, CACLV seda_message_digest_algorithm_code_list_version_from AT, '
+        '       CACLV seda_message_digest_algorithm_code_list_version_to CS) '
         'OR EXISTS(S container AU, AU is SEDAArchiveUnit, '
         '          CS scheme_relation_type RT, RT name "seda_algorithm", '
         '          CS scheme_entity_type ET, ET name "SEDABinaryDataObject")'),
@@ -242,7 +243,8 @@
                                 'AT eid %(container)s'),
     },
     ('SEDABinaryDataObject', 'seda_algorithm'): {
-        'SEDAArchiveTransfer': ('AT seda_message_digest_algorithm_code_list_version CS, '
+        'SEDAArchiveTransfer': ('CACLV seda_message_digest_algorithm_code_list_version_from AT, '
+                                'CACLV seda_message_digest_algorithm_code_list_version_to CS, '
                                 'AT eid %(container)s'),
         'SEDAArchiveUnit': ('CS scheme_relation_type RT, RT name "seda_algorithm", '
                             'CS scheme_entity_type ET, ET name "SEDABinaryDataObject"'),
--- a/test/test_profile_generation.py	Fri Mar 03 10:21:01 2017 +0100
+++ b/test/test_profile_generation.py	Fri Mar 03 10:37:07 2017 +0100
@@ -552,8 +552,10 @@
             create = cnx.create_entity
             scheme = create('ConceptScheme', title=u'Digest algorithm')
             some_concept = scheme.add_concept(label=u'md5 algorithm', language_code=u'en')
-            transfer = create('SEDAArchiveTransfer', title=u'test profile',
-                              seda_message_digest_algorithm_code_list_version=scheme)
+            transfer = create('SEDAArchiveTransfer', title=u'test profile')
+            cnx.create_entity('SEDAMessageDigestAlgorithmCodeListVersion',
+                              seda_message_digest_algorithm_code_list_version_from=transfer,
+                              seda_message_digest_algorithm_code_list_version_to=scheme)
             create('SEDABinaryDataObject', user_cardinality=u'0..n',
                    user_annotation=u'I am mandatory',
                    seda_binary_data_object=transfer,
@@ -624,8 +626,10 @@
             scheme = create('ConceptScheme', title=u'Keyword Types')
             some_concept = scheme.add_concept(label=u'md5')
 
-            transfer = create('SEDAArchiveTransfer', title=u'test profile',
-                              seda_message_digest_algorithm_code_list_version=scheme)
+            transfer = create('SEDAArchiveTransfer', title=u'test profile')
+            cnx.create_entity('SEDAMessageDigestAlgorithmCodeListVersion',
+                              seda_message_digest_algorithm_code_list_version_from=transfer,
+                              seda_message_digest_algorithm_code_list_version_to=scheme)
             create('SEDAMimeTypeCodeListVersion', seda_mime_type_code_list_version_from=transfer,
                    seda_mime_type_code_list_version_to=scheme)
             access_rule = create('SEDAAccessRule', seda_access_rule=transfer)
--- a/test/test_schema.py	Fri Mar 03 10:21:01 2017 +0100
+++ b/test/test_schema.py	Fri Mar 03 10:37:07 2017 +0100
@@ -40,7 +40,10 @@
     def test_code_lists_constraints_simple(self):
         with self.admin_access.client_cnx() as cnx:
             bdo = testutils.create_transfer_to_bdo(cnx)
-            bdo.container[0].cw_set(seda_message_digest_algorithm_code_list_version=self.enc_scheme)
+            transfer = bdo.container[0]
+            cnx.create_entity('SEDAMessageDigestAlgorithmCodeListVersion',
+                              seda_message_digest_algorithm_code_list_version_from=transfer,
+                              seda_message_digest_algorithm_code_list_version_to=self.enc_scheme)
             cnx.commit()
 
             bdo.cw_set(seda_algorithm=self.mt_concept)
@@ -122,7 +125,10 @@
         with self.admin_access.client_cnx() as cnx:
             bdo = testutils.create_transfer_to_bdo(cnx)
             cnx.commit()  # commit first to get the container
-            bdo.container[0].cw_set(seda_message_digest_algorithm_code_list_version=self.enc_scheme)
+            transfer = bdo.container[0]
+            cnx.create_entity('SEDAMessageDigestAlgorithmCodeListVersion',
+                              seda_message_digest_algorithm_code_list_version_from=transfer,
+                              seda_message_digest_algorithm_code_list_version_to=self.enc_scheme)
             cnx.commit()
             self.assertDigestAlgorithmConcept(bdo)