[PATCH eac V5] Add support for <functionRelation> in <cpfRelation>

Guillaume Vandevelde guillaume.vandevelde at logilab.fr
Mon Aug 12 14:17:46 CEST 2019


# HG changeset patch
# User Guillaume Vandevelde <gvandevelde at logilab.fr>
# Date 1564500697 -7200
#      Tue Jul 30 17:31:37 2019 +0200
# Node ID 7f368a4aff38e7c176c27d808a51d8be2d3b4c0b
# Parent  8abcfe4e3ba441a6d5d5e5666b413961b8c22246
# Available At http://hg.logilab.org/review/cubes/eac
#              hg pull http://hg.logilab.org/review/cubes/eac -r 7f368a4aff38
Add support for <functionRelation> in <cpfRelation>

Create a new entity EACFunctionRelation similar to EACRessourceRelation.

diff -r 8abcfe4e3ba4 -r 7f368a4aff38 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:37 2019 +0200
@@ -40,11 +40,11 @@
 TYPE_MAPPING['human'] = u'person'
 
 ETYPES_ORDER_HINT = ('AgentKind', 'PhoneNumber', 'PostalAddress', 'AuthorityRecord',
-                     'Convention', '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', 'EACFunctionRelation',
+                     'ExternalUri', 'EACSource', 'Activity')
 
 
 class InvalidEAC(RuntimeError):
@@ -773,7 +773,8 @@
         if relations is None:
             return
         builders = (('eac:cpfRelation', self.build_relation),
-                    ('eac:resourceRelation', self.build_resource_relation),)
+                    ('eac:resourceRelation', self.build_resource_relation),
+                    ('eac:functionRelation', self.build_function_relation),)
         for xpath, builder in builders:
             for elem in self._elem_findall(relations, xpath):
                 for extentity in builder(elem):
@@ -836,6 +837,43 @@
         values.update(self.parse_tag_description(elem))
         yield ExtEntity(etype, self._gen_extid(), values)
 
+    @add_xml_wrap_for('EACFunctionRelation')
+    def build_function_relation(self, elem):
+        """Build a relation between function entities
+
+        yield an ExternalUri object, and an EACFunctionRelation
+        object that make the link between the ExternalUri and
+        the AuthorityRecord object"""
+        obj_uri = None
+        relationship = None
+        values = self.parse_tag_description(elem)
+        if elem.attrib.get('functionRelationType'):
+            relationship = elem.attrib.pop('functionRelationType')
+        if elem.attrib.get('{%(xlink)s}href' % self.namespaces):
+            obj_uri = elem.attrib.pop('{%(xlink)s}href' % self.namespaces)
+        # Yield the ExternalUri object
+        if obj_uri:
+            yield external_uri(obj_uri)
+            values.update(
+                {'function_relation_function': set([text_type(obj_uri)])})
+        dates = self.parse_daterange(
+            self._elem_find(elem, 'eac:dateRange'))
+        if dates:
+            values.update(dates)
+        if relationship:
+            values.update({'r_type': set([text_type(relationship)])})
+        values.update({
+            'function_relation_agent': set([text_type(self.record.extid)]),
+        })
+        values.update(self.values_from_xpaths(
+            elem,
+            (('place_entry', 'eac:placeEntry'),
+             ('relation_entry', 'eac:relationEntry'))))
+        attrib = {k: v for (k, v) in dict(elem.attrib).items()}
+        if attrib:
+            values.update({'attributes': set([text_type(attrib)])})
+        yield ExtEntity('EACFunctionRelation', self._gen_extid(), values)
+
     @add_xml_wrap_for('EACResourceRelation')
     def build_resource_relation(self, elem):
         """Build a `EACResourceRelation` external entity (along with
diff -r 8abcfe4e3ba4 -r 7f368a4aff38 cubicweb_eac/entities.py
--- a/cubicweb_eac/entities.py	Tue Jul 30 17:31:36 2019 +0200
+++ b/cubicweb_eac/entities.py	Tue Jul 30 17:31:37 2019 +0200
@@ -134,6 +134,24 @@
                  'to': resource_title})
 
 
+class EACFunctionRelation(AnyEntity):
+    __regid__ = 'EACFunctionRelation'
+    fetch_attrs, cw_fetch_order = fetch_config(('r_type',
+                                                'description',
+                                                'relation_entry',
+                                                'place_entry',
+                                                'attributes',))
+
+    @property
+    def record(self):
+        return self.function_relation_agent[0]
+
+    @property
+    def resource(self):
+        if self.function_relation_function:
+            return self.function_relation_function[0]
+
+
 class SameAsMixIn(object):
     """Mix-in class for entity types supporting vocabulary_source and
     equivalent_concept relations.
