[dataimport] Allow to pass rdf_properties to relations_etype callback, closes #3478220

authorVincent Michel <vincent.michel@logilab.fr>
changeset6c910b2d35dd
branchdefault
phasepublic
hiddenno
parent revision#71f14c347a6c Added tag cubicweb-dataio-version-0.3.4 for changeset 3604b841c26b
child revision#57a9d36063bf [interfaces] Protect Librdf blank nodes, closes #3478264
files modified by this revision
dataimport.py
test/import_xy/xy.py
# HG changeset patch
# User Vincent Michel <vincent.michel@logilab.fr>
# Date 1390559795 0
# Fri Jan 24 10:36:35 2014 +0000
# Node ID 6c910b2d35ddf06e49e47106ce4c5c38e71168ed
# Parent 71f14c347a6c4e2ed32767572cee891ac968ac34
[dataimport] Allow to pass rdf_properties to relations_etype callback, closes #3478220

diff --git a/dataimport.py b/dataimport.py
@@ -1131,11 +1131,11 @@
1                  # Get uri relations
2                  uri_rels = set([self.xyreg.normalize_uri(uri_from) for uri_from in uri_rels])
3                  for uri_to in uri_rels:
4                      if build_callback:
5                          # There exists some specific callback for relation construction
6 -                        _etype, _edict = build_callback(uri_to)
7 +                        _etype, _edict = build_callback(uri_to, rdf_properties)
8                          sat_entity = self._internal_create_entity(_etype, _edict)
9                          relation = ( rtype, sat_entity.eid)
10                          if inlined:
11                              relations_data['inlined'].append(relation)
12                          else:
diff --git a/test/import_xy/xy.py b/test/import_xy/xy.py
@@ -55,11 +55,11 @@
13      elif not types and 'dc:subject' in rdf_properties:
14          # At least one roles
15          return 'SubjectManifested'
16 
17 
18 -def _build_name_callback(name):
19 +def _build_name_callback(name, rdf_properties):
20      """ Build a Name entity
21      """
22      return 'Name', {'title': name}
23 
24  def format_isbn(rdf_properties):