Exemple #1
0
def entry(param, data_parse):

    l = Identify.prepare_layout('igor.moraes', 'common-indentify')
    l2 = Identify.prepare_layout('igor.moraes', 'common-indentify')
    onto = Identify.prepare_data_by_ask(l, param, 'igor.moraes',
                                        'common-indentify', [])
    for dta in data_parse:
        #print 'process data:',dta
        ir = Identify.process_data(l2, dta, onto, 'common-indentify',
                                   'igor.moraes')
        for topico in ir[0].topicos:
            if len(topico.dt) > 0:
                print '==========================================='
                print topico.dt
                print 'sins:--'

                def pr(topico):
                    for p in topico.sinapses:
                        print p.nr.dt
                        if p.opcode == 'Relaction':
                            print '?????????????????????????????????'
                            pr(p.nr)
                            print '?????????????????????????????????'
                        elif p.opcode == "cmpp":
                            print ';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;'

                pr(topico)
                print '-------'
                print '==========================================='
 def process_page(lines_doc2,id,purpose,pgs,finish,th):
  ln_o=''
  try:
    l2=Identify.prepare_layout(id,purpose)
    if True :
     for s in lines_doc2:
      ln_o+=' '+s
     if umisc.trim(ln_o) == '':
      finish.finished=True
      return 
     ir=Identify.process_data(l2,ln_o,onto_basis,purpose,id,th) 
     if ir[0] != None :
      result_onto_tree_er.append(ir[0])
     if ir[1] != None:
      result_onto_tree_bpm.append(ir[1])   
    finish.finished=True
  except:
    finish.finished=True    
  print 'Thread ',pgs,' was finished.','Len:',len(ln_o),' process:',start_c/10
Exemple #3
0
def entry_process(param, data_parse, usr):

    layouts_f = get_layouts(usr, 'simple-search')
    layouts_f2 = get_layouts2(usr, 'simple-search')

    rets = []
    str_ret = []

    l = Identify.prepare_layout(usr, 'simple-search')
    l2 = Identify.prepare_layout(usr, 'simple-search')
    onto = Identify.prepare_data_by_ask(l, param, usr, 'simple-search', [])

    for dta in data_parse:
        ir = Identify.process_data(l2, dta, onto, 'simple-search', usr)
        if ir[0] == None: continue
        for topico in ir[0].topicos:
            if len(topico.dt) > 0:
                it = topico.dt
                its = []
                for p in topico.sinapses:
                    its.append([p.opcode, p.nr.dt])
                rets.append([it, its])

    for tp in rets:
        if 'identificador' in tp[0]:
            c2 = tp[1]
            for tp2 in c2:
                for dt in tp2[1]:
                    str_ret.append(dt)
    #========================================
    sret = '%'
    for s in str_ret:
        sret += (s + '%')
    #==================
    if sret == '%':
        sret += (param + '%')

    return sret
Exemple #4
0
 def process_page(lines_doc2,id,purpose,pgs,finish,th):
  ln_o=''
  conn= MySQLdb.connect(host='dbmy0023.whservidor.com', user='******' , passwd='acc159753', db='mindnet')
  if True:
  #try:
    l2=Identify.prepare_layout(conn,id,purpose)
    if True :
     for s in lines_doc2:
      ln_o=s
      if umisc.trim(ln_o) == '':
       finish.finished=True
       return 
      ir=Identify.process_data(conn,l2,ln_o,onto_basis,purpose,id,th) 
      if ir[0] != None :
       # procura identificador ---
       fnd_ident=False
       for es in ir[0].topicos:
        if ir[0].es_compare_dt(es,'identificador'):
         fnd_ident=True
       if not fnd_ident:
        ind=len(result_onto_tree_er)-1
        fond_cs=False
        while ind >=0 and not fond_cs:
         for es2 in result_onto_tree_er[ind].topicos:
          if ir[0].es_compare_dt(es2,'identificador'):
            ir[0].set_topico_nr(es2)
            fond_cs=True
            break
         ind-=1  
       
       # verificar se nao tem somente identificadores(elemento fact invalido)     
       oth=False         
       for es in ir[0].topicos:
        if ir[0].es_compare_dt(es,'identificador'):
         pass
        else:
         oth=True
       if not oth:
        continue 
       result_onto_tree_er.append(ir[0])
       # procurar group 
       ind=len(result_onto_tree_er)-1
       while ind >=0 :
         if ir[0] != result_onto_tree_er[ind]:
           for es2 in result_onto_tree_er[ind].topicos:
            if ir[0].es_compare_dt(es2,'identificador'):
             for top in ir[0].topicos:
              if ir[0].compare_dt_depend(conn,usr,purpose,es2,top,['']):
                # encontrou referencias do mesmo identificador, incluir nos objetos linkados
                rt=None
                fnd_new=False
                for k1 in result_linked:
                 for k2 in k1:
                  if k1 == ir[0]:
                   fnd_new=True
                   rt=k1
                #= 
                if not fnd_new:
                 result_linked.append([ir[0]])
                 rt= result_linked[len(result_linked)-1 ]
                
                #=======================================
                fnd_new=False
                for k2 in rt:
                  if k2 == result_onto_tree_er[ind]:
                   fnd_new=True
                if not fnd_new:
                 rt.append(result_onto_tree_er[ind])                
         ind-=1  
       
       #==========================
      if ir[1] != None:
       result_onto_tree_bpm.append(ir[1])   
  #except Exception ,err:
  #  print 'Except:',err
  #  finish.finished=True    
  finish.finished=True
  conn.close()
  print 'Thread ',pgs,' was finished.','Len:',len(ln_o),' process:',start_c/10