[PATCH eac] Add support for the <conventionDeclaration> Tag

Denis Laxalde denis.laxalde at logilab.fr
Thu Aug 1 17:07:52 CEST 2019


Guillaume Vandevelde a écrit :
> # HG changeset patch
> # User Guillaume Vandevelde <gvandevelde at logilab.fr>
> # Date 1564500696 -7200
> #      Tue Jul 30 17:31:36 2019 +0200
> # Node ID b163a3099dd86441b27d1517e5484cda8618ff26
> # Parent  bb7468172b026ba1485712ff00b206ef43c9f958
> # Available At http://hg.logilab.org/review/cubes/eac
> #              hg pull http://hg.logilab.org/review/cubes/eac -r b163a3099dd8
> Add support for the <conventionDeclaration> Tag
> 
> Add support of a new tag, by the creation of the `Convention` entity.
> I choose to stick to the style of the schema and made the entity a child of `AuthorityRecord`.

> diff -r bb7468172b02 -r b163a3099dd8 doc/supported.rst
> --- a/doc/supported.rst	Tue Jul 30 17:31:36 2019 +0200
> +++ b/doc/supported.rst	Tue Jul 30 17:31:36 2019 +0200
> @@ -24,12 +24,12 @@
>    x         alternativeSet      
>    .         authorizedForm      
>    .            biogHist         
> -  x           chronItem         
> -  x           chronList         
> +  .           chronItem
> +  .           chronList
>    .            citation         
>    x         componentEntry      
>    .            control          
> -  x     conventionDeclaration   
> +  .     conventionDeclaration
>    .         cpfDescription      
>    .          cpfRelation        
>    .              date           
> @@ -40,7 +40,7 @@
>    .            eac-cpf          
>    .            entityId         
>    .           entityType        
> -  x             event           
> +  .             event
>    .         eventDateTime       
>    .        eventDescription     
>    .           eventType         

Some of these changes are unrelated to this commit, can you make them a
separate changeset?

