[PATCH eac] Add support for <languageDeclaration>

Denis Laxalde denis.laxalde at logilab.fr
Fri Aug 2 14:57:59 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 ba06431cf4f74da9b74b7c5b63cf6aa043738b1c
> # Parent  29a224db521a3644469c44173b2973bb398e0f12
> # Available At http://hg.logilab.org/review/cubes/eac
> #              hg pull http://hg.logilab.org/review/cubes/eac -r ba06431cf4f7
> Add support for <languageDeclaration>
> 
> Basic adding of a new entity: `LanguageDec`.

LanguageDeclaration looks nicer to me. I don't see the point of
abbreviating entity types name.

> It is added as a child of AuthorityRecord.
> 

> diff -r 29a224db521a -r ba06431cf4f7 test/test_dataimport.py
> --- a/test/test_dataimport.py	Fri Aug 02 10:20:36 2019 +0200
> +++ b/test/test_dataimport.py	Tue Jul 30 17:31:36 2019 +0200
> @@ -124,10 +124,21 @@
>                'agent': set([u'Delphine Jamet'])
>               },
>              ),
> +            ('LanguageDec', _gen_extid(),
> +             {'language_declaration_of': ['FRAD033_EAC_00001'],
> +              'language': set([u'<language xmlns="urn:isbn:1-931666-33-4" xmlns:xsi="'
> +                               u'http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http:/'
> +                               u'/www.w3.org/1999/xlink" languageCode="fre">français</language'
> +                               u'>']),
> +              'script': set([u'<script xmlns="urn:isbn:1-931666-33-4" xmlns:xsi="http://www.w3.org'
> +                             u'/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/'
> +                             u'xlink" scriptCode="Latn">latin</script>'])
> +             },
> +            ),
>              ('Convention', _gen_extid(),
>               {'convention_of': ['FRAD033_EAC_00001'],
>                'abbrev': set([u'ISAAR(CPF)']),
> -              'has_citation': ['8'],
> +              'has_citation': ['9'],
>                'description_format': set([u'text/html']),
>                'description': set([u'<p xmlns="urn:isbn:1-931666-33-4" '
>                                    u'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
> @@ -188,7 +199,7 @@
>               {'name': set([u'Bordeaux (Gironde, France)']),
>                'role': set([u'siege']),
>                'place_agent': set(['FRAD033_EAC_00001']),
> -              'place_address': set(['13']),
> +              'place_address': set(['14']),
>                'equivalent_concept': set(['http://catalogue.bnf.fr/ark:/12148/cb152418385']),
>               },
>              ),
> @@ -231,8 +242,8 @@
>                ]),
>                'text_format': set([u'text/html']),
>                'history_agent': set(['FRAD033_EAC_00001']),
> -              'has_citation': set(['20', '21']),
> -              'has_event': set(['22', '23']),
> +              'has_citation': set(['21', '22']),
> +              'has_event': set(['24', '23']),
>               },
>              ),
>              ('Citation', _gen_extid(),
> @@ -300,7 +311,7 @@
>                'description': set([u'Organisation des réunions ...']),
>                'description_format': set([u'text/plain']),
>                'occupation_agent': set(['FRAD033_EAC_00001']),
> -              'has_citation': set(['29']),
> +              'has_citation': set(['30']),
>                'equivalent_concept': set(['http://pifgadget.com']),
>               },
>              ),
> @@ -313,7 +324,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(['31']),
> +              'has_citation': set(['32']),
>                'general_context_of': set(['FRAD033_EAC_00001']),
>                }
>              ),
> @@ -424,7 +435,6 @@
>                           {'maintenanceStatus': set([12]),
>                            'publicationStatus': set([14]),
>                            'maintenanceAgency': set([16]),
> -                          'languageDeclaration': set([21]),
>                            'localControl': set([54]),
>                            'source': set([76]),  # empty.
>                            'structureOrGenealogy': set([189]),  # empty.
> @@ -526,7 +536,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), 45)
> +            self.assertEqual(len(created), 46)
>              self.assertEqual(updated, set())
>              rset = cnx.find('AuthorityRecord', isni=u'22330001300016')
>              self.assertEqual(len(rset), 1)
> @@ -569,6 +579,14 @@
>                           u'Norme ISAAR(CPF) du Conseil international des archives, '
>                           u'2e \xe9dition, 1996.')
>  
> +    def _check_language_declaration(self, cnx, record):

The method does not appear to be called. It's missing a change in
test_FRAD033_EAC_00001() I think.


> +        rset = cnx.find('LanguageDec', language_declaration_of=record)
> +        self.assertEqual(len(rset), 1)
> +        self.assertEqual(rset.one().printable_value('language', format=u'text/plain').strip(),
> +                         u'<language xmlns="urn:isbn:1-931666-33-4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" languageCode="fre">français</language>') # noqa
> +        self.assertEqual(rset.one().printable_value('script', format=u'text/plain').strip(),
> +                         u'<script xmlns="urn:isbn:1-931666-33-4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" scriptCode="Latn">latin</script>') # noqa

#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