saem-devel Digest, Vol 28, Issue 2

gvandevelde guillaume.vandevelde at logilab.fr
Fri Aug 2 10:25:04 CEST 2019


On 8/1/19 5:07 PM, saem-devel-request at lists.cubicweb.org wrote:
> Send saem-devel mailing list submissions to
> 	saem-devel at lists.cubicweb.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://lists.cubicweb.org/mailman/listinfo/saem-devel
> or, via email, send a message with subject or body 'help' to
> 	saem-devel-request at lists.cubicweb.org
>
> You can reach the person managing the list at
> 	saem-devel-owner at lists.cubicweb.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of saem-devel digest..."
>
>
> Today's Topics:
>
>     1. [PATCH eac] Add support for the <conventionDeclaration> Tag
>        (Guillaume Vandevelde)
>     2. Re: [PATCH eac] Add support for the <conventionDeclaration>
>        Tag (Denis Laxalde)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 01 Aug 2019 15:01:49 +0200
> From: Guillaume Vandevelde <guillaume.vandevelde at logilab.fr>
> To: saem-devel at lists.cubicweb.org
> Subject: [PATCH eac] Add support for the <conventionDeclaration> Tag
> Message-ID: <b163a3099dd86441b27d.1564664509 at icare>
> Content-Type: text/plain; charset="utf-8"
>
> # 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 cubicweb_eac/dataimport.py
> --- a/cubicweb_eac/dataimport.py	Tue Jul 30 17:31:36 2019 +0200
> +++ b/cubicweb_eac/dataimport.py	Tue Jul 30 17:31:36 2019 +0200
> @@ -40,11 +40,11 @@
>   TYPE_MAPPING['human'] = u'person'
>   
>   ETYPES_ORDER_HINT = ('AgentKind', 'PhoneNumber', 'PostalAddress', 'AuthorityRecord',
> -                     'AgentPlace', 'Mandate', 'LegalStatus', 'History', 'HistoricalEvent',
> -                     'Structure', 'AgentFunction', 'Occupation', 'GeneralContext',
> -                     'AssociationRelation', 'ChronologicalRelation', 'HierarchicalRelation',
> -                     'EACResourceRelation', 'ExternalUri', 'EACSource',
> -                     'Activity')
> +                     'Convention', 'AgentPlace', 'Mandate', 'LegalStatus',
> +                     'History', 'HistoricalEvent', 'Structure', 'AgentFunction', 'Occupation',
> +                     'GeneralContext', 'AssociationRelation', 'ChronologicalRelation',
> +                     'HierarchicalRelation', 'EACResourceRelation', 'ExternalUri',
> +                     'EACSource', 'Activity')
>   
>   
>   class InvalidEAC(RuntimeError):
> @@ -889,6 +889,10 @@
>                                     namespaces=self.namespaces):
>               for extentity in self.build_maintenance_event(elem):
>                   yield extentity
> +        for elem in control.xpath('eac:conventionDeclaration',
> +                                  namespaces=self.namespaces):
> +            for extentity in self.build_convention(elem):
> +                yield extentity
>   
>       def build_maintenance_event(self, elem):
>           """Parse a `maintenanceEvent` tag, yielding a prov:Activity external
> @@ -917,6 +921,19 @@
>               values['agent'] = set([text_type(agent.text)])
>           yield ExtEntity('Activity', self._gen_extid(), values)
>   
> +    @relate_to_record_through('Convention', 'convention_of')
> +    @add_citations_for('Convention')
> +    @filter_none
> +    @filter_empty
> +    @elem_maybe_none
> +    def build_convention(self, elem):
> +        """Build a `Convention` external entity"""
> +        values = self.parse_tag_description(elem)
> +        abbrev = self._elem_find(elem, 'eac:abbreviation')
> +        if abbrev is not None and abbrev.text:
> +            values['abbrev'] = set([text_type(abbrev.text)])
> +        yield ExtEntity('Convention', self._gen_extid(), values)
> +
>       @elem_maybe_none
>       def parse_event_type(self, elem):
>           """Parse an `eventType` element and try to match a prov:type to build a
> diff -r bb7468172b02 -r b163a3099dd8 cubicweb_eac/i18n/en.po
> --- a/cubicweb_eac/i18n/en.po	Tue Jul 30 17:31:36 2019 +0200
> +++ b/cubicweb_eac/i18n/en.po	Tue Jul 30 17:31:36 2019 +0200
> @@ -72,6 +72,10 @@
>   msgid "Citation"
>   msgstr ""
>   
> +msgctxt "inlined:Convention.has_citation.subject"
> +msgid "Citation"
> +msgstr ""
> +
>   msgctxt "inlined:GeneralContext.has_citation.subject"
>   msgid "Citation"
>   msgstr ""
> @@ -95,6 +99,12 @@
>   msgid "Citation_plural"
>   msgstr "Citations"
>   
> +msgid "Convention"
> +msgstr ""
> +
> +msgid "Convention_plural"
> +msgstr ""
> +
>   msgid "EAC export"
>   msgstr ""
>   
> @@ -234,6 +244,9 @@
>   msgid "New Citation"
>   msgstr "New citation"
>   
> +msgid "New Convention"
> +msgstr ""
> +
>   msgid "New EACOtherRecordId"
>   msgstr "New alternative identifier"
>   
> @@ -298,6 +311,9 @@
>   "EAC-CPF model."
>   msgstr ""
>   
> +msgid "Rules or conventions applied in creating the EAC-CPF instance"
> +msgstr ""
> +
>   msgid "Structure"
>   msgstr "Piece of Structure information"
>   
> @@ -349,6 +365,12 @@
>   msgid "This Citation:"
>   msgstr "This citation:"
>   
> +msgid "This Convention"
> +msgstr ""
> +
> +msgid "This Convention:"
> +msgstr ""
> +
>   msgid "This EACOtherRecordId"
>   msgstr "This alternative identifier"
>   
> @@ -426,6 +448,15 @@
>   
>   # subject and object forms for each relation type
>   # (no object form for final or symmetric relation types)
> +msgid "abbrev"
> +msgstr ""
> +
> +msgctxt "Convention"
> +msgid "abbrev"
> +msgstr ""
> +
> +# subject and object forms for each relation type
> +# (no object form for final or symmetric relation types)
>   msgid "abstract"
>   msgstr ""
>   
> @@ -440,6 +471,9 @@
>   msgid "abstract_format"
>   msgstr ""
>   
> +msgid "add Convention convention_of AuthorityRecord object"
> +msgstr ""
> +
>   msgid "add History has_event HistoricalEvent subject"
>   msgstr ""
>   
> @@ -472,6 +506,10 @@
>   msgid "add a Citation"
>   msgstr ""
>   
> +msgctxt "inlined:Convention.has_citation.subject"
> +msgid "add a Citation"
> +msgstr ""
> +
>   msgctxt "inlined:GeneralContext.has_citation.subject"
>   msgid "add a Citation"
>   msgstr ""
> @@ -492,6 +530,9 @@
>   msgid "add a Citation"
>   msgstr ""
>   
> +msgid "add a Convention"
> +msgstr ""
> +
>   msgid "add a EACOtherRecordId"
>   msgstr "add an alternative identifier"
>   
> @@ -670,6 +711,20 @@
>   "contextual role the address has in relation with the agent (e.g. \"home\")"
>   msgstr ""
>   
> +msgid "convention_of"
> +msgstr ""
> +
> +msgctxt "Convention"
> +msgid "convention_of"
> +msgstr ""
> +
> +msgid "convention_of_object"
> +msgstr ""
> +
> +msgctxt "AuthorityRecord"
> +msgid "convention_of_object"
> +msgstr ""
> +
>   #, python-format
>   msgid "could not parse a year from date element %(e)s"
>   msgstr ""
> @@ -682,6 +737,10 @@
>   msgid "could not parse date from %s"
>   msgstr ""
>   
> +msgid ""
> +"creating Convention (Convention convention_of AuthorityRecord %(linkto)s)"
> +msgstr ""
> +
>   msgid "creating HistoricalEvent (History %(linkto)s has_event HistoricalEvent)"
>   msgstr ""
>   
> @@ -703,6 +762,10 @@
>   msgid "description"
>   msgstr ""
>   
> +msgctxt "Convention"
> +msgid "description"
> +msgstr ""
> +
>   msgctxt "EACResourceRelation"
>   msgid "description"
>   msgstr ""
> @@ -743,6 +806,10 @@
>   msgid "description_format"
>   msgstr ""
>   
> +msgctxt "Convention"
> +msgid "description_format"
> +msgstr ""
> +
>   msgctxt "EACResourceRelation"
>   msgid "description_format"
>   msgstr ""
> @@ -998,6 +1065,10 @@
>   msgid "has_citation"
>   msgstr ""
>   
> +msgctxt "Convention"
> +msgid "has_citation"
> +msgstr ""
> +
>   msgctxt "GeneralContext"
>   msgid "has_citation"
>   msgstr ""
> diff -r bb7468172b02 -r b163a3099dd8 cubicweb_eac/i18n/fr.po
> --- a/cubicweb_eac/i18n/fr.po	Tue Jul 30 17:31:36 2019 +0200
> +++ b/cubicweb_eac/i18n/fr.po	Tue Jul 30 17:31:36 2019 +0200
> @@ -95,9 +95,19 @@
>   msgid "Citation"
>   msgstr ""
>   
> +msgctxt "inlined:Convention.has_citation.subject"
> +msgid "Citation"
> +msgstr "
> +
>   msgid "Citation_plural"
>   msgstr "Citations"
>   
> +msgid "Convention"
> +msgstr ""
> +
> +msgid "Convention_plural"
> +msgstr "Conventions"
> +
>   msgid "EAC export"
>   msgstr "export EAC"
>   
> @@ -237,6 +247,9 @@
>   msgid "New Citation"
>   msgstr "Nouvelle citation"
>   
> +msgid "New Convention"
> +msgstr "Nouvelle convention"
> +
>   msgid "New EACOtherRecordId"
>   msgstr "Nouvel identifiant alternatif"
>   
> @@ -303,6 +316,9 @@
>   "Représente une relation entre une notice et une ressource distante dans le "
>   "modèle EAC-CPF."
>   
> +msgid "Rules or conventions applied in creating the EAC-CPF instance"
> +msgstr "Règles ou conventions a appliquer lors de la création de la notice"
> +
>   msgid "Structure"
>   msgstr "Élément d'organisation interne"
>   
> @@ -354,6 +370,12 @@
>   msgid "This Citation:"
>   msgstr "Cette citation :"
>   
> +msgid "This Convention"
> +msgstr "Cette convention"
> +
> +msgid "This Convention:"
> +msgstr "Cette convention:"
> +
>   msgid "This EACOtherRecordId"
>   msgstr "Cet identifiant alternatif"
>   
> @@ -431,6 +453,13 @@
>   
>   # subject and object forms for each relation type
>   # (no object form for final or symmetric relation types)
> +msgid "abbrev"
> +msgstr ""
> +
> +msgctxt "Convention"
> +msgid "abbrev"
> +msgstr "abbréviation"
> +
>   msgid "abstract"
>   msgstr ""
>   
> @@ -445,6 +474,9 @@
>   msgid "abstract_format"
>   msgstr ""
>   
> +msgid "add Convention convention_of AuthorityRecord object"
> +msgstr "ajouter une convention"
> +
>   msgid "add History has_event HistoricalEvent subject"
>   msgstr "ajouter un événement historique"
>   
> @@ -676,6 +708,20 @@
>   msgstr ""
>   "rôle contextuel de l'adresse vis-à-vis de l'agent (par ex. \"domicile\")"
>   
> +msgid "convention_of"
> +msgstr "convention de"
> +
> +msgctxt "Convention"
> +msgid "convention_of"
> +msgstr "convention de"
> +
> +msgid "convention_of_object"
> +msgstr "Convention de cet objet"
> +
> +msgctxt "AuthorityRecord"
> +msgid "convention_of_object"
> +msgstr "Convention de cette notive"
> +
>   #, python-format
>   msgid "could not parse a year from date element %(e)s"
>   msgstr "ne peux identifier une année dans la date %(e)s"
> @@ -688,6 +734,10 @@
>   msgid "could not parse date from %s"
>   msgstr "impossible de décoder une date à partir de %s"
>   
> +msgid ""
> +"creating Convention (Convention convention_of AuthorityRecord %(linkto)s)"
> +msgstr ""
> +
>   msgid "creating HistoricalEvent (History %(linkto)s has_event HistoricalEvent)"
>   msgstr ""
>   
> @@ -709,6 +759,10 @@
>   msgid "description"
>   msgstr ""
>   
> +msgctxt "Convention"
> +msgid "description"
> +msgstr ""
> +
>   msgctxt "EACResourceRelation"
>   msgid "description"
>   msgstr ""
> @@ -749,6 +803,10 @@
>   msgid "description_format"
>   msgstr ""
>   
> +msgctxt "Convention"
> +msgid "description_format"
> +msgstr ""
> +
>   msgctxt "EACResourceRelation"
>   msgid "description_format"
>   msgstr ""
> @@ -1016,6 +1074,10 @@
>   msgid "has_citation"
>   msgstr ""
>   
> +msgctxt "Convention"
> +msgid "has_citation"
> +msgstr ""
> +
>   msgctxt "GeneralContext"
>   msgid "has_citation"
>   msgstr ""
> diff -r bb7468172b02 -r b163a3099dd8 cubicweb_eac/migration/0.9.0_Any.py
> --- a/cubicweb_eac/migration/0.9.0_Any.py	Tue Jul 30 17:31:36 2019 +0200
> +++ b/cubicweb_eac/migration/0.9.0_Any.py	Tue Jul 30 17:31:36 2019 +0200
> @@ -1,2 +1,3 @@
>   add_attribute('History', 'abstract')
>   add_entity_type('HistoricalEvent')
> +add_entity_type('Convention')
> diff -r bb7468172b02 -r b163a3099dd8 cubicweb_eac/schema.py
> --- a/cubicweb_eac/schema.py	Tue Jul 30 17:31:36 2019 +0200
> +++ b/cubicweb_eac/schema.py	Tue Jul 30 17:31:36 2019 +0200
> @@ -179,6 +179,13 @@
>       fulltext_container = 'object'
>   
>   
> +class convention_of(RelationDefinition):
> +    subject = 'Convention'
> +    object = 'AuthorityRecord'
> +    cardinality = '1*'
> +    composite = 'object'
> +
> +
>   class _agent_relation(RelationDefinition):
>       """Abstract relation between authority record"""
>       subject = None
> @@ -259,6 +266,12 @@
>       description = RichString(fulltextindexed=True)
>   
>   
> +class Convention(EntityType):
> +    "Rules or conventions applied in creating the EAC-CPF instance"
> +    abbrev = String(fulltextindexed=True)
> +    description = RichString(fulltextindexed=True)
> +
> +
>   class History(EntityType):
>       """Biographical or historical information"""
>       abstract = RichString(fulltextindexed=True)
> @@ -348,7 +361,7 @@
>   
>   class has_citation(RelationDefinition):
>       subject = ('GeneralContext', 'Mandate', 'Occupation', 'History',
> -               'AgentFunction', 'LegalStatus', 'AgentPlace')
> +               'AgentFunction', 'LegalStatus', 'AgentPlace', 'Convention')
>       object = 'Citation'
>       cardinality = '*1'
>       composite = 'subject'
> 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
> 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
> +             },
> +            ),
> +            ('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)
> diff -r bb7468172b02 -r b163a3099dd8 test/test_schema.py
> --- a/test/test_schema.py	Tue Jul 30 17:31:36 2019 +0200
> +++ b/test/test_schema.py	Tue Jul 30 17:31:36 2019 +0200
> @@ -101,12 +101,13 @@
>               'AgentPlace': {('place_agent', 'subject'): set(['AuthorityRecord'])},
>               'Citation': {('has_citation', 'object'): set([
>                   'GeneralContext', 'Mandate', 'Occupation', 'AgentFunction',
> -                'AgentPlace', 'History', 'LegalStatus',
> +                'AgentPlace', 'History', 'LegalStatus', 'Convention',
>               ])},
>               'EACOtherRecordId': {('eac_other_record_id_of', 'subject'):
>                                    set(['AuthorityRecord'])},
>               'EACResourceRelation': {('resource_relation_agent', 'subject'):
>                                       set(['AuthorityRecord'])},
> +            'Convention': {('convention_of', 'subject'): set(['AuthorityRecord'])},
>               'EACSource': {('source_agent', 'subject'): set(['AuthorityRecord'])},
>               'HistoricalEvent': {('has_event', 'object'): set(['History'])},
>               'GeneralContext': {('general_context_of', 'subject'): set(['AuthorityRecord'])},
>
> ------------------------------
>
> Message: 2
> Date: Thu, 1 Aug 2019 17:07:52 +0200
> From: Denis Laxalde <denis.laxalde at logilab.fr>
> To: saem-devel at lists.cubicweb.org
> Subject: Re: [PATCH eac] Add support for the <conventionDeclaration>
> 	Tag
> Message-ID: <20190801150752.afyu4a7lfdjii4cd at logilab.fr>
> Content-Type: text/plain; charset=iso-8859-1
>
> 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?
Done in 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.)
Done, I'll check before commiting for the next changesets.
>> +             },
>> +            ),
>> +            ('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)
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> saem-devel mailing list
> saem-devel at lists.cubicweb.org
> http://lists.cubicweb.org/mailman/listinfo/saem-devel
>
>
> ------------------------------
>
> End of saem-devel Digest, Vol 28, Issue 2
> *****************************************



More information about the saem-devel mailing list