diff -r 8abcfe4e3ba4 -r 7f368a4aff38 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:37 2019 +0200
@@ -1592,3 +1592,45 @@
 msgctxt "HierarchicalRelation"
 msgid "xml_wrap"
 msgstr ""
+
+msgid "EACFunctionRelation"
+msgstr "EAC function relation"
+
+msgid "EACFunctionRelation_plural"
+msgstr "EAC function relations"
+
+msgid "New EACFunctionRelation"
+msgstr "New EAC function relation"
+
+msgid "This EACFunctionRelation"
+msgstr ""
+
+msgid "This EACFunctionRelation:"
+msgstr ""
+
+msgid "add a EACFunctionRelation"
+msgstr "Add an EAC Function relation"
+
+msgctxt "EACFunctionRelation"
+msgid "r_type"
+msgstr "Relation type"
+
+msgctxt "EACFunctionRelation"
+msgid "description"
+msgstr ""
+
+msgctxt "EACFunctionRelation"
+msgid "relation_entry"
+msgstr ""
+
+msgctxt "EACFunctionRelation"
+msgid "function_relation_function"
+msgstr ""
+
+msgctxt "EACFunctionRelation"
+msgid "function_relation_agent"
+msgstr ""
+
+msgctxt "EACFunctionRelation"
+msgid "xml_wrap"
+msgstr ""
diff -r 8abcfe4e3ba4 -r 7f368a4aff38 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:37 2019 +0200
@@ -133,6 +133,12 @@
 msgid "EACResourceRelation_plural"
 msgstr "Relations vers une ressource EAC"
 
+msgid "EACFunctionRelation"
+msgstr "Relation vers une fonction reliée à la notice EAC"
+
+msgid "EACFunctionRelation_plural"
+msgstr "Relation vers une fonction reliée à la notice EAC"
+
 msgid "EACSource"
 msgstr "Source"
 
@@ -256,6 +262,9 @@
 msgid "New EACResourceRelation"
 msgstr "Nouvelle relation vers une ressource"
 
+msgid "New EACFunctionRelation"
+msgstr "Nouvelle fonction reliée à une ressource"
+
 msgid "New EACSource"
 msgstr "Nouvelle source"
 
@@ -388,6 +397,12 @@
 msgid "This EACResourceRelation:"
 msgstr ""
 
+msgid "This EACFunctionRelation"
+msgstr ""
+
+msgid "This EACFunctionRelation:"
+msgstr ""
+
 msgid "This EACSource"
 msgstr "Cette source"
 
@@ -542,6 +557,9 @@
 msgid "add a EACResourceRelation"
 msgstr ""
 
+msgid "add a EACFunctionRelation"
+msgstr "Ajouter une function reliée à cette notice"
+
 msgid "add a EACSource"
 msgstr "ajouter une source"
 
@@ -612,6 +630,18 @@
 msgid "agent_role"
 msgstr ""
 
