# Path: pyke/knowledge_engine.py
#     class chain(object):
# class CanNotProve(StandardError):
# class engine(object):
#         def __new__(cls, *args):
#         def from_iterable(i):
#     def __init__(self, *search_paths, **kws):
#     def _create_target_pkg(self, path, target_pkgs):
#     def get_ask_module(self):
#     def reset(self):
#     def get_kb(self, kb_name, _new_class = None):
#     def get_rb(self, rb_name):
#     def get_create(self, rb_name, parent = None, exclude_list = ()):
#     def get_ke(self, kb_name, entity_name):
#     def add_universal_fact(self, kb_name, fact_name, args):
#     def add_case_specific_fact(self, kb_name, fact_name, args):
#     def assert_(self, kb_name, entity_name, args):
#     def activate(self, *rb_names):
#     def lookup(self, kb_name, entity_name, pat_context, patterns):
#     def prove_goal(self, goal_str, **args):
#     def prove_1_goal(self, goal_str, **args):
#     def prove(self, kb_name, entity_name, pat_context, patterns):
#     def prove_n(self, kb_name, entity_name, fixed_args = (), num_returns = 0):
#         def gen():
#     def prove_1(self, kb_name, entity_name, fixed_args = (), num_returns = 0):
#     def print_stats(self, f = sys.stdout):
#     def trace(self, rb_name, rule_name):
#     def untrace(self, rb_name, rule_name):
# def _get_target_pkg(target_name):
# def _pythonify_path(path):
# def _is_package_dir(path):
# def in_sys_path(path):
# 
# Path: pyke/krb_traceback.py
# def print_tb(traceback, limit=None, file=None):
# def print_exception(type, value, traceback, limit=None, file=None):
# def print_exc(limit=None, file=None):
# def format_exc(limit=None):
# def print_last(limit=None, file=None):
# def print_stack(f=None, limit=None, file=None):
# def extract_tb(tb, limit=None):
# def extract_stack(f=None, limit=None):
# def format_exception(type, value, traceback, limit=None):
# def format_tb(tb, limit=None):
# def format_stack(f=None, limit=None):
# def convert_lineno(module, lineno):
# def convert_tb(extracted_tb):


import sys
from pyke import knowledge_engine
from pyke import krb_traceback

engine = knowledge_engine.engine(__file__)

def fc_test():
    engine.reset()
    try:
        engine.activate('fc_notany')
    except:
        krb_traceback.print_exc()
        sys.exit(1)

def bc_test():
    engine.reset()
    try:
        engine.activate('bc_notany')

        #with engine.prove_goal(
        #       'bc_notany.siblings($sibling1, $sibling2, $_, $_)') \
        #  as gen1:
        #    for vars, plan in gen1:
        #        print "siblings:", vars['sibling1'], vars['sibling2']
  
        with engine.prove_goal('bc_notany.child_with_no_aunt($child)') as gen2:
            for vars, plan in gen2:
                print vars['child'], "has no aunt"

        with engine.prove_goal('bc_notany.child_with_no_uncle($child)') as gen3:
            for vars, plan in gen3:
                print vars['child'], "has no uncle"
    except:

# Path: pyke/knowledge_engine.py
#     class chain(object):
# class CanNotProve(StandardError):
# class engine(object):
#         def __new__(cls, *args):
#         def from_iterable(i):
#     def __init__(self, *search_paths, **kws):
#     def _create_target_pkg(self, path, target_pkgs):
#     def get_ask_module(self):
#     def reset(self):
#     def get_kb(self, kb_name, _new_class = None):
#     def get_rb(self, rb_name):
#     def get_create(self, rb_name, parent = None, exclude_list = ()):
#     def get_ke(self, kb_name, entity_name):
#     def add_universal_fact(self, kb_name, fact_name, args):
#     def add_case_specific_fact(self, kb_name, fact_name, args):
#     def assert_(self, kb_name, entity_name, args):
#     def activate(self, *rb_names):
#     def lookup(self, kb_name, entity_name, pat_context, patterns):
#     def prove_goal(self, goal_str, **args):
#     def prove_1_goal(self, goal_str, **args):
#     def prove(self, kb_name, entity_name, pat_context, patterns):
#     def prove_n(self, kb_name, entity_name, fixed_args = (), num_returns = 0):
#         def gen():
#     def prove_1(self, kb_name, entity_name, fixed_args = (), num_returns = 0):
#     def print_stats(self, f = sys.stdout):
#     def trace(self, rb_name, rule_name):
#     def untrace(self, rb_name, rule_name):
# def _get_target_pkg(target_name):
# def _pythonify_path(path):
# def _is_package_dir(path):
# def in_sys_path(path):
# 
# Path: pyke/krb_traceback.py
# def print_tb(traceback, limit=None, file=None):
# def print_exception(type, value, traceback, limit=None, file=None):
# def print_exc(limit=None, file=None):
# def format_exc(limit=None):
# def print_last(limit=None, file=None):
# def print_stack(f=None, limit=None, file=None):
# def extract_tb(tb, limit=None):
# def extract_stack(f=None, limit=None):
# def format_exception(type, value, traceback, limit=None):
# def format_tb(tb, limit=None):
# def format_stack(f=None, limit=None):
# def convert_lineno(module, lineno):
# def convert_tb(extracted_tb):


# Path: examples/notany/driver.py
import sys
from pyke import knowledge_engine
from pyke import krb_traceback


engine = knowledge_engine.engine(__file__)

def fc_test():
    engine.reset()
    try:
        engine.activate('fc_notany')
    except:
        krb_traceback.print_exc()
        sys.exit(1)

def bc_test():
    engine.reset()
    try:
        engine.activate('bc_notany')

        #with engine.prove_goal(
        #       'bc_notany.siblings($sibling1, $sibling2, $_, $_)') \
        #  as gen1:
        #    for vars, plan in gen1:
        #        print "siblings:", vars['sibling1'], vars['sibling2']
  
        with engine.prove_goal('bc_notany.child_with_no_aunt($child)') as gen2:
            for vars, plan in gen2:
                print vars['child'], "has no aunt"

        with engine.prove_goal('bc_notany.child_with_no_uncle($child)') as gen3:
            for vars, plan in gen3:
                print vars['child'], "has no uncle"
    except:

        krb_traceback.print_exc()