def search(self, template: str) -> Result:
        """Search the :class:`Element <Element>` for the given Parse template.

        :param template: The Parse template to use.
        """

        return parse_search(template, self.html)
Ejemplo n.º 2
0
    def search(self, template: str) -> Result:
        """Search the :class:`Element <Element>` for the given Parse template.

        :param template: The Parse template to use.
        """

        return parse_search(template, self.html)
Ejemplo n.º 3
0
    def search(self,
               term,
               db="pubmed",
               field=None,
               daterange=None,
               dbtype=None):

        set_klass = _get_recordset_constructor(db, dbtype)

        infile = self.eutils.esearch(
            term=term,
            db=db,
            field=field,
            retstart=0,
            retmax=0,
            daterange=daterange,
            usehistory=1,
            webenv=self.webenv_ref[0],
        )
        searchinfo = parse.parse_search(infile, self.webenv_ref)

        if searchinfo.query_key is not None:
            cookie = HistoryCookie(db, self.webenv_ref, searchinfo.query_key)
        else:
            assert searchinfo.count == 0
            cookie = HistoryCookie(db, None, None)

        recordset = set_klass(self.eutils, cookie, 0, searchinfo.count,
                              searchinfo)
        # won't have a query_key if the search turned up empty
        if searchinfo.query_key is not None:
            self._check_for_cache_reset(searchinfo.query_key)
            self.query_history[searchinfo.query_key] = recordset

        return recordset
Ejemplo n.º 4
0
    def search(self, template):
        """Search the :class:`Element <Element>` for the given Parse template.

        :param template: The Parse template to use.
        """
        if not isinstance(template, str):
            raise TypeError("Expected string, got %r" % type(template))

        return parse_search(template, self.html)
Ejemplo n.º 5
0
    def search(self,
               term,
               db = "pubmed",
               field = None,

               retstart = 0,
               retmax = 20,

               daterange = None,
               dbtype = None,
               ):
        """do an Entrez search

        The parameters are:
          'term' -- the query string in the Entrez query language; see
             http://www.ncbi.nlm.nih.gov/entrez/query/static/help/pmhelp.html
          'db' -- the database to search

          'field' -- the field to use for unqualified words
                  Eg, "dalke[au] AND gene" with field==None becomes
                    dalke[au] AND (genes[MeSH Terms] OR gene[Text Word]
                  and "dalke[au] AND gene" with field=="au" becomes
                    dalke[au] AND genes[Author]
                 (Yes, I think the first "au" should be "Author" too)

          'retstart' -- include identifiers in the output, starting with
                   position 'retstart' (normally starts with 0)
          'retmax' -- return at most 'retmax' identifiers in the output
                   (if not specified, NCBI returns 20 identifiers)
          'daterange' -- a date restriction; either WithinNDays or DateRange
          
          'dbtype' -- (optional) the database type (Config.PUBLICATION_TYPE
                  or SEQUENCE_TYPE).  Overrides the type based on the 'db'
        """
        set_klass = _get_recordset_constructor(db, dbtype)
        infile = self.eutils.esearch(
            term = term,
            db = db,
            field = field,
            retstart = retstart,
            retmax = retmax,
            daterange = daterange)
        searchinfo = parse.parse_search(infile, [None])

        dbids = Datatypes.DBIds(db, searchinfo.ids)
        return set_klass(self.eutils, dbids, searchinfo)
Ejemplo n.º 6
0
    def search(
        self,
        term,
        db="pubmed",
        field=None,
        retstart=0,
        retmax=20,
        daterange=None,
        dbtype=None,
    ):
        """do an Entrez search

        The parameters are:
          'term' -- the query string in the Entrez query language; see
             http://www.ncbi.nlm.nih.gov/entrez/query/static/help/pmhelp.html
          'db' -- the database to search

          'field' -- the field to use for unqualified words
                  Eg, "dalke[au] AND gene" with field==None becomes
                    dalke[au] AND (genes[MeSH Terms] OR gene[Text Word]
                  and "dalke[au] AND gene" with field=="au" becomes
                    dalke[au] AND genes[Author]
                 (Yes, I think the first "au" should be "Author" too)

          'retstart' -- include identifiers in the output, starting with
                   position 'retstart' (normally starts with 0)
          'retmax' -- return at most 'retmax' identifiers in the output
                   (if not specified, NCBI returns 20 identifiers)
          'daterange' -- a date restriction; either WithinNDays or DateRange
          
          'dbtype' -- (optional) the database type (Config.PUBLICATION_TYPE
                  or SEQUENCE_TYPE).  Overrides the type based on the 'db'
        """
        set_klass = _get_recordset_constructor(db, dbtype)
        infile = self.eutils.esearch(term=term,
                                     db=db,
                                     field=field,
                                     retstart=retstart,
                                     retmax=retmax,
                                     daterange=daterange)
        searchinfo = parse.parse_search(infile, [None])

        dbids = Datatypes.DBIds(db, searchinfo.ids)
        return set_klass(self.eutils, dbids, searchinfo)
Ejemplo n.º 7
0
    def search(self,
               term,
               db = "pubmed",
               field = None,
               daterange = None,
               dbtype = None
               ):
        
        set_klass = _get_recordset_constructor(db, dbtype)
        
        infile = self.eutils.esearch(
            term = term,
            db = db,
            field = field,

            retstart = 0,
            retmax = 0,
            
            daterange = daterange,
            
            usehistory = 1,
            webenv = self.webenv_ref[0],
            )
        searchinfo = parse.parse_search(infile, self.webenv_ref)

        if searchinfo.query_key is not None:
            cookie = HistoryCookie(db, self.webenv_ref, searchinfo.query_key)
        else:
            assert searchinfo.count == 0
            cookie = HistoryCookie(db, None, None)
        
        recordset = set_klass(self.eutils, cookie, 0, searchinfo.count,
                              searchinfo)
        # won't have a query_key if the search turned up empty
        if searchinfo.query_key is not None:
            self._check_for_cache_reset(searchinfo.query_key)
            self.query_history[searchinfo.query_key] = recordset

        return recordset
Ejemplo n.º 8
0
 def search(self, template):
     """Searches the element for the given parse template."""
     return parse_search(template, self.html)
Ejemplo n.º 9
0
 def search(self, template):
     """Searches the :class:`Element <Element>` for the given parse template."""
     return parse_search(template, self.html)
Ejemplo n.º 10
0
 def parse(self, template: str):
     return parse_search(template, self.html)[0]
Ejemplo n.º 11
0
 def search(self, template: str) -> Result:
     """Searches the :class:`Element <Element>` for the given parse template."""
     return parse_search(template, self.html)