class_docstr: A class that represents a collection/database of rewrites.
  
  These databases are used to logically organize collections of rewrites
  (i.e. `GraphRewriter`\s and `NodeRewriter`).
class_docstr_tok: ["A","class","that","represents","a","collection\/database","of","rewrites",".","These","databases","are","used","to","logically","organize","collections","of","rewrites","(","i.e",".","`","GraphRewriter","`","\\s","and","`","NodeRewriter","`",")","."]
code: def query(self, *tags, **kwtags):
      if len(tags) >= 1 and isinstance(tags[0], RewriteDatabaseQuery):
          if len(tags) > 1 or kwtags:
              raise TypeError(
                  "If the first argument to query is an `RewriteDatabaseQuery`,"
                  " there should be no other arguments."
              )
          return self.__query__(tags[0])
      include = [tag[1:] for tag in tags if tag.startswith("+")]
      require = [tag[1:] for tag in tags if tag.startswith("&")]
      exclude = [tag[1:] for tag in tags if tag.startswith("-")]
      if len(include) + len(require) + len(exclude) < len(tags):
          raise ValueError(
              "All tags must start with one of the following"
              " characters: '+', '&' or '-'"
          )
      return self.__query__(
          RewriteDatabaseQuery(
              include=include,
              require=require,
              exclude=exclude,
              subquery=kwtags,
          )
      )
  
imports: import copy
  import math
  import sys
  from collections.abc import Iterable, Sequence
  from functools import cmp_to_key
  from io import StringIO
  from typing import Optional, Union
  from pytensor.configdefaults import config
  from pytensor.graph.rewriting import basic
  from pytensor.misc.ordered_set import OrderedSet
  from pytensor.utils import DefaultOrderedDict
label_desc: Use image node_id 6 for calling the RewriteDatabase obj's underlying member method code with example usage: obj.query() and returns: self, self