equal
deleted
inserted
replaced
78 def _parse_entity_etree(parent): |
78 def _parse_entity_etree(parent): |
79 for node in list(parent): |
79 for node in list(parent): |
80 try: |
80 try: |
81 item = {'cwtype': unicode(node.tag), |
81 item = {'cwtype': unicode(node.tag), |
82 'cwuri': node.attrib['cwuri'], |
82 'cwuri': node.attrib['cwuri'], |
|
83 'cwsource': node.attrib.get('cwsource'), |
83 'eid': typed_eid(node.attrib['eid']), |
84 'eid': typed_eid(node.attrib['eid']), |
84 } |
85 } |
85 except KeyError: |
86 except KeyError: |
86 # cw < 3.11 compat mode XXX |
87 # cw < 3.11 compat mode XXX |
87 item = {'cwtype': unicode(node.tag), |
88 item = {'cwtype': unicode(node.tag), |
88 'cwuri': node.find('cwuri').text, |
89 'cwuri': node.find('cwuri').text, |
|
90 'cwsource': None, |
89 'eid': typed_eid(node.find('eid').text), |
91 'eid': typed_eid(node.find('eid').text), |
90 } |
92 } |
91 rels = {} |
93 rels = {} |
92 for child in node: |
94 for child in node: |
93 role = child.get('role') |
95 role = child.get('role') |
200 # XXX suppression support according to source configuration. If set, get all |
202 # XXX suppression support according to source configuration. If set, get all |
201 # cwuri of entities from this source, and compare with newly imported ones |
203 # cwuri of entities from this source, and compare with newly imported ones |
202 |
204 |
203 def process_item(self, item, rels): |
205 def process_item(self, item, rels): |
204 entity = self.extid2entity(str(item.pop('cwuri')), item.pop('cwtype'), |
206 entity = self.extid2entity(str(item.pop('cwuri')), item.pop('cwtype'), |
205 item=item) |
207 cwsource=item.pop('cwsource'), item=item) |
206 if entity is None: |
208 if entity is None: |
207 return None |
209 return None |
208 if entity.eid in self._processed_entities: |
210 if entity.eid in self._processed_entities: |
209 return entity |
211 return entity |
210 self._processed_entities.add(entity.eid) |
212 self._processed_entities.add(entity.eid) |