original_docstring: Given two terms, find articles in chemotext that connect them, and return as a KEdge.
          If nothing is found, return None
docstring: Given two terms, find articles in chemotext that connect them, and return as a KEdge.
  If nothing is found, return None
docstring_tokens: Given two terms find articles in chemotext that connect them and return as a KEdge . If nothing is found return None
code: def term_to_term(self,node_a,node_b,limit = 10000):
          """Given two terms, find articles in chemotext that connect them, and return as a KEdge.
          If nothing is found, return None"""
          logging.getLogger('application').debug('identifiers: {} to {}'.format(node_a.identifier, node_b.identifier))
          meshes_a = self.get_mesh_labels(node_a)
          meshes_b = self.get_mesh_labels(node_b)
          articles=[]
          from datetime import datetime
          start = datetime.now()
          for label_a in meshes_a:
              for label_b in meshes_b:
                  response = self.ctext.query( query="MATCH (d:Term)-[r1]-(a:Art)-[r2]-(t:Term) WHERE d.name='%s' AND t.name='%s' RETURN a LIMIT %d" % (label_a, label_b, limit))
                  for result in response['results']:
                      for data in result['data']:
                          articles += data['row']
          end = datetime.now()
          logging.getLogger('application').debug('chemotext: {} to {}: {} ({})'.format(meshes_a, meshes_b, len(articles), end-start))
          if len(articles) > 0:
              #ke= KEdge( 'chemotext', 'term_to_term', { 'publications': articles }, is_support = True )
              pmids = [f'PMID:{x["pmid"]}' for x in articles]
              ke = KEdge('chemotext.term_to_term', dt.now(), 'chemotext:1', 'literature_co-occurence',
                         f'{node_a.identifier},{node_b.identifier}','chemotext:1','literature_co-occurence',publications=pmids,
                         is_support=True)
              ke.source_node = node_a
              ke.target_node = node_b
              return ke
          return None
code_tokens: def term_to_term ( self , node_a , node_b , limit = 10000 ) : logging . getLogger ( 'application' ) . debug ( 'identifiers: {} to {}' . format ( node_a . identifier , node_b . identifier ) ) meshes_a = self . get_mesh_labels ( node_a ) meshes_b = self . get_mesh_labels ( node_b ) articles = [ ] from datetime import datetime start = datetime . now ( ) for label_a in meshes_a : for label_b in meshes_b : response = self . ctext . query ( query = "MATCH (d:Term)-[r1]-(a:Art)-[r2]-(t:Term) WHERE d.name='%s' AND t.name='%s' RETURN a LIMIT %d" % ( label_a , label_b , limit ) ) for result in response [ 'results' ] : for data in result [ 'data' ] : articles += data [ 'row' ] end = datetime . now ( ) logging . getLogger ( 'application' ) . debug ( 'chemotext: {} to {}: {} ({})' . format ( meshes_a , meshes_b , len ( articles ) , end - start ) ) if len ( articles ) > 0 : pmids = [ f'PMID:{x["pmid"]}' for x in articles ] ke = KEdge ( 'chemotext.term_to_term' , dt . now ( ) , 'chemotext:1' , 'literature_co-occurence' , f'{node_a.identifier},{node_b.identifier}' , 'chemotext:1' , 'literature_co-occurence' , publications = pmids , is_support = True ) ke . source_node = node_a ke . target_node = node_b return ke return None
short_docstring: Given two terms, find articles in chemotext that connect them, and return as a KEdge.
short_docstring_tokens: Given two terms find articles in chemotext that connect them and return as a KEdge .
comment: """Given two terms, find articles in chemotext that connect them, and return as a KEdge.
          If nothing is found, return None"""$SEP$#ke= KEdge( 'chemotext', 'term_to_term', { 'publications': articles }, is_support = True )