def make_reconcile_link_pred(self, label): """ Makes a linking predicate from a given predicate label """ self.label = label pm = PredicateManagement() pm.project_uuid = self.project_uuid pm.source_id = self.source_id pm.data_type = self.data_type pm.sort = self.sort pm.get_make_predicate(label, self.class_uri, self.data_type) self.uuid = pm.predicate.uuid
def make_reconcile_link_pred(self, label): """ Makes a linking predicate from a given predicate label """ self.label = label pm = PredicateManagement() pm.project_uuid = self.project_uuid pm.source_id = self.source_id pm.data_type = self.data_type pm.sort = self.sort pm.get_make_predicate(label, self.class_uri, self.data_type) self.uuid = pm.predicate.uuid
def create_pred_parents(self, new_hierachic_list): """ Creates new types for superior (more general) types from a list of types that have hiearchies implicit in their labels once the superior types are created, linked data annotations noting hierarchy are stored """ parent_children_pairs = [] for manifest in new_hierachic_list: try: oc_pred = Predicate.objects.get(uuid=manifest.uuid) except Predicate.DoesNotExist: oc_pred = False if (oc_pred is not False): child_parts = manifest.label.split(self.HIERARCHY_DELIM) act_delim = '' act_new_label = '' current_parent = False for label_part in child_parts: act_new_label = act_new_label + act_delim + label_part act_delim = self.HIERARCHY_DELIM pred_manage = PredicateManagement() pred_manage.project_uuid = manifest.project_uuid pred_manage.source_id = self.source_id pred_manage.sort = oc_pred.sort pred_manage.data_type = oc_pred.data_type ppred = pred_manage.get_make_predicate( act_new_label, manifest.class_uri) if (ppred is not False and current_parent is not False): parent_child = { 'parent': current_parent, 'child': ppred.uuid } parent_children_pairs.append(parent_child) current_parent = ppred.uuid if (len(parent_children_pairs) > 0): # now make some linked data annotations for parent_child in parent_children_pairs: if (parent_child['parent'] is not False): new_la = LinkAnnotation() new_la.subject = parent_child['child'] new_la.subject_type = 'predicates' new_la.project_uuid = manifest.project_uuid new_la.source_id = self.source_id new_la.predicate_uri = self.p_for_superobjs new_la.object_uri = URImanagement.make_oc_uri( parent_child['parent'], 'predicates') new_la.creator_uuid = '' new_la.save() return parent_children_pairs
def create_pred_parents(self, new_hierachic_list): """ Creates new types for superior (more general) types from a list of types that have hiearchies implicit in their labels once the superior types are created, linked data annotations noting hierarchy are stored """ parent_children_pairs = [] for manifest in new_hierachic_list: try: oc_pred = Predicate.objects.get(uuid=manifest.uuid) except Predicate.DoesNotExist: oc_pred = False if oc_pred is not False: child_parts = manifest.label.split(self.HIERARCHY_DELIM) act_delim = "" act_new_label = "" current_parent = False for label_part in child_parts: act_new_label = act_new_label + act_delim + label_part act_delim = self.HIERARCHY_DELIM pred_manage = PredicateManagement() pred_manage.project_uuid = manifest.project_uuid pred_manage.source_id = self.source_id pred_manage.sort = oc_pred.sort pred_manage.data_type = oc_pred.data_type ppred = pred_manage.get_make_predicate(act_new_label, manifest.class_uri) if ppred is not False and current_parent is not False: parent_child = {"parent": current_parent, "child": ppred.uuid} parent_children_pairs.append(parent_child) current_parent = ppred.uuid if len(parent_children_pairs) > 0: # now make some linked data annotations for parent_child in parent_children_pairs: if parent_child["parent"] is not False: new_la = LinkAnnotation() new_la.subject = parent_child["child"] new_la.subject_type = "predicates" new_la.project_uuid = manifest.project_uuid new_la.source_id = self.source_id new_la.predicate_uri = self.p_for_superobjs new_la.object_uri = URImanagement.make_oc_uri(parent_child["parent"], "predicates") new_la.creator_uuid = "" new_la.save() return parent_children_pairs