[PATCH 05 of 11 seda V2] [SEDA 2.1] Make FileCodeListVersion optional

Sylvain Thenault sylvain.thenault at logilab.fr
Fri Mar 3 15:55:50 CET 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1488536492 -3600
#      Fri Mar 03 11:21:32 2017 +0100
# Node ID b2cf743e278714a4bf5afff95ab797e409dc7ba3
# Parent  ad791cf90bc2d03d186bbc78641eec811719d2f2
[SEDA 2.1] Make FileCodeListVersion optional

diff --git a/cubicweb_seda/entities/generated.py b/cubicweb_seda/entities/generated.py
--- a/cubicweb_seda/entities/generated.py
+++ b/cubicweb_seda/entities/generated.py
@@ -71,10 +71,15 @@ class SEDAMimeTypeCodeListVersion(SEDAAn
 class SEDAEncodingCodeListVersion(SEDAAnyEntity):
     __regid__ = 'SEDAEncodingCodeListVersion'
     fetch_attrs, cw_fetch_order = fetch_config(['user_cardinality'])
     value_attr = None
 
+class SEDAFileFormatCodeListVersion(SEDAAnyEntity):
+    __regid__ = 'SEDAFileFormatCodeListVersion'
+    fetch_attrs, cw_fetch_order = fetch_config(['user_cardinality'])
+    value_attr = None
+
 class SEDACompressionAlgorithmCodeListVersion(SEDAAnyEntity):
     __regid__ = 'SEDACompressionAlgorithmCodeListVersion'
     fetch_attrs, cw_fetch_order = fetch_config(['user_cardinality'])
     value_attr = None
 
diff --git a/cubicweb_seda/hooks.py b/cubicweb_seda/hooks.py
--- a/cubicweb_seda/hooks.py
+++ b/cubicweb_seda/hooks.py
@@ -176,16 +176,14 @@ class SetDefaultCodeListVersionsHook(hoo
         SetDefaultCodeListVersionsOp(self._cw, transfer_eid=self.entity.eid)
 
 
 class SetDefaultCodeListVersionsOp(hook.Operation):
     """Set sensible default values for a transfer's code list versions."""
-    simple_rtypes = [
-        ('seda_file_format_code_list_version', 'seda_format_id_to'),
-        # ('seda_message_digest_algorithm_code_list_version'),
-    ]
     # XXX factorize with data structure in dataimport
     complex_rtypes = [
+        ('seda_file_format_code_list_version', 'seda_format_id_to', None),
+        # ('seda_message_digest_algorithm_code_list_version'),
         ('seda_mime_type_code_list_version', 'seda_mime_type_to', None),
         ('seda_encoding_code_list_version', 'seda_encoding_to', None),
         ('seda_data_object_version_code_list_version', 'seda_data_object_version_to', None),
         ('seda_relationship_code_list_version', 'seda_type_relationship', None),
         ('seda_access_rule_code_list_version', 'seda_rule', 'SEDASeqAccessRuleRule'),
@@ -198,14 +196,10 @@ class SetDefaultCodeListVersionsOp(hook.
     ]
 
     def precommit_event(self):
         transfer = self.transfer_eid
         cnx = self.cnx
-        for rtype, ref_rtype in self.simple_rtypes:
-            cnx.execute('SET T {rtype} CS WHERE NOT T {rtype} CS, T eid %(t)s, '
-                        'CS scheme_relation_type RT, RT name %(rt)s'.format(rtype=rtype),
-                        {'t': transfer, 'rt': ref_rtype})
         for rtype, ref_rtype, ref_etype in self.complex_rtypes:
             etype = 'SEDA' + ''.join(word.capitalize() for word in rtype.split('_')[1:])
             rql = ('INSERT {etype} X: X {rtype}_from T, X {rtype}_to CS '
                    'WHERE NOT Y {rtype}_from T, T eid %(t)s, '
                    'CS scheme_relation_type RT, RT name %(rt)s')
diff --git a/cubicweb_seda/i18n/en.po b/cubicweb_seda/i18n/en.po
--- a/cubicweb_seda/i18n/en.po
+++ b/cubicweb_seda/i18n/en.po
@@ -288,10 +288,13 @@ msgid "New SEDAEventIdentifier"
 msgstr ""
 
 msgid "New SEDAEventType"
 msgstr ""
 
+msgid "New SEDAFileFormatCodeListVersion"
+msgstr ""
+
 msgid "New SEDAFilePlanPosition"
 msgstr ""
 
 msgid "New SEDAFormatId"
 msgstr ""
@@ -1134,10 +1137,16 @@ msgid "SEDAEventType_plural"
 msgstr ""
 
 msgid "SEDAEvent_plural"
 msgstr ""
 
+msgid "SEDAFileFormatCodeListVersion"
+msgstr ""
+
+msgid "SEDAFileFormatCodeListVersion_plural"
+msgstr ""
+
 msgid "SEDAFilePlanPosition"
 msgstr ""
 
 msgctxt ""
 "inlined:SEDASeqAltArchiveUnitArchiveUnitRefIdManagement."
@@ -2337,10 +2346,16 @@ msgid "This SEDAEventType"
 msgstr ""
 
 msgid "This SEDAEventType:"
 msgstr ""
 
+msgid "This SEDAFileFormatCodeListVersion"
+msgstr ""
+
+msgid "This SEDAFileFormatCodeListVersion:"
+msgstr ""
+
 msgid "This SEDAFilePlanPosition"
 msgstr ""
 
 msgid "This SEDAFilePlanPosition:"
 msgstr ""
@@ -3246,10 +3261,13 @@ msgstr ""
 
 msgctxt "inlined:SEDAEvent.seda_event_type_from.object"
 msgid "add a SEDAEventType"
 msgstr ""
 
+msgid "add a SEDAFileFormatCodeListVersion"
+msgstr ""
+
 msgid "add a SEDAFilePlanPosition"
 msgstr ""
 
 msgctxt ""
 "inlined:SEDASeqAltArchiveUnitArchiveUnitRefIdManagement."
@@ -4118,10 +4136,14 @@ msgstr ""
 
 msgctxt "SEDAEventType"
 msgid "container"
 msgstr ""
 
+msgctxt "SEDAFileFormatCodeListVersion"
+msgid "container"
+msgstr ""
+
 msgctxt "SEDAFilePlanPosition"
 msgid "container"
 msgstr ""
 
 msgctxt "SEDAFormatId"
@@ -6014,22 +6036,36 @@ msgid "seda_event_type_to_object"
 msgstr ""
 
 msgid "seda_events_tab"
 msgstr ""
 
-msgid "seda_file_format_code_list_version"
+msgid "seda_file_format_code_list_version_from"
+msgstr ""
+
+msgctxt "SEDAFileFormatCodeListVersion"
+msgid "seda_file_format_code_list_version_from"
+msgstr ""
+
+msgid "seda_file_format_code_list_version_from_object"
 msgstr ""
 
 msgctxt "SEDAArchiveTransfer"
-msgid "seda_file_format_code_list_version"
-msgstr ""
-
-msgid "seda_file_format_code_list_version_object"
+msgid "seda_file_format_code_list_version_from_object"
+msgstr ""
+
+msgid "seda_file_format_code_list_version_to"
+msgstr ""
+
+msgctxt "SEDAFileFormatCodeListVersion"
+msgid "seda_file_format_code_list_version_to"
+msgstr ""
+
+msgid "seda_file_format_code_list_version_to_object"
 msgstr ""
 
 msgctxt "ConceptScheme"
-msgid "seda_file_format_code_list_version_object"
+msgid "seda_file_format_code_list_version_to_object"
 msgstr ""
 
 msgid "seda_file_plan_position"
 msgstr ""
 
@@ -8004,10 +8040,14 @@ msgstr ""
 
 msgctxt "SEDAEventType"
 msgid "user_annotation"
 msgstr ""
 
+msgctxt "SEDAFileFormatCodeListVersion"
+msgid "user_annotation"
+msgstr ""
+
 msgctxt "SEDAFilePlanPosition"
 msgid "user_annotation"
 msgstr ""
 
 msgctxt "SEDAFormatId"
@@ -8511,10 +8551,14 @@ msgstr ""
 
 msgctxt "SEDAEventType"
 msgid "user_cardinality"
 msgstr ""
 
+msgctxt "SEDAFileFormatCodeListVersion"
+msgid "user_cardinality"
+msgstr ""
+
 msgctxt "SEDAFilePlanPosition"
 msgid "user_cardinality"
 msgstr ""
 
 msgctxt "SEDAFormatId"
diff --git a/cubicweb_seda/i18n/fr.po b/cubicweb_seda/i18n/fr.po
--- a/cubicweb_seda/i18n/fr.po
+++ b/cubicweb_seda/i18n/fr.po
@@ -295,10 +295,13 @@ msgid "New SEDAEventIdentifier"
 msgstr ""
 
 msgid "New SEDAEventType"
 msgstr ""
 
+msgid "New SEDAFileFormatCodeListVersion"
+msgstr ""
+
 msgid "New SEDAFilePlanPosition"
 msgstr ""
 
 msgid "New SEDAFormatId"
 msgstr ""
@@ -1144,10 +1147,16 @@ msgid "SEDAEventType_plural"
 msgstr ""
 
 msgid "SEDAEvent_plural"
 msgstr ""
 
+msgid "SEDAFileFormatCodeListVersion"
+msgstr ""
+
+msgid "SEDAFileFormatCodeListVersion_plural"
+msgstr ""
+
 msgid "SEDAFilePlanPosition"
 msgstr ""
 
 msgctxt ""
 "inlined:SEDASeqAltArchiveUnitArchiveUnitRefIdManagement."
@@ -2349,10 +2358,16 @@ msgid "This SEDAEventType"
 msgstr ""
 
 msgid "This SEDAEventType:"
 msgstr ""
 
+msgid "This SEDAFileFormatCodeListVersion"
+msgstr ""
+
+msgid "This SEDAFileFormatCodeListVersion:"
+msgstr ""
+
 msgid "This SEDAFilePlanPosition"
 msgstr ""
 
 msgid "This SEDAFilePlanPosition:"
 msgstr ""
@@ -3260,10 +3275,13 @@ msgstr "ajouter un type"
 
 msgctxt "inlined:SEDAEvent.seda_event_type_from.object"
 msgid "add a SEDAEventType"
 msgstr ""
 
+msgid "add a SEDAFileFormatCodeListVersion"
+msgstr ""
+
 msgid "add a SEDAFilePlanPosition"
 msgstr ""
 
 msgctxt ""
 "inlined:SEDASeqAltArchiveUnitArchiveUnitRefIdManagement."
@@ -4132,10 +4150,14 @@ msgstr ""
 
 msgctxt "SEDAEventType"
 msgid "container"
 msgstr ""
 
+msgctxt "SEDAFileFormatCodeListVersion"
+msgid "container"
+msgstr ""
+
 msgctxt "SEDAFilePlanPosition"
 msgid "container"
 msgstr ""
 
 msgctxt "SEDAFormatId"
@@ -6035,22 +6057,36 @@ msgid "seda_event_type_to_object"
 msgstr ""
 
 msgid "seda_events_tab"
 msgstr "événements"
 
-msgid "seda_file_format_code_list_version"
+msgid "seda_file_format_code_list_version_from"
+msgstr ""
+
+msgctxt "SEDAFileFormatCodeListVersion"
+msgid "seda_file_format_code_list_version_from"
+msgstr ""
+
+msgid "seda_file_format_code_list_version_from_object"
 msgstr "formats de fichier"
 
 msgctxt "SEDAArchiveTransfer"
-msgid "seda_file_format_code_list_version"
-msgstr ""
-
-msgid "seda_file_format_code_list_version_object"
+msgid "seda_file_format_code_list_version_from_object"
+msgstr ""
+
+msgid "seda_file_format_code_list_version_to"
+msgstr ""
+
+msgctxt "SEDAFileFormatCodeListVersion"
+msgid "seda_file_format_code_list_version_to"
+msgstr ""
+
+msgid "seda_file_format_code_list_version_to_object"
 msgstr ""
 
 msgctxt "ConceptScheme"
-msgid "seda_file_format_code_list_version_object"
+msgid "seda_file_format_code_list_version_to_object"
 msgstr ""
 
 msgid "seda_file_plan_position"
 msgstr ""
 
@@ -8031,10 +8067,14 @@ msgstr ""
 
 msgctxt "SEDAEventType"
 msgid "user_annotation"
 msgstr ""
 
+msgctxt "SEDAFileFormatCodeListVersion"
+msgid "user_annotation"
+msgstr ""
+
 msgctxt "SEDAFilePlanPosition"
 msgid "user_annotation"
 msgstr ""
 
 msgctxt "SEDAFormatId"
@@ -8538,10 +8578,14 @@ msgstr ""
 
 msgctxt "SEDAEventType"
 msgid "user_cardinality"
 msgstr ""
 
+msgctxt "SEDAFileFormatCodeListVersion"
+msgid "user_cardinality"
+msgstr ""
+
 msgctxt "SEDAFilePlanPosition"
 msgid "user_cardinality"
 msgstr ""
 
 msgctxt "SEDAFormatId"
diff --git a/cubicweb_seda/migration/0.8.0_Any.py b/cubicweb_seda/migration/0.8.0_Any.py
--- a/cubicweb_seda/migration/0.8.0_Any.py
+++ b/cubicweb_seda/migration/0.8.0_Any.py
@@ -1,13 +1,16 @@
 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('SEDAFileFormatCodeListVersion')
+drop_relation_type('seda_file_format_code_list_version')
 
 add_entity_type('SEDALegalStatus')
 
 sync_schema_props_perms('seda_algorithm')
+sync_schema_props_perms('seda_format_id_to')
 
 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)
 
diff --git a/cubicweb_seda/schema/seda2.py b/cubicweb_seda/schema/seda2.py
--- a/cubicweb_seda/schema/seda2.py
+++ b/cubicweb_seda/schema/seda2.py
@@ -197,13 +197,28 @@ class encoding_code_list_version_encodin
     cardinality = '?*'
     composite = fulltext_container = None
     inlined = True
     constraints = []
 
-class archive_transfer_file_format_code_list_version(RelationDefinition):
-    name = 'seda_file_format_code_list_version'
-    subject = 'SEDAArchiveTransfer'
+ at seda_profile_element(cardinalities=['0..1', '1'], default_cardinality='0..1',
+                      annotable=True)
+class SEDAFileFormatCodeListVersion(EntityType):
+    u""""""
+
+
+class archive_transfer_file_format_code_list_version_from(RelationDefinition):
+    name = 'seda_file_format_code_list_version_from'
+    subject = 'SEDAFileFormatCodeListVersion'
+    object = 'SEDAArchiveTransfer'
+    cardinality = '1?'
+    composite = fulltext_container = 'object'
+    inlined = True
+    constraints = []
+
+class file_format_code_list_version_file_format_code_list_version_to(RelationDefinition):
+    name = 'seda_file_format_code_list_version_to'
+    subject = 'SEDAFileFormatCodeListVersion'
     object = 'ConceptScheme'
     cardinality = '?*'
     composite = fulltext_container = None
     inlined = True
     constraints = []
@@ -838,11 +853,11 @@ class format_id_format_id_to(RelationDef
     subject = 'SEDAFormatId'
     object = 'Concept'
     cardinality = '?*'
     composite = fulltext_container = None
     inlined = True
-    constraints = [RQLConstraint('O in_scheme CS,  AT seda_file_format_code_list_version CS, S container AT')]
+    constraints = [RQLConstraint('O in_scheme CS, CACL seda_file_format_code_list_version_from AT, CACL seda_file_format_code_list_version_to CS, S container AT')]
 
 @seda_profile_element(cardinalities=['0..1', '1'], default_cardinality='0..1',
                       annotable=True)
 class SEDAEncoding(EntityType):
     u""""""
diff --git a/cubicweb_seda/views/uicfg.py b/cubicweb_seda/views/uicfg.py
--- a/cubicweb_seda/views/uicfg.py
+++ b/cubicweb_seda/views/uicfg.py
@@ -58,10 +58,11 @@ ives['SEDAwhen'] = 'subobject'
 ives['SEDAKeywordType'] = 'subobject'
 ives['SEDAGpsAltitude'] = 'subobject'
 ives['SEDAIsVersionOf'] = 'subobject'
 ives['SEDAArchivalAgreement'] = 'subobject'
 ives['SEDArestrictionEndDate'] = 'subobject'
+ives['SEDAFileFormatCodeListVersion'] = 'subobject'
 ives['SEDASeqAltArchiveUnitArchiveUnitRefIdManagement'] = 'subobject'
 ives['SEDATitle'] = 'subobject'
 ives['SEDAGpsDateStamp'] = 'subobject'
 ives['SEDAEncoding'] = 'subobject'
 ives['SEDACreatingApplicationVersion'] = 'subobject'
@@ -186,12 +187,14 @@ abaa.tag_object_of(('*', 'seda_mime_type
 abaa.tag_subject_of(('*', 'seda_mime_type_code_list_version_to', '*'), False)
 abaa.tag_subject_of(('*', 'seda_encoding_code_list_version_from', '*'), False)
 abaa.tag_object_of(('*', 'seda_encoding_code_list_version_from', '*'), False)
 abaa.tag_object_of(('*', 'seda_encoding_code_list_version_to', '*'), False)
 abaa.tag_subject_of(('*', 'seda_encoding_code_list_version_to', '*'), False)
-abaa.tag_object_of(('*', 'seda_file_format_code_list_version', '*'), False)
-abaa.tag_subject_of(('*', 'seda_file_format_code_list_version', '*'), False)
+abaa.tag_subject_of(('*', 'seda_file_format_code_list_version_from', '*'), False)
+abaa.tag_object_of(('*', 'seda_file_format_code_list_version_from', '*'), False)
+abaa.tag_object_of(('*', 'seda_file_format_code_list_version_to', '*'), False)
+abaa.tag_subject_of(('*', 'seda_file_format_code_list_version_to', '*'), False)
 abaa.tag_subject_of(('*', 'seda_compression_algorithm_code_list_version_from', '*'), False)
 abaa.tag_object_of(('*', 'seda_compression_algorithm_code_list_version_from', '*'), False)
 abaa.tag_object_of(('*', 'seda_compression_algorithm_code_list_version_to', '*'), False)
 abaa.tag_subject_of(('*', 'seda_compression_algorithm_code_list_version_to', '*'), False)
 abaa.tag_subject_of(('*', 'seda_data_object_version_code_list_version_from', '*'), False)
@@ -534,10 +537,11 @@ 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_file_format_code_list_version_to', '*'), {'label': 'value'})
 affk.tag_subject_of(('*', 'seda_compression_algorithm_code_list_version_to', '*'), {'label': 'value'})
 affk.tag_subject_of(('*', 'seda_data_object_version_code_list_version_to', '*'), {'label': 'value'})
 affk.tag_subject_of(('*', 'seda_storage_rule_code_list_version_to', '*'), {'label': 'value'})
 affk.tag_subject_of(('*', 'seda_appraisal_rule_code_list_version_to', '*'), {'label': 'value'})
 affk.tag_subject_of(('*', 'seda_access_rule_code_list_version_to', '*'), {'label': 'value'})
@@ -602,12 +606,14 @@ afs.tag_object_of(('*', 'seda_mime_type_
 afs.tag_subject_of(('*', 'seda_mime_type_code_list_version_to', '*'), 'main', 'attributes')
 afs.tag_subject_of(('*', 'seda_encoding_code_list_version_from', '*'), 'main', 'hidden')
 afs.tag_object_of(('*', 'seda_encoding_code_list_version_from', '*'), 'main', 'hidden')
 afs.tag_object_of(('*', 'seda_encoding_code_list_version_to', '*'), 'main', 'hidden')
 afs.tag_subject_of(('*', 'seda_encoding_code_list_version_to', '*'), 'main', 'attributes')
-afs.tag_object_of(('*', 'seda_file_format_code_list_version', '*'), 'main', 'hidden')
-afs.tag_subject_of(('*', 'seda_file_format_code_list_version', '*'), 'main', 'hidden')
+afs.tag_subject_of(('*', 'seda_file_format_code_list_version_from', '*'), 'main', 'hidden')
+afs.tag_object_of(('*', 'seda_file_format_code_list_version_from', '*'), 'main', 'hidden')
+afs.tag_object_of(('*', 'seda_file_format_code_list_version_to', '*'), 'main', 'hidden')
+afs.tag_subject_of(('*', 'seda_file_format_code_list_version_to', '*'), 'main', 'attributes')
 afs.tag_subject_of(('*', 'seda_compression_algorithm_code_list_version_from', '*'), 'main', 'hidden')
 afs.tag_object_of(('*', 'seda_compression_algorithm_code_list_version_from', '*'), 'main', 'hidden')
 afs.tag_object_of(('*', 'seda_compression_algorithm_code_list_version_to', '*'), 'main', 'hidden')
 afs.tag_subject_of(('*', 'seda_compression_algorithm_code_list_version_to', '*'), 'main', 'attributes')
 afs.tag_subject_of(('*', 'seda_data_object_version_code_list_version_from', '*'), 'main', 'hidden')
@@ -958,12 +964,13 @@ pvs.tag_subject_of(('*', 'seda_mime_type
 pvs.tag_object_of(('*', 'seda_mime_type_code_list_version_from', '*'), 'hidden')
 pvs.tag_object_of(('*', 'seda_mime_type_code_list_version_to', '*'), 'hidden')
 pvs.tag_subject_of(('*', 'seda_encoding_code_list_version_from', '*'), 'hidden')
 pvs.tag_object_of(('*', 'seda_encoding_code_list_version_from', '*'), 'hidden')
 pvs.tag_object_of(('*', 'seda_encoding_code_list_version_to', '*'), 'hidden')
-pvs.tag_object_of(('*', 'seda_file_format_code_list_version', '*'), 'hidden')
-pvs.tag_subject_of(('*', 'seda_file_format_code_list_version', '*'), 'hidden')
+pvs.tag_subject_of(('*', 'seda_file_format_code_list_version_from', '*'), 'hidden')
+pvs.tag_object_of(('*', 'seda_file_format_code_list_version_from', '*'), 'hidden')
+pvs.tag_object_of(('*', 'seda_file_format_code_list_version_to', '*'), 'hidden')
 pvs.tag_subject_of(('*', 'seda_compression_algorithm_code_list_version_from', '*'), 'hidden')
 pvs.tag_object_of(('*', 'seda_compression_algorithm_code_list_version_from', '*'), 'hidden')
 pvs.tag_object_of(('*', 'seda_compression_algorithm_code_list_version_to', '*'), 'hidden')
 pvs.tag_subject_of(('*', 'seda_data_object_version_code_list_version_from', '*'), 'hidden')
 pvs.tag_object_of(('*', 'seda_data_object_version_code_list_version_from', '*'), 'hidden')
@@ -1131,11 +1138,12 @@ rec.tag_object_of(('*', 'seda_message_di
 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': ' '})
 rec.tag_subject_of(('*', 'seda_encoding_code_list_version_to', '*'), {'novalue_label': '<no value specified>'})
-rec.tag_subject_of(('*', 'seda_file_format_code_list_version', '*'), {'novalue_label': '<no value specified>'})
+rec.tag_object_of(('*', 'seda_file_format_code_list_version_from', '*'), {'novalue_label': ' '})
+rec.tag_subject_of(('*', 'seda_file_format_code_list_version_to', '*'), {'novalue_label': '<no value specified>'})
 rec.tag_object_of(('*', 'seda_compression_algorithm_code_list_version_from', '*'), {'novalue_label': ' '})
 rec.tag_subject_of(('*', 'seda_compression_algorithm_code_list_version_to', '*'), {'novalue_label': '<no value specified>'})
 rec.tag_object_of(('*', 'seda_data_object_version_code_list_version_from', '*'), {'novalue_label': ' '})
 rec.tag_subject_of(('*', 'seda_data_object_version_code_list_version_to', '*'), {'novalue_label': '<no value specified>'})
 rec.tag_object_of(('*', 'seda_storage_rule_code_list_version_from', '*'), {'novalue_label': ' '})
diff --git a/cubicweb_seda/xsd/seda-2.0-technical.xsd b/cubicweb_seda/xsd/seda-2.0-technical.xsd
--- a/cubicweb_seda/xsd/seda-2.0-technical.xsd
+++ b/cubicweb_seda/xsd/seda-2.0-technical.xsd
@@ -61,11 +61,11 @@
         </xsd:annotation>
         <xsd:restriction base="NonEmptyTokenType"/>
     </xsd:simpleType>
     <xsd:group name="FileFormatCodeListGroup">
         <xsd:sequence>
-            <xsd:element name="FileFormatCodeListVersion" type="CodeType">
+            <xsd:element name="FileFormatCodeListVersion" type="CodeType" minOccurs="0">
                 <xsd:annotation>
                     <xsd:documentation>Version de la liste de code d'identification du format.</xsd:documentation>
                 </xsd:annotation>
             </xsd:element>
         </xsd:sequence>
diff --git a/cubicweb_seda/xsd2yams.py b/cubicweb_seda/xsd2yams.py
--- a/cubicweb_seda/xsd2yams.py
+++ b/cubicweb_seda/xsd2yams.py
@@ -131,11 +131,12 @@ RDEF_CONSTRAINTS = {
         '       CACLV seda_encoding_code_list_version_to CS,'
         '       S container AT)'
         ' OR EXISTS(S container AU, AU is SEDAArchiveUnit, CS scheme_relation_type RT, '
         '           RT name "seda_encoding_to")'),
     'seda_format_id_to': (
-        'O in_scheme CS,  AT seda_file_format_code_list_version CS, '
+        'O in_scheme CS, CACL seda_file_format_code_list_version_from AT, '
+        'CACL seda_file_format_code_list_version_to CS, '
         'S container AT'),
     'seda_data_object_version_to': (
         'O in_scheme CS, CACLV seda_data_object_version_code_list_version_from AT, '
         'CACLV seda_data_object_version_code_list_version_to CS,'
         'S container AT'),
@@ -228,11 +229,12 @@ SCHEME_FROM_CONTAINER = {
                                 'CACLV seda_encoding_code_list_version_to CS, '
                                 'AT eid %(container)s'),
         'SEDAArchiveUnit': 'CS scheme_relation_type RT, RT name "seda_encoding_to"',
     },
     'seda_format_id_to': {
-        'SEDAArchiveTransfer': ('AT seda_file_format_code_list_version CS, '
+        'SEDAArchiveTransfer': ('CACLV seda_file_format_code_list_version_from AT, '
+                                'CACLV seda_file_format_code_list_version_to CS, '
                                 'AT eid %(container)s'),
     },
     'seda_data_object_version_to': {
         'SEDAArchiveTransfer': ('CACLV seda_data_object_version_code_list_version_from AT, '
                                 'CACLV seda_data_object_version_code_list_version_to CS, '
diff --git a/test/test_hooks.py b/test/test_hooks.py
--- a/test/test_hooks.py
+++ b/test/test_hooks.py
@@ -141,11 +141,11 @@ class SetDefaultHooksTC(CubicWebTC):
                 scheme_for_type(cnx, rtype, etype)
             cnx.commit()
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'test profile')
             cnx.commit()
 
-            self.assertTrue(transfer.seda_file_format_code_list_version)
+            self.assertTrue(transfer.reverse_seda_file_format_code_list_version_from)
             self.assertTrue(transfer.reverse_seda_mime_type_code_list_version_from)
             self.assertTrue(transfer.reverse_seda_encoding_code_list_version_from)
             self.assertTrue(transfer.reverse_seda_access_rule_code_list_version_from)
             self.assertTrue(transfer.reverse_seda_appraisal_rule_code_list_version_from)
 
diff --git a/test/test_profile_generation.py b/test/test_profile_generation.py
--- a/test/test_profile_generation.py
+++ b/test/test_profile_generation.py
@@ -628,10 +628,12 @@ class SEDAExportFuncTCMixIn(object):
 
             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)
+            cnx.create_entity('SEDAFileFormatCodeListVersion',
+                              seda_file_format_code_list_version_from=transfer)
             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)
             access_rule_seq = create('SEDASeqAccessRuleRule',
                                      reverse_seda_seq_access_rule_rule=access_rule)


More information about the saem-devel mailing list