def translate_value(_segment, _value_node, _value): session = core.Kernel.session() v_node = sc_utils.createNodeElement(session, _segment, sc.SC_CONST) sheaf = sc_utils.createPairBinaryOrient(session, _segment, v_node, _value_node, sc.SC_CONST) sc_utils.createPairPosPerm(session, _segment, keynodes.common.nrel_value, sheaf, sc.SC_CONST) vu_node = sc_utils.createNodeElement(session, _segment, sc.SC_CONST) a = sc_utils.createPairPosPerm(session, _segment, v_node, vu_node, sc.SC_CONST) sc_utils.createPairPosPerm(session, _segment, geom_keynodes.Relation.rrel_cm2, a, sc.SC_CONST) # make identification idtf_node = sc_utils.createNodeSheaf(session, _segment, sc.SC_CONST) sheaf = sc_utils.createPairBinaryOrient(session, _segment, idtf_node, vu_node, sc.SC_CONST) sc_utils.createPairPosPerm(session, _segment, keynodes.common.nrel_identification, sheaf, sc.SC_CONST) # set value val = sc_utils.createNodeElement(session, _segment, sc.SC_CONST) sc_utils.setContentReal(session, _segment, val, _value) a = sc_utils.createPairPosPerm(session, _segment, idtf_node, val, sc.SC_CONST) sc_utils.createPairPosPerm(session, _segment, keynodes.common.rrel_dec_number, a, sc.SC_CONST)
def translate_value(session, _segment, _value_node, _value): """Setup value \p _value to \p _value_node @return: Return list of creates sc-elements """ v_node = sc_utils.createNodeElement(session, _segment, sc.SC_CONST) bin_pair = sc_utils.createPairBinaryOrientFull(session, _segment, v_node, _value_node, sc.SC_CONST) a = sc_utils.createPairPosPerm(session, _segment, keynodes.common.nrel_value, bin_pair[0], sc.SC_CONST) res = [v_node, a, keynodes.common.nrel_value] res.extend(bin_pair) vu_node = sc_utils.createNodeElement(session, _segment, sc.SC_CONST) a = sc_utils.createPairPosPerm(session, _segment, v_node, vu_node, sc.SC_CONST) res.extend([vu_node, a]) # make identification idtf_node = sc_utils.createNodeSheaf(session, _segment, sc.SC_CONST) bin_pair = sc_utils.createPairBinaryOrientFull(session, _segment, idtf_node, vu_node, sc.SC_CONST) a = sc_utils.createPairPosPerm(session, _segment, keynodes.common.nrel_identification, bin_pair[0], sc.SC_CONST) res.extend([idtf_node, a, keynodes.common.nrel_identification]) res.extend(bin_pair) # set value val = sc_utils.createNodeElement(session, _segment, sc.SC_CONST) sc_utils.setContentReal(session, _segment, val, _value) a = sc_utils.createPairPosPerm(session, _segment, idtf_node, val, sc.SC_CONST) a1 = sc_utils.createPairPosPerm(session, _segment, keynodes.common.rrel_dec_number, a, sc.SC_CONST) res.extend([val, a, a1, keynodes.common.rrel_dec_number]) return res