> diff -r bb7468172b02 -r b163a3099dd8 test/test_dataimport.py
> --- a/test/test_dataimport.py	Tue Jul 30 17:31:36 2019 +0200
> +++ b/test/test_dataimport.py	Tue Jul 30 17:31:36 2019 +0200
> @@ -124,6 +124,29 @@
>                'agent': set([u'Delphine Jamet'])
>               },
>              ),
> +            ('Convention', _gen_extid(),
> +             {'convention_of': ['FRAD033_EAC_00001'],
> +              'abbrev': set([u'ISAAR(CPF)']),
> +              'has_citation': ['8'],
> +              'description_format': set([u'text/html']),
> +              'description': set([u'<p xmlns="urn:isbn:1-931666-33-4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">Norme ISAAR(CPF) du Conseil international des archives, 2e \xe9dition, 1996.</p>']), # noqa

As for your previous patch, can you avoid #noqa? (There are more below.)

> +             },
> +            ),
> +            ('Citation', _gen_extid(),
> +             {'uri': set([u'http://www.ica.org']),
> +             },
> +            ),
> +            ('Convention', _gen_extid(),
> +             {'convention_of': ['FRAD033_EAC_00001'],
> +              'description_format': set([u'text/html']),
> +              'description': set([u'<p xmlns="urn:isbn:1-931666-33-4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">AFNOR NF Z 44-060, octobre 1983, Catalogue d\u2019auteurs et d\u2019anonymes : forme et\n          structure des vedettes des collectivit\xe9s auteurs.</p>']), # noqa
> +             },
> +            ),
> +            ('Convention', _gen_extid(),
> +             {'convention_of': ['FRAD033_EAC_00001'],
> +              'description_format': set([u'text/html']), 'description': set([u'<p xmlns="urn:isbn:1-931666-33-4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">Norme ISO 8601 :2004 \xc9l\xe9ments de donn\xe9es et formats d\u2019\xe9change -- \xc9change\n          d\u2019information -- Repr\xe9sentation de la date et de l\u2019heure.</p>']), # noqa
> +             },
> +            ),
>              ('AgentKind', 'agentkind/authority',
>               {'name': set([u'authority'])},
>              ),
> @@ -149,8 +172,8 @@
>               {'name': set([u'Bordeaux (Gironde, France)']),
>                'role': set([u'siege']),
>                'place_agent': set(['FRAD033_EAC_00001']),
> -              'place_address': set(['9']),
> -              'equivalent_concept': set([u'http://catalogue.bnf.fr/ark:/12148/cb152418385']),
> +              'place_address': set(['13']),
> +              'equivalent_concept': set(['http://catalogue.bnf.fr/ark:/12148/cb152418385']),
>               },
>              ),
>              ('AgentPlace', _gen_extid(),
> @@ -192,8 +215,8 @@
>                ]),
>                'text_format': set([u'text/html']),
>                'history_agent': set(['FRAD033_EAC_00001']),
> -              'has_citation': set(['16', '17']),
> -              'has_event': set(['18', '19']),
> +              'has_citation': set(['20', '21']),
> +              'has_event': set(['22', '23']),
>               },
>              ),
>              ('Citation', _gen_extid(),
> @@ -261,7 +284,7 @@
>                'description': set([u'Organisation des réunions ...']),
>                'description_format': set([u'text/plain']),
>                'occupation_agent': set(['FRAD033_EAC_00001']),
> -              'has_citation': set(['25']),
> +              'has_citation': set(['29']),
>                'equivalent_concept': set(['http://pifgadget.com']),
>               },
>              ),
> @@ -274,7 +297,7 @@
>                                u'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
>                                u'xmlns:xlink="http://www.w3.org/1999/xlink">very famous</p>']),
>                'content_format': set([u'text/html']),
> -              'has_citation': set(['27']),
> +              'has_citation': set(['31']),
>                'general_context_of': set(['FRAD033_EAC_00001']),
>                }
>              ),
> @@ -386,7 +409,6 @@
>                            'publicationStatus': set([14]),
>                            'maintenanceAgency': set([16]),
>                            'languageDeclaration': set([21]),
> -                          'conventionDeclaration': set([25, 35, 44]),
>                            'localControl': set([54]),
>                            'source': set([76]),  # empty.
>                            'structureOrGenealogy': set([189]),  # empty.
> @@ -488,7 +510,7 @@
>                                 cwuri=u'http://data.culture.fr/thesaurus/page/ark:/67717/T1-1074')
>              cnx.commit()
>              created, updated = testutils.eac_import(cnx, fpath)
> -            self.assertEqual(len(created), 41)
> +            self.assertEqual(len(created), 45)
>              self.assertEqual(updated, set())
>              rset = cnx.find('AuthorityRecord', isni=u'22330001300016')
>              self.assertEqual(len(rset), 1)
> @@ -511,7 +533,7 @@
>              self.assertEqual(len(record.reverse_function_agent), 3)
>              for related in ('structure', 'history', 'mandate', 'occupation',
>                              'generalcontext', 'legal_status', 'eac_relations',
> -                            'equivalent_concept', 'control'):
> +                            'equivalent_concept', 'control', 'convention'):
>                  with self.subTest(related=related):
>                      checker = getattr(self, '_check_' + related)
>                      checker(cnx, record)
> @@ -523,6 +545,13 @@
>                                                      format=u'text/plain').strip(),
>                           u'Pour accomplir ses missions ...')
>  
> +    def _check_convention(self, cnx, record):
> +        rset = cnx.find('Convention', convention_of=record).sorted_rset(lambda x: x.eid)
> +        self.assertEqual(len(rset), 3)
> +        self.assertEqual(rset.get_entity(0, 0)
> +                         .printable_value('description', format=u'text/plain').strip(),
> +                         u'Norme ISAAR(CPF) du Conseil international des archives, 2e \xe9dition, 1996.') # noqa
> +
>      def _check_history(self, cnx, record):
>          rset = cnx.find('History', history_agent=record)
>          self.assertEqual(len(rset), 1)



More information about the saem-devel mailing list