+msgctxt "EACFunctionRelation"
+msgid "r_type"
+msgstr "Type de la relation"
+
+msgctxt "EACFunctionRelation"
+msgid "description"
+msgstr ""
+
+msgctxt "EACFunctionRelation"
+msgid "relation_entry"
+msgstr "Libellé de la relation"
+
 msgid "alternative"
 msgstr "alternative"
 
@@ -1366,6 +1396,14 @@
 msgid "resource_relation_agent"
 msgstr "notice"
 
+msgctxt "EACFunctionRelation"
+msgid "function_relation_function"
+msgstr ""
+
+msgctxt "EACFunctionRelation"
+msgid "function_relation_agent"
+msgstr ""
+
 msgctxt "EACResourceRelation"
 msgid "resource_relation_agent"
 msgstr ""
@@ -1603,6 +1641,10 @@
 msgid "xml_wrap"
 msgstr ""
 
+msgctxt "EACFunctionRelation"
+msgid "xml_wrap"
+msgstr ""
+
 msgctxt "EACSource"
 msgid "xml_wrap"
 msgstr ""
diff -r 8abcfe4e3ba4 -r 7f368a4aff38 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:37 2019 +0200
@@ -1,3 +1,4 @@
 add_attribute('History', 'abstract')
 add_entity_type('HistoricalEvent')
 add_entity_type('Convention')
+add_entity_type('EACFunctionRelation')
diff -r 8abcfe4e3ba4 -r 7f368a4aff38 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:37 2019 +0200
@@ -371,6 +371,35 @@
 
 @xml_wrap
 @dated_entity_type
