コード例 #1
0
ファイル: persons.py プロジェクト: ekansa/open-context-py
 def reconcile_item(self, imp_cell_obj):
     """ Checks to see if the item exists """
     self.imp_cell_obj = imp_cell_obj
     if len(imp_cell_obj.record) > 0:
         self.combined_name = imp_cell_obj.record
         self.label = imp_cell_obj.record
     else:
         pg = ProcessGeneral(self.source_id)
         if self.import_rows is not False:
             check_list = self.import_rows
         else:
             check_list = [imp_cell_obj.row_num]
         self.evenif_blank = pg.check_blank_required(imp_cell_obj.field_num,
                                                     check_list)
         if self.evenif_blank:
             self.combined_name = self.DEFAULT_BLANK
             self.label = self.DEFAULT_BLANK
     if isinstance(self.label, str):
         if len(self.label) > 0:
             match_found = self.match_against_persons(self.combined_name)
             if match_found is False:
                 # create new subject, manifest objects. Need new UUID, since we can't assume
                 # the fl_uuid for the ImportCell reflects unique entities in a field, since
                 # uniqueness depends on context (values in other cells)
                 self.new_entity = True
                 self.uuid = GenUUID.uuid4()
                 self.create_person_item()
     self.update_import_cell_uuid()
コード例 #2
0
 def reconcile_item(self, imp_cell_obj):
     """ Checks to see if the item exists """
     self.imp_cell_obj = imp_cell_obj
     if len(imp_cell_obj.record) > 0:
         self.combined_name = imp_cell_obj.record
         self.label = imp_cell_obj.record
     else:
         pg = ProcessGeneral(self.source_id)
         if self.import_rows is not False:
             check_list = self.import_rows
         else:
             check_list = [imp_cell_obj.row_num]
         self.evenif_blank = pg.check_blank_required(
             imp_cell_obj.field_num, check_list)
         if self.evenif_blank:
             self.combined_name = self.DEFAULT_BLANK
             self.label = self.DEFAULT_BLANK
     if isinstance(self.label, str):
         if len(self.label) > 0:
             match_found = self.match_against_persons(self.combined_name)
             if match_found is False:
                 # create new subject, manifest objects. Need new UUID, since we can't assume
                 # the fl_uuid for the ImportCell reflects unique entities in a field, since
                 # uniqueness depends on context (values in other cells)
                 self.new_entity = True
                 self.uuid = GenUUID.uuid4()
                 self.create_person_item()
     self.update_import_cell_uuid()
コード例 #3
0
 def reconcile_item(self, imp_cell_obj):
     """ Checks to see if the item exists in the subjects table """
     self.imp_cell_obj = imp_cell_obj
     if len(imp_cell_obj.record) > 0:
         self.label = self.label_prefix + imp_cell_obj.record
     else:
         pg = ProcessGeneral(self.source_id)
         if self.import_rows is not False:
             check_list = self.import_rows
         else:
             check_list = [imp_cell_obj.row_num]
         self.evenif_blank = pg.check_blank_required(imp_cell_obj.field_num,
                                                     check_list)
         if self.evenif_blank:
             self.label = self.label_prefix + self.DEFAULT_BLANK
     if self.allow_new and self.label is not False:
         # Only create a new item if it is allowed and if the label is not false
         if len(self.parent_context) > 0:
             self.context = self.parent_context + Subject.HIEARCHY_DELIM + self.label
         else:
             self.context = self.label
         match_found = self.match_against_subjects(self.context)
         if match_found is False:
             # create new subject, manifest objects. Need new UUID, since we can't assume
             # the fl_uuid for the ImportCell reflects unique entities in a field, since
             # uniqueness depends on context (values in other cells)
             self.uuid = GenUUID.uuid4()
             self.create_subject_item()
             self.is_new = True
     else:
         if self.label is not False:
             # only allow matches on non-blank items when not creating a record
             match_found = self.match_against_manifest(self.label,
                                                       self.class_uri)
     self.update_import_cell_uuid()
     self.add_contain_assertion()