Exemple #1
0
 def get_make_string_w_suggested_uuid(self, content, string_uuid=False):
     """ makes a string with a suggested uuid if it does not exist """
     str_man = StringManagement()
     str_man.project_uuid = self.project_uuid
     str_man.source_id = self.source_id
     str_man.suggested_uuid = string_uuid
     str_obj = str_man.get_make_string(content)
     return str_obj
Exemple #2
0
 def get_make_string_w_suggested_uuid(self, content, string_uuid=False):
     """ makes a string with a suggested uuid if it does not exist """
     str_man = StringManagement()
     str_man.project_uuid = self.project_uuid
     str_man.source_id = self.source_id
     str_man.suggested_uuid = string_uuid
     str_obj = str_man.get_make_string(content)
     return str_obj
 def get_make_type_within_pred_uuid(self, predicate_uuid, content):
     """
     gets a type, filtered by a given predicate_uuid and content string
     if a type does not exist, this function creates it, then returns the type
     """
     str_manage = StringManagement()
     str_manage.project_uuid = self.project_uuid
     str_manage.source_id = self.source_id
     str_manage.suggested_uuid = self.suggested_content_uuid
     # get an existing or create a new string object
     oc_string = str_manage.get_make_string(content)
     self.content = content
     self.get_make_type_pred_uuid_content_uuid(predicate_uuid, oc_string.uuid)
     return self.oc_type
Exemple #4
0
 def get_make_type_within_pred_uuid(self, predicate_uuid, content):
     """
     gets a type, filtered by a given predicate_uuid and content string
     if a type does not exist, this function creates it, then returns the type
     """
     str_manage = StringManagement()
     str_manage.project_uuid = self.project_uuid
     str_manage.source_id = self.source_id
     str_manage.suggested_uuid = self.suggested_content_uuid
     # get an existing or create a new string object
     oc_string = str_manage.get_make_string(content)
     self.content = content
     self.get_make_type_pred_uuid_content_uuid(predicate_uuid,
                                               oc_string.uuid)
     return self.oc_type
Exemple #5
0
 def get_make_type_within_pred_uuid(self,
                                    predicate_uuid,
                                    content,
                                    content_suffix_num=1):
     """
     gets a type, filtered by a given predicate_uuid and content string
     if a type does not exist, this function creates it, then returns the type
     """
     original_content = content
     str_manage = StringManagement()
     str_manage.project_uuid = self.project_uuid
     str_manage.source_id = self.source_id
     str_manage.suggested_uuid = self.suggested_content_uuid
     # get an existing or create a new string object
     if content_suffix_num > 1:
         # add a numeric suffix for content, in case we need to
         # increment up to in rare cases when different types have the same string content
         content += ' [' + str(content_suffix_num) + ']'
     oc_string = str_manage.get_make_string(content)
     self.content = content
     self.get_make_type_pred_uuid_content_uuid(predicate_uuid,
                                               oc_string.uuid)
     if self.sup_reconcile_key is not None and\
        self.sup_reconcile_value is not None:
         # checks to see if the manifest supplemental JSON has a matching key, value pair
         # this lets us further constrain reconciliation, say with FAIMS attributes (types)
         man_obj = False
         try:
             man_obj = Manifest.objects.get(uuid=self.oc_type.uuid)
         except Manifest.DoesNotExist:
             man_obj = False
         if man_obj is not False:
             match_ok = man_obj.check_sup_json_key_value(
                 self.sup_reconcile_key, self.sup_reconcile_value)
             if match_ok is False:
                 self.oc_type = False
                 content_suffix_num += 1
                 if content_suffix_num <= 10:
                     # so we don't get into endless loops
                     self.oc_type = self.get_make_type_within_pred_uuid(
                         predicate_uuid, original_content,
                         content_suffix_num)
     return self.oc_type
Exemple #6
0
 def get_make_type_within_pred_uuid(self,
                                    predicate_uuid,
                                    content,
                                    content_suffix_num=1):
     """
     gets a type, filtered by a given predicate_uuid and content string
     if a type does not exist, this function creates it, then returns the type
     """
     original_content = content
     str_manage = StringManagement()
     str_manage.project_uuid = self.project_uuid
     str_manage.source_id = self.source_id
     str_manage.suggested_uuid = self.suggested_content_uuid
     # get an existing or create a new string object
     if content_suffix_num > 1:
         # add a numeric suffix for content, in case we need to
         # increment up to in rare cases when different types have the same string content
         content += ' [' + str(content_suffix_num) + ']'
     oc_string = str_manage.get_make_string(content)
     self.content = content
     self.get_make_type_pred_uuid_content_uuid(predicate_uuid, oc_string.uuid)
     if self.sup_reconcile_key is not None and\
        self.sup_reconcile_value is not None:
         # checks to see if the manifest supplemental JSON has a matching key, value pair
         # this lets us further constrain reconciliation, say with FAIMS attributes (types) 
         man_obj = False
         try:
             man_obj = Manifest.objects.get(uuid=self.oc_type.uuid)
         except Manifest.DoesNotExist:
             man_obj = False
         if man_obj is not False:
             match_ok = man_obj.check_sup_json_key_value(self.sup_reconcile_key,
                                                         self.sup_reconcile_value)
             if match_ok is False:
                 self.oc_type = False
                 content_suffix_num += 1
                 if content_suffix_num <= 10:
                     # so we don't get into endless loops
                     self.oc_type = self.get_make_type_within_pred_uuid(predicate_uuid,
                                                                        original_content,
                                                                        content_suffix_num)
     return self.oc_type