+class EACFunctionRelation(EntityType):
+    """Represent a relation between an AuthorityRecord and a function"""
+    r_type = String(internationalizable=True,
+                    description=_('type of relation the function has '
+                                  'with the Authority'))
+    description = RichString(fulltextindexed=True)
+    relation_entry = String(fulltextindexed=True)
+    place_entry = String(fulltextindexed=True)
+    attributes = String(fulltextindexed=True)
+
+
+class function_relation_agent(RelationDefinition):
+    subject = 'EACFunctionRelation'
+    object = 'AuthorityRecord'
+    cardinality = '1*'
+    inlined = True
+    composite = 'object'
+    fulltext_container = 'object'
+
+
+class function_relation_function(RelationDefinition):
+    subject = 'EACFunctionRelation'
+    object = 'ExternalUri'
+    cardinality = '?*'
+    inlined = True
+
+
+ at xml_wrap
+ at dated_entity_type
 class EACResourceRelation(EntityType):
     """Represent a relation between an AuthorityRecord and a remote resource in the
     EAC-CPF model.
diff -r 8abcfe4e3ba4 -r 7f368a4aff38 test/data/FRAD033_EAC_00001_simplified.xml
--- a/test/data/FRAD033_EAC_00001_simplified.xml	Tue Jul 30 17:31:36 2019 +0200
+++ b/test/data/FRAD033_EAC_00001_simplified.xml	Tue Jul 30 17:31:37 2019 +0200
@@ -261,7 +261,6 @@
       </cpfRelation>
 
       <cpfRelation cpfRelationType="associative" xlink:href="agent-x" xlink:type="simple"></cpfRelation>
-
       <resourceRelation resourceRelationType="creatorOf"
         xmlns:xlink="http://www.w3.org/1999/xlink" 
         xlink:href="http://gael.gironde.fr/ead.html?id=FRAD033_IR_N" xlink:type="simple" xlink:role="Fonds d'archives" xlink:show="new" xlink:actuate="onRequest">
@@ -271,7 +270,89 @@
           <toDate>1963</toDate>
         </dateRange>
       </resourceRelation>
-      
+      <functionRelation
+	  functionRelationType="performs"
+	  xlink:href="http://gael.gironde.fr/ead.html?id=FRAD033_IR_N"
+	  xlink:actuate="onLoad"
+	  xlink:arcrole="http://test_arcrole.lol.com"
+	  xlink:role="http://test_role.lmao.com">
+	<relationEntry>Alumni communication
+	management, University of
+	Glasgow
+	</relationEntry>
+	<descriptiveNote>
+	  <p>The management of the University's
+	  communication with its alumni.
+	  </p>
+	</descriptiveNote>
+	<objectXMLWrap>
+	  <mods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+		xsi:schemaLocation="http://www.loc.gov/mods/v3 http:
+				    //www.loc.gov/mods/v3/mods-3-3.xsd">
+	    <titleInfo>
+	      <title>Artisti trentini tra le due
+	      guerre
+	      </title>
+	    </titleInfo>
+	    <name>
+	      <namePart
+		  type="given">Nicoletta
+	      </namePart>
+	      <namePart
+		  type="family">Boschiero
+	      </namePart>
+	      <role>
+		<roleTerm
+		    type="text">autore
+		</roleTerm>
+	      </role>
+	    </name>
+	  </mods>
+	</objectXMLWrap>
+      </functionRelation>
+      <functionRelation
+	  functionRelationType="controls"
+	  xlink:href="FRAD033_IR_N">
+	<dateRange>
+          <fromDate standardDate="1922">1922</fromDate>
+          <toDate standardDate="2001">2001</toDate>
+          </dateRange>
+	<relationEntry>Establishment and abolishment
+	of schools
+	</relationEntry>
+	<descriptiveNote>
+	  <p>The second responsibility of the
+	  Department is to control the establishment
+	  and abolishment of schools.
+	  </p>
+	</descriptiveNote>
+      </functionRelation>
+      <functionRelation
+            xlink:href="ONLY_XLINK">
+          <dateRange>
+          <fromDate standardDate="1922">1922</fromDate>
+          <toDate standardDate="2001">2001</toDate>
+          </dateRange>
+          <relationEntry>Some relation entry
+          </relationEntry>
+          <descriptiveNote>
+            <p>Some description
+            </p>
+          </descriptiveNote>
+      </functionRelation>
+      <functionRelation
+            functionRelationType="ONLY_RELATION_TYPE">
+          <dateRange>
+          <fromDate standardDate="1922">1922</fromDate>
+          <toDate standardDate="2001">2001</toDate>
+          </dateRange>
+          <relationEntry>Some relation entry
+          </relationEntry>
+          <descriptiveNote>
+            <p>Some description
+            </p>
+          </descriptiveNote>
+      </functionRelation>
       
     </relations>
 
diff -r 8abcfe4e3ba4 -r 7f368a4aff38 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:37 2019 +0200
@@ -390,6 +390,87 @@
               'xml_wrap': set(['<he xmlns="urn:isbn:1-931666-33-4" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">joe</he>']),  # noqa
              },
             ),
+            ('EACFunctionRelation', _gen_extid(),
+             {'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">The management of the University'
+                                  '\'s\n\t  communication with its alumni.\n\t  </p>']),
+              'r_type': [u'performs'],
+              'description_format': set([u'text/html']),
+              'function_relation_agent': set([u'FRAD033_EAC_00001']),
+              'function_relation_function': set([u'http://gael.gironde.fr/ead.html?'
+                                                 'id=FRAD033_IR_N']),
+              'relation_entry': set([u'Alumni communication\n\tmanagement, '
+                                     'University of\n\tGlasgow\n\t']),
+              'xml_wrap': set(['<mods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
+                               u' xmlns="urn:isbn:1-931666-33-4" xmlns:xlink="http://www.w3'
+                               u'.org/1999/xlink" xsi:schemaLocation="http://www.loc.gov'
+                               u'/mods/v3 http:         //www.loc.gov/mods/v3/mods-3-3.xsd'
+                               u'">\n\t    <titleInfo>\n\t      <title>Artisti trentini'
+                               u' tra le due\n\t      guerre\n\t      </title>\n\t    </titleInfo'
+                               u'>\n\t    <name>\n\t      <namePart type="given">Nicoletta'
+                               u'\n\t      </namePart>\n\t      <namePart type="family'
+                               u'">Boschiero\n\t      </namePart>\n\t      <role>\n\t\t<roleTerm'
+                               u' type="text">autore\n\t\t</roleTerm>\n\t      </role>\n\t'
+                               u'    </name>\n\t  </mods>\n\t']),
+              'attributes': set([u"{'{http://www.w3.org/1999/xlink}actuate': 'onLoad',"
+                                 u" '{http://www.w3.org/1999/xlink}arcrole': 'http://test"
+                                 u"_arcrole.lol.com', '{http://www.w3.org/1999/xlink}role"
+                                 u"': 'http://test_role.lmao.com'}"])
+             },
+            ),
+            ('EACFunctionRelation', _gen_extid(),
+             {'function_relation_function': set([u'FRAD033_IR_N']),
+              'function_relation_agent': set([u'FRAD033_EAC_00001']),
+              '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">'
+                                  'The second responsibility of the\n\t  '
+                                  'Department is to control the establishment\n\t  '
+                                  'and abolishment of schools.\n\t  </p>']),
+              'end_date': set([datetime.date(2001, 1, 1)]),
+              'r_type': set([u'controls']),
+              'description_format': set([u'text/html']),
+              'relation_entry': set([u'Establishment and abolishment\n\tof schools\n\t']),
+              'start_date': set([datetime.date(1922, 1, 1)])
+             },
+            ),
+            ('EACFunctionRelation', _gen_extid(),
+             {'function_relation_agent': set([u'FRAD033_EAC_00001']),
+              'description': set([u'<p xmlns="urn:isbn:1-931666-33-4" '
+                                  u'xmlns:xsi="http://www.w3.org/2001/X'
+                                  u'MLSchema-instance" xmlns:xlink="http://ww'
+                                  u'w.w3.org/1999/xlink">Some description'
+                                  u'\n            </p>']),
+              'function_relation_function': set([u'ONLY_XLINK']),
+              'end_date': set([datetime.date(2001, 1, 1)]),
+              'description_format': set([u'text/html']),
+              'relation_entry': set([u'Some relation entry\n          ']),
+              'start_date': set([datetime.date(1922, 1, 1)])
+             },
+            ),
+            ('EACFunctionRelation', _gen_extid(),
+             {'function_relation_agent': set([u'FRAD033_EAC_00001']),
+              'description': set([u'<p xmlns="urn:isbn:1-931666-33-4" '
+                                  u'xmlns:xsi="http://www.w3.org/2001/X'
+                                  u'MLSchema-instance" xmlns:xlink="http://ww'
+                                  u'w.w3.org/1999/xlink">Some description'
+                                  u'\n            </p>']),
+              'r_type': set([u'ONLY_RELATION_TYPE']),
+              'end_date': set([datetime.date(2001, 1, 1)]),
+              'description_format': set([u'text/html']),
+              'relation_entry': set([u'Some relation entry\n          ']),
+              'start_date': set([datetime.date(1922, 1, 1)])
+             },
+            ),
+            ('ExternalUri', 'ONLY_XLINK',
+             {'uri': set([u'ONLY_XLINK']),
+              'cwuri': set([u'ONLY_XLINK'])},
+            ),
+            ('ExternalUri', 'FRAD033_IR_N',
+             {'uri': set([u'FRAD033_IR_N']),
+              'cwuri': set([u'FRAD033_IR_N'])},
+            ),
             ('ExternalUri', 'http://gael.gironde.fr/ead.html?id=FRAD033_IR_N',
              {'uri': set([u'http://gael.gironde.fr/ead.html?id=FRAD033_IR_N']),
               'cwuri': set([u'http://gael.gironde.fr/ead.html?id=FRAD033_IR_N'])},
@@ -559,7 +640,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), 51)
             self.assertEqual(updated, set())
             rset = cnx.find('AuthorityRecord', isni=u'22330001300016')
             self.assertEqual(len(rset), 1)
@@ -666,7 +747,42 @@
         self.assertEqual(exturi.uri,
                          u'http://gael.gironde.fr/ead.html?id=FRAD033_IR_N')
         self.assertEqual(rrelation.xml_wrap.getvalue(),
-                         '<he xmlns="urn:isbn:1-931666-33-4" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">joe</he>')  # noqa
+                         u'<he xmlns="urn:isbn:1-931666-33-4" xmlns:xlink="http'
+                         u'://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org'
+                         u'/2001/XMLSchema-instance">joe</he>')
+        rset = cnx.find('EACFunctionRelation', r_type=u'performs')
+        func_relation = rset.one()
+        self.assertEqual(func_relation.attributes,
+                         u"{'{http://www.w3.org/1999/xlink}actuate': 'onLoad', "
+                         u"'{http://www.w3.org/1999/xlink}arcrole': 'http://test_arcrole.lol.com',"
+                         u" '{http://www.w3.org/1999/xlink}role': 'http://test_role.lmao.com'}")
+        self.assertEqual(func_relation.relation_entry,
+                         u'Alumni communication\n\tmanagement, '
+                         'University of\n\tGlasgow\n\t')
+        self.assertEqual(func_relation.xml_wrap.getvalue(),
+                         u'<mods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
+                         u' xmlns="urn:isbn:1-931666-33-4" xmlns:xlink="http://www.w3'
+                         u'.org/1999/xlink" xsi:schemaLocation="http://www.loc.gov'
+                         u'/mods/v3 http:         //www.loc.gov/mods/v3/mods-3-3.xsd'
+                         u'">\n\t    <titleInfo>\n\t      <title>Artisti trentini tra'
+                         u' le due\n\t      guerre\n\t      </title>\n\t    </titleInfo>\n'
+                         u'\t    <name>\n\t      <namePart type="given">Nicoletta\n\t'
+                         u'      </namePart>\n\t      <namePart type="family">Boschiero\n'
+                         u'\t      </namePart>\n\t      <role>\n\t\t<roleTerm type="text'
+                         u'">autore\n\t\t</roleTerm>\n\t      </role>\n\t    </name>\n\t'
+                         u'  </mods>\n\t')
+        self.assertEqual(func_relation.function_relation_agent[0], record)
+        self.assertEqual(func_relation.function_relation_function[0].uri,
+                         u'http://gael.gironde.fr/ead.html?id=FRAD033_IR_N')
+        rset = cnx.find('EACFunctionRelation', r_type=u'controls')
+        func_relation = rset.one()
+        self.assertEqual(func_relation.function_relation_agent[0], record)
+        self.assertEqual(func_relation.function_relation_function[0].uri,
+                         u'FRAD033_IR_N')
+        self.assertEqual(func_relation.start_date,
+                         datetime.date(1922, 1, 1))
+        self.assertEqual(func_relation.end_date,
+                         datetime.date(2001, 1, 1))
 
     def _check_equivalent_concept(self, cnx, record):
         functions = dict((f.name, f) for f in record.reverse_function_agent)
diff -r 8abcfe4e3ba4 -r 7f368a4aff38 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:37 2019 +0200
@@ -103,6 +103,8 @@
                 'GeneralContext', 'Mandate', 'Occupation', 'AgentFunction',
                 'AgentPlace', 'History', 'LegalStatus', 'Convention',
             ])},
+            'EACFunctionRelation': {('function_relation_agent', 'subject'):
+                                    set(['AuthorityRecord'])},
             'EACOtherRecordId': {('eac_other_record_id_of', 'subject'):
                                  set(['AuthorityRecord'])},
             'EACResourceRelation': {('resource_relation_agent', 'subject'):


More information about the saem-devel mailing list