def loadTargets(): global targets targets = {} for key in keynodes.listOfObjects: it = session.create_iterator(session.sc_constraint_new(sc_constants.CONSTR_3_f_a_a, key, sc.SC_A_CONST | sc.SC_POS, sc.SC_CONST | sc.SC_NODE ), True) while not it.is_over(): idtf = session.get_idtf(it.value(2)).lower() targets[idtf] = [[it.value(2),baseKoef]] #print "[Object basic] %s" % idtf syns = sc_utils.searchBinPairsAttrToNode(session,it.value(2),keynodes.nrel_identification,sc.SC_CONST) for syn in syns: it2 = session.create_iterator(session.sc_constraint_new(sc_constants.CONSTR_3_f_a_a, syn, sc.SC_A_CONST | sc.SC_POS, sc.SC_CONST | sc.SC_NODE ), True) while not it2.is_over(): idtf = session.get_content_str(it2.value(2)) if idtf is not None: targets[idtf.lower()] = [[it.value(2),baseKoef]] #print "[Object alter] %s" % idtf it2.next() it.next()
def loadTargets(): global targets targets = {} for key in keynodes.listOfObjects: it = session.create_iterator( session.sc_constraint_new(sc_constants.CONSTR_3_f_a_a, key, sc.SC_A_CONST | sc.SC_POS, sc.SC_CONST | sc.SC_NODE), True) while not it.is_over(): idtf = session.get_idtf(it.value(2)).lower() targets[idtf] = [[it.value(2), baseKoef]] #print "[Object basic] %s" % idtf syns = sc_utils.searchBinPairsAttrToNode( session, it.value(2), keynodes.nrel_identification, sc.SC_CONST) for syn in syns: it2 = session.create_iterator( session.sc_constraint_new(sc_constants.CONSTR_3_f_a_a, syn, sc.SC_A_CONST | sc.SC_POS, sc.SC_CONST | sc.SC_NODE), True) while not it2.is_over(): idtf = session.get_content_str(it2.value(2)) if idtf is not None: targets[idtf.lower()] = [[it.value(2), baseKoef]] #print "[Object alter] %s" % idtf it2.next() it.next()
def loadPatterns(self): self.questionPatterns = {} it = session.create_iterator( session.sc_constraint_new(sc_constants.CONSTR_3_f_a_a, keynodes.questions_types, sc.SC_A_CONST | sc.SC_POS, sc.SC_CONST | sc.SC_NODE), True) #questions = [] print "[scan questions]" while not it.is_over(): #questions.append(it.value(2)) qIdtf = session.get_idtf(it.value(2)) print "[scan] %s" % qIdtf syns = sc_utils.searchBinPairsAttrToNode( session, it.value(2), keynodes.nrel_identification, sc.SC_CONST) altqIdtf = None for syn in syns: it3 = session.create_iterator( session.sc_constraint_new(sc_constants.CONSTR_5_f_a_a_a_f, syn, sc.SC_A_CONST | sc.SC_POS, sc.SC_CONST | sc.SC_NODE, sc.SC_A_CONST | sc.SC_POS, keynodes.rrel_nl_idtf), True) while not it3.is_over(): altqIdtf = session.get_content_str(it3.value(2)) it3.next() els = sc_utils.searchBinPairsAttrToNode(session, it.value(2), keynodes.nrel_pattern, sc.SC_CONST) for el in els: it2 = session.create_iterator( session.sc_constraint_new(sc_constants.CONSTR_3_f_a_a, el, sc.SC_A_CONST | sc.SC_POS, sc.SC_CONST | sc.SC_NODE), True) while not it2.is_over(): if altqIdtf is None: altqIdtf = "XXX" self.questionPatterns[altqIdtf] = it.value(2) pattern = altqIdtf + " = " + session.get_content_str( it2.value(2)) self.addNewPattern(pattern) it2.next() it.next()
def loadPatterns(self): self.questionPatterns = {} it = session.create_iterator(session.sc_constraint_new(sc_constants.CONSTR_3_f_a_a, keynodes.questions_types, sc.SC_A_CONST | sc.SC_POS, sc.SC_CONST | sc.SC_NODE ), True) #questions = [] print "[scan questions]" while not it.is_over(): #questions.append(it.value(2)) qIdtf = session.get_idtf(it.value(2)) print "[scan] %s" % qIdtf syns = sc_utils.searchBinPairsAttrToNode(session,it.value(2),keynodes.nrel_identification,sc.SC_CONST) altqIdtf = None for syn in syns: it3 = session.create_iterator(session.sc_constraint_new(sc_constants.CONSTR_5_f_a_a_a_f, syn, sc.SC_A_CONST | sc.SC_POS, sc.SC_CONST | sc.SC_NODE, sc.SC_A_CONST | sc.SC_POS, keynodes.rrel_nl_idtf ), True) while not it3.is_over(): altqIdtf = session.get_content_str(it3.value(2)) it3.next() els = sc_utils.searchBinPairsAttrToNode(session,it.value(2),keynodes.nrel_pattern,sc.SC_CONST) for el in els: it2 = session.create_iterator(session.sc_constraint_new(sc_constants.CONSTR_3_f_a_a, el, sc.SC_A_CONST | sc.SC_POS, sc.SC_CONST | sc.SC_NODE ), True) while not it2.is_over(): if altqIdtf is None: altqIdtf = "XXX" self.questionPatterns[altqIdtf] = it.value(2) pattern = altqIdtf + " = " + session.get_content_str(it2.value(2)) self.addNewPattern(pattern) it2.next() it.next()
def findChildPlanets(session, parent): """ Find planets which turn around parent planet. @param session: current workable session @type session: sc_session @param parent: parent planet @type parent: sc_global_addr @return: child planets @rtype: list[sc_global_addr] """ turn_around = space_keynodes.SpaceRelation.turn_around childs = addr2 = sc_utils.searchBinPairsAttrToNode(session, parent, turn_around, sc.SC_N_CONST) return childs