class_docstr: A Directed Acyclic Graph
class_docstr_tok: ["A","Directed","Acyclic","Graph"]
docstr: When evidence in the form of
  keyvals are provided to the .query() method
  validate that all keys match a variable name
  and that all vals are in the domain of
  the variable
docstr_tok: ["When","evidence","in","the","form","of","keyvals","are","provided","to","the",".query","(",")","method","validate","that","all","keys","match","a","variable","name","and","that","all","vals","are","in","the","domain","of","the","variable"]
code: def validate_keyvals(self, **kwds):
      """
      When evidence in the form of
      keyvals are provided to the .query() method
      validate that all keys match a variable name
      and that all vals are in the domain of
      the variable
      """
      vars = set([n.variable_name for n in self.nodes])
      for k, v in list(kwds.items()):
          if k not in vars:
              raise VariableNotInGraphError(k)
          domain = self.domains.get(k, (True, False))
          if v not in domain:
              raise VariableValueNotInDomainError(f"{k}={v}")
      return True
  
imports: import copy
  import heapq
  import logging
  from collections import defaultdict
  from io import StringIO
  from itertools import combinations, product
  from random import choice, random
  from .exceptions import VariableNotInGraphError, VariableValueNotInDomainError
  from .graph import Node, UndirectedGraph, UndirectedNode, connect
  from .utils import get_args, get_original_factors
label_desc: Use image node_id 4 for calling the BBN obj's underlying member method code with example usage: obj.validate_keyvals() and returns: True